初学verilog请教
时间:10-02
整理:3721RD
点击:
我写了两个模块,一个是测试模块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
我将两个模块放在一个文件里面,结果报错 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

不是很明白你说的问题,是仿真编译不过还是综合不过?
看你的错误信息好象是在综合, testbench是不可综合的,只是仿真用的
综合没通过,test bench不能被综合,即综合不出来逻辑-- design does not contain any logic。
立秋小常识
好像不需要加“include”
首先要保证在工作库中已经有你的fsm_nodelay模块
然后再对你的testclock模块进行仿真
fsm_nodelay(.Clock(clock),.Reset(reset),.W(a),.LCountry(kc),.LMain(km),.state(s));
没有人这么例化,
应为:
fsm_nodelay u1 (.Clock(clock),.Reset(reset),.W(a),.LCountry(kc),.LMain(km),.state(s));
testbench不需要放在综合里面的
長知識ing
testbench只是用于仿真的,不需要进行综合实现。
testbench只是用于仿真的,不需要进行综合实现。
testbench是无法综合的,它是用来对你的设计进行仿真的
直接把testbench作为顶层模块,例化调用编写的模块,然后编译后直接仿真,不用综合了
学习
能否给个例子
怎么样多赚信元啊?
怎么样多赚信元啊?
testbench 是拿来方针的
小编太强了!
呵呵 看样子小编还是需要好好看看书
