seq_circuit1
- You can’t instantiate submodules (your FFs) inside an
always
block.
Move them outside, either before or after. - Your instantiations for
jkfflop
are missing theclk
input signal. - based on your diagram, your inputs to the FFs should be combinational logic, not sequential, and should therefore use an
always @(*)
block, not a clocked one.
jkfflop
if
statements in verilog are only valid inside agenerate
,always
orinital
block. Since this is a FF, you’ll want analways @(posedge clk)
oralways @(negedge clk)
- If using an always block, replace the
assign
statements with non-blocking assignments (<=
). We use NBA’s here instead of a blocking assignments (=
), as it’s an edge-triggered block. - If assigning a value to
Q
inside an always block, changeoutput Q
tooutput reg Q
solved Implementing Sequential Circuit in Verilog