打印
[verilog]

语法错误A begin/end block was found with an empty body.

[复制链接]
4572|2
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
eko|  楼主 | 2014-11-3 20:02 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
AN, ck, ge, ni, npu
本帖最后由 eko 于 2014-11-3 20:10 编辑

就是一个很普通的4位计数器,不知道是什么错误,脑浆都要爆出来了
经常会出现这个错误提示:
A begin/end block was found with an empty body.


module counter_4(Q, clk, clr);

input clk, clr;
output Q;
reg [3:0] Q;

always @(posedge clk)
begin
  if(clr)
    Q <= 4'b0;
  else
    Q <= Q + 1;
end

endmodule


`define FALSE 1'b0;
`define TRUE 1'b1;

module counter_4_tb;

wire [3:0] count;
reg CLOCK, CLEAR;

counter_4 counter(count, CLOCK, CLEAR);

initial
  $monitor($time, "count = %b", count);

// set CLOCK
initial
begin
  CLOCK = `TRUE;
  forever #5 CLOCK = ~CLOCK;
end

// set CLEAR
initial
begin
  CLEAR = `TRUE;
  repeat (5) @(negedge CLOCK);
  CLEAR = `FALSE;
end

endmodule

** Error: G:/Program Files (x86)/modeltech64_10.1c/examples/counter_4_tb.v(17): A begin/end block was found with an empty body.  This is permitted in SystemVerilog, but not permitted in Verilog.  Please look for any stray semicolons.
** Error: G:/Program Files (x86)/modeltech64_10.1c/examples/counter_4_tb.v(24): A begin/end block was found with an empty body.  This is permitted in SystemVerilog, but not permitted in Verilog.  Please look for any stray semicolons.
** Error: G:/Program Files (x86)/modeltech64_10.1c/examples/counter_4_tb.v(26): A begin/end block was found with an empty body.  This is permitted in SystemVerilog, but not permitted in Verilog.  Please look for any stray semicolons.

相关帖子

沙发
eko|  楼主 | 2014-11-3 20:19 | 只看该作者
高手帮个忙!!感谢!

使用特权

评论回复
板凳
littbi| | 2017-12-17 11:28 | 只看该作者
always @(posedge clk)
begin
  if(clr)
    Q <= 4'b0;
  else
    Q <= Q + 1;
end
把这里的begin end 删除试试

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

eko

1

主题

2

帖子

0

粉丝