Reputation: 826
What I want to do:
I want to pass the current date and time to a VHDL testbench so I can create nicer report file names.
The Problem:
The Top level VHDL file that is being called from my simulation TCL scripts is a configuration and I don't know how to pass the genericto it. The interesing part of the TCL script is the following:
set reportfilename "report_$testcase_id"
append reportfilename [clock format [clock seconds] -format _%Y-%m-%d_%H:%M]
vsim -t 10fs -gG_TC_REPORTFILE=$reportfilename -novopt work.CFG_TB_TOP_tc0027 - wlf result_$testcase_id.wlf
The resulting VSIM call looks like this:
# vsim -t 10fs -wlf result_tc0027.wlf -novopt -gG_TC_REPORTFILE=report_tc0027_2014-03-05_13:22 work.CFG_TB_TOP_tc0027
The problem is that G_TC_REPORTFILE is not a generic of CFG_TB_TOP_tc0027.vhd, but of one of the modules configured IN CFG_TB_TOP_tc0027.vhd
The relevant part of CFG_TB_TOP_tc0027.vhd:
configuration CFG_TB_TOP_tc0027 of TB_TOP_CFG is
for testcaseexecution
for TB_TOP_E_INST : TB_TOP_E
-------------------------------------------------------------
-- Testbench configuration
-------------------------------------------------------------
use entity work.TB_TOP_E(TB_TOP_sim)
generic map (
G_TC_STIMULUSFILE => "./testcases/tc0027.txt", --
G_TC_REPORTFILE => "./results/report_tc0027.txt",
G_TB_VNR => "V_03.10",
G_TC_NR => 27); --
for TB_TOP_A_sim
How would I pass the value from the TCL file to the generic G_TC_REPORTFILE of the TB_TOP_E entity? Can I somehow add a generic to the CFG file, or can I somehow specify for which entity the generic in the TCL file is meant? Best-case-scenario would be if I would not have to edit the vhdl files, only the TCL scripts.
The simulator is ModelSim SE 10.0b, I'm using VHDL 2008.
Upvotes: 0
Views: 1055
Reputation: 826
I have just found the answer myself:
You can indeed specify a path to the generic you want to overwrite. I changed the TCL file like this:
set reportfilename "./results/report_$testcase_id"
append reportfilename [clock format [clock seconds] -format _%Y-%m-%d_%H-%M.txt]
vsim -t 10fs -GTB_TOP_CFG/TB_TOP_E_INST/G_TC_REPORTFILE=$reportfilename -novopt work.CFG_TB_TOP_tc0027 -wlf result_$testcase_id.wlf
Which produces the following VSIM call:
# vsim -t 10fs -wlf result_tc0027.wlf -novopt -GTB_TOP_CFG/TB_TOP_E_INST/G_TC_REPORTFILE=./results/report_tc0027_2014-03-05_14-06.txt work.CFG_TB_TOP_tc0027
In addition to adding the path TB_TOP_CFG/TP_TOP_E_INST/
I also had to remove the :
from the timestamp, as modelsim/vhdl did not handle it.
Upvotes: 2