The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Jul 17th, 2024, 2:35pm
Pages: 1
Send Topic Print
How could I make the Bits as a variable or param in verilogA? (Read 1672 times)
newic
Senior Member
****
Offline



Posts: 138

How could I make the Bits as a variable or param in verilogA?
Apr 23rd, 2011, 5:21am
 
How could I make the Bits as a variable or param?

`include "constants.vams"
`include "disciplines.vams"

`define Bits 8

module adc (out, in, clk);
  ....
  ....
endmodule

Back to top
 
 
View Profile   IP Logged
Geoffrey_Coram
Senior Fellow
******
Offline



Posts: 1999
Massachusetts, USA
Re: How could I make the Bits as a variable or param in verilogA?
Reply #1 - Apr 25th, 2011, 5:59am
 
In principle, you could use a parameter (but NOT a variable); see this example:

http://www.designers-guide.org/VerilogAMS/functional-blocks/data-converter/conve...

module adc (out, in, clk);
   parameter integer bits = 8 from [1:24];      // resolution (bits)
...
   input in, clk;
   output [bits-1:0] out;

However, I'm not aware of any simulator that supports this; they all need the number of terminals of the adc to be known before parameter processing.
Back to top
 
 

If at first you do succeed, STOP, raise your standards, and stop wasting your time.
View Profile WWW   IP Logged
Pages: 1
Send Topic Print
Copyright 2002-2024 Designer’s Guide Consulting, Inc. Designer’s Guide® is a registered trademark of Designer’s Guide Consulting, Inc. All rights reserved. Send comments or questions to editor@designers-guide.org. Consider submitting a paper or model.