seq_circuit1
- You can’t instantiate submodules (your FFs) inside an
alwaysblock.
Move them outside, either before or after. - Your instantiations for
jkfflopare missing theclkinput 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
ifstatements in verilog are only valid inside agenerate,alwaysorinitalblock. Since this is a FF, you’ll want analways @(posedge clk)oralways @(negedge clk)- If using an always block, replace the
assignstatements 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
Qinside an always block, changeoutput Qtooutput reg Q
solved Implementing Sequential Circuit in Verilog