verilog编程,在quartus2下编译报错

`timescale1ns/1nsmodulecounter(cnt,clk,data,rst,load);//Becarefulthe';',andthemodulen... `timescale 1ns/1ns
module counter(cnt,clk,data,rst,load);//Becareful the ';',and the module name must the same as source file name.
output [4:0]cnt;
input [4:0]data;
input clk,rst,load;
reg [4:0]cnt;

always@(rst)
begin
if(!rst)
#3 assign cnt=0;
else
deassign cnt;
end

always@(posedge clk)
begin
if(load)
cnt<=#3data;
else
cnt<=#4cnt+1;
end
endmodule

Error (10043): Verilog HDL unsupported feature error at counter.v(11): Procedural Continuous Assignment to register is not supported
过程性连续赋值对寄存器不支持,可是书上却说过程性连续赋值对寄存器和线网都支持,到底是怎么一回事啊?
展开
 我来答
牧羊少年sue
2013-01-27
知道答主
回答量:8
采纳率:100%
帮助的人:3.6万
展开全部
  assign用于连续赋值Continuous Assignment,只能付给net类型,若将assign用在了过程块中(initial,always),则此时是过程连续赋值 Procedural Continuous Assignment,此时,它只支持寄存器。 以下是外国教材:
9.1 Procedural Continuous Assignments
  We studied procedural assignments in , Procedural Assignments. Procedural assignments assign a value to a register. The value stays in the register until another procedural assignment puts another value in that register. Procedural continuous assignments behave differently. They are procedural statements which allow values of expressions to be driven continuously onto registers or nets for limited periods of time. Procedural continuous assignments override existing assignments to a register or net. They provide an useful extension to the regular procedural assignment statement.
9.1.1 assign and deassign
  The keywords assign and deassign are used to express the first type of procedural continuous assignment. The left-hand side of procedural continuous assignments can be only be a register or a concatenation of registers. It cannot be a part or bit select of a net or an array of registers. Procedural continuous assignments override the effect of regular procedural assignments. Procedural continuous assignments are normally used for controlled periods of time.
  A simple example is the negative edge-triggered D-flipflop with asynchronous reset that we modeled in . In , we now model the same D_FF, using assign and deassign statements.
shajiayu
推荐于2017-10-12 · TA获得超过381个赞
知道答主
回答量:58
采纳率:0%
帮助的人:92.2万
展开全部
改成这样就好了
always @(posedge clk or negedge rst)
if(!rst) cnt<=5'd0;
else if(load) cnt<=data;
else cnt<=cnt+5'd1;
学verilog语法看夏宇闻的《Verilog数字系统设计教程(第二版)》。
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
hebmaqian
2011-10-11 · TA获得超过155个赞
知道答主
回答量:77
采纳率:0%
帮助的人:74.6万
展开全部
在过程块中不能用连续赋值语句对reg类型赋值。
你的cnt是reg类型,为什么还要用assign呀。而且是在过程语句中。
assign是用来给wire型赋值的。

http://zhidao.baidu.com/question/323551680.html
你们认识么。一模一样的。。。
更多追问追答
追问
不认识,我是按照书上的代码敲的,这书坑爹了。书上说过程性连续赋值语句,可以给reg型也可以给wire型赋值,这句话错了吗?
追答
不知道是什么书。
连续赋值一般给wire
过程块一般给reg
反正assign肯定是不能在过程块中出现的。看英文书吧,呵呵。
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
匿名用户
2011-10-11
展开全部
0.0
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(2)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式