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
Joined
Apr 17, 2011
Messages
565
Helped
24
Reputation
48
Reaction score
23
Trophy points
1,298
Activity points
7,369
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?
 

rahdirs

Advanced Member level 1
Joined
May 22, 2013
Messages
424
Helped
93
Reputation
192
Reaction score
91
Trophy points
1,308
Location
Mordor
Activity points
4,496
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 ?
 

matrixofdynamism

Advanced Member level 2
Joined
Apr 17, 2011
Messages
565
Helped
24
Reputation
48
Reaction score
23
Trophy points
1,298
Activity points
7,369
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 := ???'?
 

TrickyDicky

Advanced Member level 5
Joined
Jun 7, 2010
Messages
7,065
Helped
2,077
Reputation
4,171
Reaction score
2,030
Trophy points
1,393
Activity points
39,120
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.
 

ads-ee

Super Moderator
Staff member
Joined
Sep 10, 2013
Messages
7,820
Helped
1,811
Reputation
3,632
Reaction score
1,772
Trophy points
1,393
Location
USA
Activity points
59,033
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.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top