简体   繁体   English

Verilog-在case语句中调用模块

[英]Verilog - Calling a module inside a case statement

我对Verilog不太熟悉,但是在case语句中可以调用另一个模块吗?

You cannot call a module just as you do in C language, since it's not a function, you instantiate it. 您不能像使用C语言那样调用模块,因为它不是函数,所以需要实例化它。 If you want to instantiate a module, you should use generate . 如果要实例化模块,则应使用generate

Edit: An example of using generate with a case statement can be found here . 编辑:在此处可以找到使用带有case语句的generate的示例。

2nd edit: If you just wanted to call a section of code in a case-statement then you can create a task or a function . 第2次修改:如果您只想在案例陈述中调用一段代码,则可以创建一个任务或一个函数 More information here . 更多信息在这里 (credit goes to Hida ) (信用归飞ida

您不能在case语句中调用模块,但是可以创建函数,然后再调用case语句(任务无法合成)

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

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