verilog 赋值编译器错误
我有一个基本的编译器错误,我无法弄清楚。 代码:
module (input [127:0] in1,
input [2:0] en);
real a1;
if(en==3'b001)
begin
a1=$bitstoreal(in1[31:0]);
end
错误是:
Error: E:/Modeltech_pe_edu_10.0/examples/FloatingPt.v(20): near "=": syntax error, unexpected '=', expecting IDENTIFIER or TYPE_IDENTIFIER or '#' or '('
I have a basic compiler error I am not able to figure out.
Code:
module (input [127:0] in1,
input [2:0] en);
real a1;
if(en==3'b001)
begin
a1=$bitstoreal(in1[31:0]);
end
The error is :
Error: E:/Modeltech_pe_edu_10.0/examples/FloatingPt.v(20): near "=": syntax error, unexpected '=', expecting IDENTIFIER or TYPE_IDENTIFIER or '#' or '('
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您在过程构造之外有过程代码。
You have procedural code outside a procedural construct.
如果您尝试设置
wire
的值或在程序块内设置值(always
或initial
)用于其他数据类型。在您的示例中,您缺少
always
块:如果您不确定自己在做什么,则在将总线分配给
real
类型时也可能会遇到问题。您可能需要将其写为a1 = $itor(in1);
Assignments in Verilog are done by the
assign
statement if you're trying to set the value of awire
or within a procedural block (always
orinitial
) for other data types.In your example, you are missing an
always
block:You also might have a problem assigning a bus to the
real
type if you're not sure of what you're doing. You might need to write it asa1 = $itor(in1);