在线咨询
eetop公众号 创芯大讲堂 创芯人才网
切换到宽版

EETOP 创芯网论坛 (原名:电子顶级开发网)

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
查看: 6841|回复: 17

【问】初学verilog请教

[复制链接]
发表于 2009-8-9 16:32:42 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

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
截图.gif
发表于 2009-8-10 16:43:09 | 显示全部楼层
不是很明白你说的问题,是仿真编译不过还是综合不过?

看你的错误信息好象是在综合,  testbench是不可综合的,只是仿真用的
发表于 2009-8-10 21:58:03 | 显示全部楼层
综合没通过,test bench不能被综合,即综合不出来逻辑-- design does not contain any logic
头像被屏蔽
发表于 2009-8-10 22:06:55 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
发表于 2009-8-13 21:38:24 | 显示全部楼层
厉害,我肯定写不出来
发表于 2009-8-14 14:32:32 | 显示全部楼层
好像不需要加“include”
首先要保证在工作库中已经有你的fsm_nodelay模块
然后再对你的testclock模块进行仿真
发表于 2009-8-14 15:38:59 | 显示全部楼层
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));
发表于 2009-8-15 20:51:58 | 显示全部楼层
testbench不需要放在综合里面的
发表于 2009-8-22 21:59:37 | 显示全部楼层
長知識ing
发表于 2009-8-24 10:54:25 | 显示全部楼层
testbench只是用于仿真的,不需要进行综合实现。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

站长推荐 上一条 /1 下一条

X

小黑屋| 手机版| 关于我们| 联系我们| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2025-6-24 16:54 , Processed in 0.031930 second(s), 12 queries , Gzip On, MemCached On.

eetop公众号 创芯大讲堂 创芯人才网
快速回复 返回顶部 返回列表