在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

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

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...