I'm working on an assignment where I need to implement a sequential circuit with a d-flip-flop, but the output is null, and it doesn't output multiple times like I thought it would.
The output is a2 = x,b1 = x,b2 = x,a1 = x
module TestBench;
initial begin
$dumpfile("dump.vcd");
$dumpvars;
#10000
$finish;
end
reg t_a, t_b, clk;
wire a1, a2, b1, b2;
initial begin
$monitor("a2 = %b,b1 = %b,b2 = %b,a1 = %b", a2, b1, b2, a1);
//$finish;
end
always #10 clk = ~clk;
Main DUT0(a1, a2, b1, b2, clk, t_a, t_b);
initial begin
t_a = 0;t_b = 0;#20
t_b = 1;#20
t_a = 1;t_b = 0;#20
t_b = 1;
end
endmodule
module Main(L_a1, L_a2, L_b1, L_b2, clk, t_a, t_b);
output L_a1, L_a2, L_b1, L_b2;
input t_a, t_b, clk;
wire s0, xor_1, nor_1, or_1, s1, nor_2, and_1, and_0, not_0;
assign nor_1 = ~(s0 | s1 | t_a);
assign nor_2 = ~(not_0 | s1 | t_b);
assign or_1 = nor_1 | nor_2;
DflipFlop DflipFlop_1(s1, , clk, or_1);
assign xor_1 = s0 ^ s1;
DflipFlop DflipFlop_0(s0, , clk, xor_1);
assign L_b2 = s0;
assign not_0 = ~s0;
assign L_a2 = not_0;
assign and_1 = s0 & s1;
assign L_b1 = and_1;
assign and_0 = not_0 & s1;
assign L_a1 = and_0;
endmodule
module DflipFlop(q, q_inv, clk, d);
parameter WIDTH = 1;
output reg [WIDTH-1:0] q, q_inv;
input clk;
input [WIDTH-1:0] d;
always @ (posedge clk)
q <= d;
endmodule