Diferență între revizuiri ale paginii „Sequential Circuits”
Cbira (discuție | contribuții) |
Cbira (discuție | contribuții) |
||
(Nu s-au afișat 2 versiuni intermediare efectuate de același utilizator) | |||
Linia 16: | Linia 16: | ||
<div class="rule"><font color="red">'''Rule:'''</font> Loading a value into a register is performed only on an edge of the clock </div> | <div class="rule"><font color="red">'''Rule:'''</font> Loading a value into a register is performed only on an edge of the clock </div> | ||
− | <div class="rule"> <font color="red"> '''Rule:''' </font> In Verilog | + | <div class="rule"> <font color="red"> '''Rule:''' </font> In Verilog loading a value into a register is performed in '''always''' sequential blocks. </div> |
− | If a module is sequential, then it will have a clock input port. </div | + | <div class="rule"> <font color="red"> '''Rule:''' </font> If a module is sequential, then it will have a clock input port. </div> |
[[File: seq2.png | Graphical Representation of a Nbit Registry]] | [[File: seq2.png | Graphical Representation of a Nbit Registry]] |
Versiunea curentă din 11 aprilie 2018 23:46
Sequential circuits are circuits that are synchronized by a clock signal, ie whose outputs change only on the positive (or negative, clockwise) front of the clock.
Clock signal
The clock signal is a periodic signal that oscillates with a certain frequency, called the clock frequency.
Note: See syntax Verilog to find out how to generate a clock signal in simulation.
Memory Circuits. Register
The register is the basic memory cell and the base of the sequential circuits. Once a value is loaded into a registry, it is retained until it is overwritten with another value.
This is the implementation in Verilog of a 4-bit register that only loads the register with the input value, and in the picture you can see a Modelsim simulation that shows that the output only changes on the positive clock front following the change of input:
module Register (
output reg [3: 0] out,
input [3: 0] in,
input clock
)
always @ (posedge clock) begin
out <= in;
end
endmodule
Reset for sequential circuits
There are situations where registers need to be reset, that is, loaded with a default value. This reset process is typically used when the circuit blocks, for one reason or another, or when it is to be restarted from an initial state. Circuits for which it is necessary to be reset can be added to a reset signal. The description in Verilog of a 4-bit register with a reset signal, which only loads with an input value, is the following:
module Register (
output reg [3: 0] out,
input [3: 0] in,
input clock,
input reset
)
always @ (posedge clock) begin
if (reset) begin
out <= 4'b0;
end else begin
out <= in;
end
end
endmodule
This type of reset is called synchronous reset, because it is only evaluated on the clock front (synchronous with the clock). There are also cases where the reset is asynchronous, and then the active reset queue must appear in the block's list of sensitivities always.