还有其他方法可以在Verilog中初始化模块吗?

发布于 2025-02-02 16:24:57 字数 503 浏览 1 评论 0原文

我是Verilog的新手。在我的预定义的处理器设计中,控制模块被定义为:

module control(in,regdest,alusrc,memtoreg,regwrite,memread,memwrite,branch,funct,branch_cont0,branch_cont1,branch_cont2,aluop0,aluop1,aluop2);

但是在处理器模块的后面,它是这样初始化的:

 //Control unit
control cont(instruc[31:26],regdest,alusrc,memtoreg,regwrite,memread,memwrite,branch,
aluop1,aluop0);

前8个评估看起来正确,但是在分支参数之后,还有一些其他参数需要设置。

我的问题是:Verilog中还有其他模块的实现吗?因为此代码正常工作。我可以正确获得信号。(为了我的理解,控制模块初始化时需要15个参数。)

I am new to verilog. In my predefined processor design, control module is defined as:

module control(in,regdest,alusrc,memtoreg,regwrite,memread,memwrite,branch,funct,branch_cont0,branch_cont1,branch_cont2,aluop0,aluop1,aluop2);

but later in the processor module it is initialized like this:

 //Control unit
control cont(instruc[31:26],regdest,alusrc,memtoreg,regwrite,memread,memwrite,branch,
aluop1,aluop0);

First 8 assigments seem correct but after branch parameter, there are some other parameters that need to be set.

My question is : is there any other implementation of modules in verilog? Because this code works correctly. I can get signals correctly.(For my understanding control module needs 15 parameters when it is initialized.)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

风透绣罗衣 2025-02-09 16:24:57

我认为您的意思是实例化一个模块。
有两种实例化模块的方法。通过逐订单(您拥有的)和按名称连接。

//Control unit
control cont( .in(instruc[31:26]), .regdest(regdest),
  .alusrc(alusrc), .memtoreg(memtoreg), .regwrite(regwrite),
  .memread(memread), .memwrite(memwrite),
  .aluop1(aluop1), .aluop0(aluop0),
  .branch(branch)
);

如果启用了SystemVerilog,则端口名称和信号名称与您可以使用.portName(ex:.in(instruc [31:26])),.regdest,.alusrc)。或。*,将推断连接到匹配的端口和信号。

I think you mean instantiate a module.
There are two ways to instantiate a module. By connect-by-order (which you have) and connect-by-name.

//Control unit
control cont( .in(instruc[31:26]), .regdest(regdest),
  .alusrc(alusrc), .memtoreg(memtoreg), .regwrite(regwrite),
  .memread(memread), .memwrite(memwrite),
  .aluop1(aluop1), .aluop0(aluop0),
  .branch(branch)
);

If you have SystemVerilog enabled then and the port name and signal name are the same you can use .portname (ex: .in(instruc[31:26]), .regdest, .alusrc). Or .* which will infer connections to matching ports and signal.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文