小程序求教

2019-03-25 09:53发布

module count4(clk,reset,out);
  input clk,reset;
  output [3:0]out;
  reg [3:0]out;
  wire clk,reset;
  always @(posedge clk)
  begin
         if(reset)  out<=4'b0000;
         else out<=out+4'b0001;
  end
endmodule //'include "count4.v"; module count4_tp;
  reg clk,reset;
  wire out;
  parameter DELY=200;
  initial #DELY clk=0;
  initial #DELY reset=0;
  count4 mycount(.clk(clk),.reset(reset),.out(out));
  always #DELY clk=~clk;
endmodule 为什么out没有输出啊??? 还有就是 为什么'include 这个不能用?用的时候有这样的错误提示:* Error: E:/Wordspace/work/count4/count4_tp.v(1): near "'i": Illegal base specifier in numeric constant.
** Error: E:/Wordspace/work/count4/count4_tp.v(1): near "'i": syntax error, unexpected "BASE", expecting "class"
求高手指教!!!
  此帖出自小平头技术问答
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
该问题目前已经被作者或者管理员关闭, 无法添加新回复
18条回答
leomeng
1楼-- · 2019-03-26 10:51
'timescale 这个仿真的时候也提示错误;我看有很多代码中都有这个东西;不知道是怎么回事,很多资料上夜没有详细的介绍,到底怎么设置。
leomeng
2楼-- · 2019-03-26 14:29
 精彩回答 2  元偷偷看……
leomeng
3楼-- · 2019-03-26 20:23
module count(reset,clk,out);
  input clk,reset;
  output out;
  reg [3:0] out;
  initial out=4'b0000;
  always @(posedge clk)
  begin
         if (reset) out<=4'b0000;
         else out<=out+4'b0001;
end
endmodule
‘timescale 1ns/1ns
‘define DEL 50
‘include "./count.v"
module count_tb;
  reg clk,reset;
  wire [3:0] out;
  parameter DELY=100;
  always #DELY clk=~clk;
  initial #'DEL reset=1'b0;
  initial #'DEL clk=1'b0;
  count count_tb(.reset(reset),.clk(clk),.out(out));
endmodule
不知道问什么 ’timescale,‘include,’idefine,这些命令在modelsim中不能用总是显示错误?
eeleader
4楼-- · 2019-03-26 21:39

谢谢,想选FPGA做以后的发展方向。还请前辈给点意见和建议;前辈多多指教!

 

1. 研究透彻模拟电路和数字电路!

2. 结合电路知识学好FPGA语法!

3. 研究FPGA语法可综合型,到达看电路,知道语法表达;看语法表达,知道电路形式。

4. 结合具体的应用学习FPGA!

eeleader
5楼-- · 2019-03-27 03:38
关于timescale,include,idefine这些高级语言定义,你需要仔细阅读教材,才能领会!
leomeng
6楼-- · 2019-03-27 04:55
谢谢!!

一周热门 更多>