微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

在Verilog中调用模块

如何解决在Verilog中调用模块

我刚刚开始使用Verilog学习硬件编程,但由于无法理解错误的含义而感到迷lost。 在这里,我正在调用模块reg31

module nbit_register(input clk,input [31:0]in,input reset,input L,input load,input shift,output reg[31:0] out);
always@(*)begin
if(load==1) 

  reg32 add(clk,in,reset,L,out);
  
   else
        out={ in[30:0],1'b0};
   end
    
   endmodule

但是,我收到此错误

错误:“ reg32”附近的语法错误

这是模块的样子

module reg32(
    input clk,input [31:0] in,input rst,input  L,output  [31:0] out
    );

有人可以在这里指出错误吗?

解决方法

因为您要在reg32分支中“选择”并使模块if“工作”。

成像手机PCB板。即使处于静音模式,扬声器单元也在那里。因此,分别实例化reg32,然后使用自己的逻辑处理连接到reg32的网络。

wire [31:0] add_out;
reg32 add(clk,in,reset,L,add_out); // here the 4 inputs are connected to top inputs
                                      // directly. but if you want,you can use 'load'
                                      // to control them similar to the code below.

always@(*)begin
  if(load==1)
    out = add_out;
  else
    out = { in[30:0],1'b0};
  end

如果您主要从事软件工作,则需要熟悉以“硬件”方式进行思考。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。