Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Verilog simulation question

Status
Not open for further replies.

ammar_kurd

Junior Member level 3
Joined
Aug 7, 2015
Messages
31
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Location
Yemen
Activity points
281
Say I have number of modules (mod0(x,y), mod1(x,y), mod2(x,y), ...) can I instantiate those modules in the test-bench by using a for loop?


Code Verilog - [expand]
1
2
3
4
for (i = 0; i < n; i = i+1; )
//    here instantiate modules by somehow constructing the module name (mod+i) and an instance of
//    the module.
end



I that possible?
 

Modules can be instantiated in a generate loop, but not in a sequential block, e.g. for loop. Review Verilog language reference manual.

The generate loop syntax is different from the above shown code.
 
OK I got you, but I have not one module that I want to instantiate but a number of modules, at iteration one I want to instantiate mod1 at two mod2, ...

How can I construct the module name "adding 1,2,..." at the end inside the loop? some sort of concatenation.
 

You can't manipulate identifiers in Verilog code. There's are very restricted options to achieve it with text macros. If n isn't a very large number, you'll succeed faster by instantiating the different modules explicitly.
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top