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.

Passing VHDL generics and constants via a tcl script

Status
Not open for further replies.

matrixofdynamism

Advanced Member level 2
Advanced Member level 2
Joined
Apr 17, 2011
Messages
593
Helped
24
Reputation
48
Reaction score
23
Trophy points
1,298
Visit site
Activity points
7,681
Often tcl scripts are used to setup simulation environment. Is it possible to pass values for variables and constants in VHDL from within a tcl script?
 

Hi,

In an instantiated cell,if your entity has a generic "test_parameter" and your instantiated entity is "test_inst", then you can use Tcl calls to the Vivado to get the value of the generic.

Code:
set generic_val [get_property my_generic [get_cells test_inst]

The above code gets you value,i am not sure how to set constant value from tcl.Why not do it from a text file ?
 
OK, then lets do it this way. Is it possible that I put name of all constants with their values in a text file. Then in tcl script I tell which file to use. How will a value be assigned to each constant by reading from a file? The constants are not an array. They are different constants and have different names.

How to assign value to constant from a text file since constant is declared as 'constant myconstant : std_logic_vector := ???'?
 

It sounds like you're going about this the wrong way.
you should be passing generics down from the top level setup. You're implying you want to override values set up in the code? why?

vsim has a -G switch that allows you to set top level generics.
 

It sounds like you're going about this the wrong way.
you should be passing generics down from the top level setup. You're implying you want to override values set up in the code? why?

vsim has a -G switch that allows you to set top level generics.

Besides what Tricky said, you shouldn't be changing constants in your code, they are CONSTANTS for a reason, i.e. they don't change for any reason. Generics are used if a compile time constant can be different between compilations. This avoids the need to modify code to "change" a constant buried in the code.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top