Lec24 Blocks
Lec24 Blocks
SR Latch:
• S is “set” input
• R is “reset” input
QQ’=00 is often called a “forbidden state”
Spring 2009 EECS150 - Lec24-blocks Page 3
• The input “C” works as an “enable” signal, latch only changes output
when C is high.
• usually connected to clock.
• Generally, it is not a good idea to use a clock as a logic signal (into
gates etc.). This is a special case.
Spring 2009 EECS150 - Lec24-blocks Page 5
D-latch
J-K FF
synchronous asynchronous
level-sensitive edge-triggered
D-type n.a.
JK-type n.a.
RS-type
“latch” “flip-flop” “latch”
“natural” form
“possible” form
Carry generate
ab
FIFOs
FIFO Interfaces
• Address pointers are used internally
DIN RST CLK to keep next write position and next
read position into a dual-port
WE
FIFO memory.
FULL
write ptr
HALF FULL
EMPTY
read ptr
RE
DOUT • If pointers equal after write ⇒ FULL:
b 7b 6b 5b 4b 3b 2b 1b 0p b 7b 6b 5b 4b 3b 2b 1b 0p
+ +
c
• A non-zero parity indicates an error occurred:
– two errors (on different bits) is not detected (nor any even number of
errors)
– odd numbers of errors are detected.
Applications of LFSRs
• Performance: • Can be used as a random
– In general, xors are only ever 2- number generator.
input and never connect in series. – Sequence is a pseudo-
– Therefore the minimum clock period random sequence:
for these circuits is: • numbers appear in a
T > T2-input-xor + clock overhead random sequence
• repeats every 2n-1 patterns
– Very little latency, and independent
– Random numbers useful in:
of n!
• computer graphics
• This can be used as a fast counter, • cryptography
if the particular sequence of count • automatic testing
values is not important. • Used for error detection and
– Example: micro-code micro-pc correction
• CRC (cyclic redundancy
codes)
• ethernet uses them
x2 + x + 1
× x+1
x +x+1
2
x3 + x2 + x
x3 +1
Spring 2009 EECS150 – Lec24-blocks Page
Galois Fields - The theory behind LFSRs
• These polynomials form a • Additionally, …
Galois (finite) field if we take the • Every Galois field has a primitive
results of this multiplication element, α, such that all non-zero
modulo a prime polynomial p(x). elements of the field can be
– A prime polynomial is one that expressed as a power of α. By
cannot be written as the product raising α to powers (modulo p(x)),
of two non-trivial polynomials all non-zero field elements can be
q(x)r(x) formed.
– Perform modulo operation by • Certain choices of p(x) make the
subtracting a (polynomial) simple polynomial x the primitive
multiple of p(x) from the result. element. These polynomials are
If the multiple is 1, this called primitive, and one exists for
corresponds to XOR-ing the every degree.
result with p(x). • For example, x4 + x + 1 is primitive.
• For any degree, there exists at So α = x is a primitive element and
least one prime polynomial. successive powers of α will
generate all non-zero elements of
• With it we can form GF(2n) GF(16). Example on next slide.
α =x
3 3
α4 = x +1
α =
5 x +x
2
α = x + x2
6 3
α7 = x3 +x +1
α =
8 x2 +1 α4 = x4 mod x4 + x + 1
α9 = x3 +x = x4 xor x4 + x + 1
α10 = x2 + x + 1 =x+1
α11 = x3 + x2 + x • In general finding primitive
α12 = x3 + x2 + x + 1 polynomials is difficult. Most people
α13 = x3 + x2 +1 just look them up in a table, such
as:
α =x
14 3 +1
α =
15 1
Spring 2009 EECS150 – Lec24-blocks Page
Primitive Polynomials
x2 + x +1 x12 + x6 + x4 + x +1 x22 + x +1
x3 + x +1 x13 + x4 + x3 + x +1 x23 + x5 +1
x4 + x +1 x14 + x10 + x6 + x +1 x24 + x7 + x2 + x +1
x5 + x2 +1 x15 + x +1 x25 + x3 +1
x6 + x +1 x16 + x12 + x3 + x +1 x26 + x6 + x2 + x +1
x7 + x3 +1 x17 + x3 + 1 x27 + x5 + x2 + x +1
x8 + x4 + x3 + x2 +1 x18 + x7 + 1 x28 + x3 + 1
x9 + x4 +1 x19 + x5 + x2 + x+ 1 x29 + x +1
x10 + x3 +1 x20 + x3 + 1 x30 + x6 + x4 + x +1
x11 + x2 +1 x21 + x2 + 1 x31 + x3 + 1
x32 + x7 + x6 + x2 +1
Galois Field Hardware
Multiplication by x ⇔ shift left
Taking the result mod p(x) ⇔ XOR-ing with the coefficients of p(x)
when the most significant coefficient is 1.
Obtaining all 2n-1 non-zero ⇔ Shifting and XOR-ing 2n-1 times.
elements by evaluating xk
for k = 1, …, 2n-1
Spring 2009 EECS150 – Lec24-blocks Page