A circuit that depends on its past values
→ Sequential circuits have memory
Latches
Basic memory element, we have
A characteristic table describes the behavior of the sequential circuit, here :
Depending on the value of the output, a latch can be in one of two states :
A state is a property of the memory element
The element described above is known as a set-reset latch
Let’s look into its states
| State | |||
|---|---|---|---|
| Circuit state does not change (it is stable) | |||
| Output is reset to | |||
| Output is set to | |||
| Output is reset to ( dominates) |
We see that this circuit holds its state (memory !)
D Latch
A D latch is level-sensitive. While the signal is active, the output of follows all changes taking place on
Flip-Flops
We want tighter control of when the D latch activates.
A Flip-Flop is an edge sensitive memory elements → only activates when the clock signal has its rising edge
always @(posedge Clock) → used to describe sequential that trigger on a clock rising edge.
Only use non-blocking assignments
<=
Clock
- A signal that determines when the state changes
- Typically defined by its frequency (or duty ratio)
Synchronous vs Asynchronous
A synchronous signal is one that is taken into account when the clock is switching states (rising or falling edge)
An asynchronous signal is one that immediately affects the output, regardless of the clock
Non-blocking assignments
Causes assignments within an always block to occur in parallel
Allows for modelling of sequential logic behavior ⇒ signals changing won’t affect each other.
Registers
A register is essentially a bunch of flip-flops, that store bits, one flip flop per bit.
Often we see a reset and a clock
A -bit register has different values possible
Shift Registers
A shift register shifts the -bit value one bit to the left or to the right
We chain registers, where the -th register is bit of the number shifted times
We have a variant where we can choose (with a SEL into MUX) to set the data in parallel
Counters
A simple circuit that increments/decrements its value
(could be made using a add/sub by one, but it is too overkill)
- We have a single input choosing whether to turn on the counter
- We have an output vector denoting the number
- We have a clock
- It resets back to 0 after clock cycles
It can again be desirable to start from another value than one, so we can once again use MUX and a LOAD signal to load a value into the registers in parallel
Loops
We can create for — while — repeat and forever loops in verilog
For loops are instantiated as in any other programming languages