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.

Selector in Verilog to choose a flavor of design

Status
Not open for further replies.

chainastole

Newbie
Joined
Jun 17, 2020
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
15
I have two blocks in design, which functionality is almost similar (about 5% difference) and working together. It is quite obvious it need to be a single RTL file with selectors, activating each instance in the appropriate mode - "this is block A", "this is block B". What should be preferred - defines (`ifdef IS_BLOCK_A) or parameters (if(instance==BLOCK_A))? All relevant considerations are welcome.
 

Use parameters. If you want to have two instances with different flavours in a single top level you will have problems using defines.
 

Use parameters. If you want to have two instances with different flavours in a single top level you will have problems using defines.

We are engineers. We argument. What type of problems do you expect?
 

We are engineers. We argument. What type of problems do you expect?
Defines are evaluated during compilation. When the RTL file containing the module is compiled (read) the define IS_BLOCK_A will have a value which will determine the result of the `ifdef IS_BLOCK_A statement. Since a module is only compiled once it is not possible to have two instances of a module that sees different define values.

Parameters values, on the other hand, are calculated during elaboration. Then the parameter value for every instance of the module is calculated, and it is possible to have multiple instances of the same module with different parameter values.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top