繁体   English   中英

在 Verilog 中调用模块

[英]Calling a Module in Verilog

我刚开始使用 Verilog 学习硬件编程,我感到迷茫,因为我无法理解错误是什么意思。 在这里,我调用模块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
    );

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

因为您想“选择”并使模块reg32if分支中“工作”。

对手机 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

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM