Here are the parameters enter image description here
I have ran the files and checked the gtk wave and I can't figure out where my wiring is going wrong. I am using a moore circuit with one input. I just need someone to help me figure out where I am messing up the wiring. Thanks
module traffic(T, CLK, GN, YN, RN, GE, YE, RE);
// inputs
input CLK;
input T;
// outputs
output reg GN;
output reg YN;
output reg RN;
output reg GE;
output reg YE;
output reg RE;
// flip-flops
reg gN = 1'b1;
reg yN = 1'b0;
reg rN = 1'b0;
reg gE = 1'b0;
reg yE = 1'b0;
reg rE = 1'b1;
// Wires
wire gNplus = 1'b1;
wire yNplus = 1'b0;
wire rNplus = 1'b0;
wire gEplus = 1'b0;
wire yEplus = 1'b0;
wire rEplus = 1'b1;
// Next State and Output
assign CLK = 0;
always @(posedge CLK)
begin
gN <= gNplus;
yN <= yNplus;
rN <= rNplus;
gE <= gEplus;
yE <= yEplus;
rE <= rEplus;
GN <= gN;
YN <= yN;
RN <= rN;
GE <= gE;
YE <= yE;
RE <= rE;
end
// combinational logic
assign gNplus = ~T * ~yN;
assign yNplus = gN;
assign rNplus = (rN * T) | yN;
assign gEplus = ~T * ~yE;
assign yEplus = gE;
assign rEplus = (rE * T) | yE;
endmodule
Test bench
include "traffic.v"
timescale 10ns/1ns
module traffic_test;
reg T;
wire GN;
wire YN;
wire RN;
wire GE;
wire YE;
wire RE;
traffic UUT(.T(T), .CLK(CLK), .GN(gNplus), .YN(yNplus), .RN(rNplus), .GE(gEplus), .YE(yEplus), .RE(rEplus));
reg CLK = 1'b1;
always
begin
CLK = ~CLK;
#5;
end
initial begin
T = 0;
forever begin
#20 T = ~T;
end
end
initial begin
$display("START OF TEST");
$dumpfile("traffic.vcd");
$dumpvars(0, traffic_test);
$display("T | GN YN RN | GE YE RE");
for (integer i = 0;i < 11;i =i + 1)
begin
{T} = i;
$display("%b | %b %b %b | %b %b %b", T, gNplus, yNplus, rNplus, gEplus, yEplus, rEplus);
end
$finish;
$display("END OF TEST");
end
endmodule