在Verilog中调用模块
我刚开始用Verilog学习硬件编程,我感到很失落,因为我不明白错误的含义。 在这里,我调用模块在Verilog中调用模块,verilog,hardware,vivado,Verilog,Hardware,Vivado,我刚开始用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
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
如果你主要从事软件工作,你需要熟悉以“硬件”的方式思考。基本上,你调用模块的方式与调用IC的方式不同。你实例化一个模块,当你焊接一个IC时,你就是在“实例化”它。我明白了-谢谢