verilog... traffic light.. what is the problem?

Status
Not open for further replies.

agobgocgo

Newbie level 3
Joined
May 1, 2013
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,325


`define SWIDTH 4
`define GNS 4`b1000
`define YNS 4`b0100
`define GEW 4`b0010
`define YEW 4`b0001

`define GNSL 6`b100001
`define YNSL 6`b010001
`define GEWL 6`b001100
`define YEWL 6`b001010

module DFF(clk, in, out);
parameter n=1;
input clk;
input [n-1:0] in;
output [n-1:0] out;
reg [n-1:0] out;

always @(posedge clk)
out = in;
endmodule


module traffic_light(clk, rst, carew, lights);
input clk;
input rst;
input carew;
output [5:0] lights;
wire [`SWIDTH-1:0] state, next;
reg [`SWIDTH-1:0] next1 ;
reg [5:0] lights;

DFF #(`SWIDTH) state_reg(clk, next, state);

always @(*) begin
case(state)
`GNS: {next1, lights} = {(carew ? `YNS : `GNS), `GNSL} ;
`YNS: {next1, lights} = {`GEW, `YNSL} ;
`GEW: {next1, lights} = {`YEW, `GEWL} ;
`YEW: {next1, lights} = {`GNS, `YEWL} ;
default : {next1, lights} = {`SWIDTH+6{1`bx}} ;
endcase
end

assign next = rst ? `GNS : next1 ;
endmodule



* Error: C:/Modeltech_pe_edu_10.2/examples/traffic_light.v(37): (vlog-2163) Macro `b1000 is undefined.

** Error: C:/Modeltech_pe_edu_10.2/examples/traffic_light.v(37): (vlog-2163) Macro `b0100 is undefined.

** Error: C:/Modeltech_pe_edu_10.2/examples/traffic_light.v(37): (vlog-2163) Macro `b1000 is undefined.

** Error: C:/Modeltech_pe_edu_10.2/examples/traffic_light.v(37): (vlog-2163) Macro `b100001 is undefined.

** Error: C:/Modeltech_pe_edu_10.2/examples/traffic_light.v(38): (vlog-2163) Macro `b0100 is undefined.

** Error: C:/Modeltech_pe_edu_10.2/examples/traffic_light.v(38): (vlog-2163) Macro `b0010 is undefined.

** Error: C:/Modeltech_pe_edu_10.2/examples/traffic_light.v(38): (vlog-2163) Macro `b010001 is undefined.

** Error: C:/Modeltech_pe_edu_10.2/examples/traffic_light.v(39): (vlog-2163) Macro `b0010 is undefined.

** Error: C:/Modeltech_pe_edu_10.2/examples/traffic_light.v(39): (vlog-2163) Macro `b0001 is undefined.

** Error: C:/Modeltech_pe_edu_10.2/examples/traffic_light.v(39): (vlog-2163) Macro `b001100 is undefined.

** Error: C:/Modeltech_pe_edu_10.2/examples/traffic_light.v(40): (vlog-2163) Macro `b0001 is undefined.

** Error: C:/Modeltech_pe_edu_10.2/examples/traffic_light.v(40): (vlog-2163) Macro `b1000 is undefined.

** Error: C:/Modeltech_pe_edu_10.2/examples/traffic_light.v(40): (vlog-2163) Macro `b001010 is undefined.

** Error: C:/Modeltech_pe_edu_10.2/examples/traffic_light.v(41): (vlog-2163) Macro `bx is undefined.

** Error: C:/Modeltech_pe_edu_10.2/examples/traffic_light.v(45): (vlog-2163) Macro `b1000 is undefined.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…