|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
我写了两个模块,一个是测试模块testclock,另一个是被调用的模块fsm_nodelay
我将两个模块放在一个文件里面,结果报错 Error: Can't synthesize current design -- design does not contain any logic;
当我把两个模块分别放在两个文件里面的时候,还是说 Error: Can't synthesize current design -- design does not contain any logic
加上`include "fms_nodelay.v" 后还是有错误: Error (10228): Verilog HDL error at fsm_nodelay.v(1): module "fsm_nodelay" cannot be declared more than once
project 名字是 testclock,跟顶层模块一样的,请高手指教这是怎么回事啊??
先谢了
`timescale 1ns/100ps
module testclock;//test module
reg a;
reg clock,reset;
wire [4:0]s; //!!!! state(reg) must be connected to "wire"
wire km,kc;
initial // initial value setting
begin
a=0;
reset=1;
end
initial
begin
#33 a=1;
#14 a=0;
#203 a=1;
#20 a=0;
end
always #10 clock=~clock;//T=20
initial
begin #100000 $stop; end
//
fsm_nodelay(.Clock(clock),.Reset(reset),.W(a),.LCountry(kc),.LMain(km),.state(s));
endmodule
module fsm_nodelay(Clock,Reset,W,LMain,LCountry,state); //LMain: Light on the main road LCountry LCountry:light on the country road
input Clock,Reset;
input W; //W=1 表示乡村公路上有车等待通过
output LMain,LCountry;
output state;
reg [1:0]LMain,LCountry;
reg [4:0]state;
//state definition LMain LCountry
parameter S0 = 5'b10000,// GREEN RED
S1 = 5'b01000,// YELLOW RED
S2 = 5'b00100,// RED RED
S3 = 5'b00010,// RED GREEN
S4 = 5'b00001;// RED YELLOW
//colour definition
parameter RED = 2'b00,
YELLOW = 2'b01,
GREEN = 2'b10;
always @(posedge Clock)
if(!Reset)
begin
state<=S0;
LMain<=GREEN;
LCountry<=RED;
end
else
case(state)
S0: if(W)
begin
state<=S1;
LMain<=YELLOW;
LCountry<=RED;
end
else
begin
state<=S0;
LMain<=GREEN;
LCountry<=RED;
end
S1:begin
state<=S2;
LMain<=RED;
LCountry<=RED;
end
S2:begin
state<=S3;
LMain<=RED;
LCountry<=GREEN;
end
S3:if(W)
begin
state<=S3;
LMain<=RED;
LCountry<=GREEN;
end
else
begin
state<=S4;
LMain<=RED;
LCountry<=YELLOW;
end
S4:begin
state<=S0;
LMain<=GREEN;
LCountry<=RED;
end
default: begin
state<=S0;
LMain<=GREEN;
LCountry<=RED;
end
endcase
endmodule
|
|