Commit 2141c8c0 authored by Martin Jeřábek's avatar Martin Jeřábek

testfw: implement layout file support for sanity and reference tests

parent 5f6db7da
Pipeline #6710 passed with stage
in 1 minute and 7 seconds
......@@ -57,7 +57,7 @@ add_test_status_waves
# for AHDL simulation. Component path must be added to have correct path
# to internal signals
set WRCOMP $TCOMP
append WRCOMP "/i_st"
append WRCOMP "/t_sanity"
add wave $WRCOMP/error_ctr
add wave $WRCOMP/loop_ctr
......
......@@ -93,7 +93,7 @@ def find(h, fqn):
m = re.match(r'^([^(]+)\(([0-9]+)\)$', name)
if not m:
raise KeyError('{} (from {}) not found in {}'
.format(name, fqn, list(curr.children.keys())),
.format(name, fqn, sorted(curr.children.keys())),
name, fqn, list(curr.children.keys()))
#print(name, m.groups())
name, index = m.groups()
......
......@@ -4,6 +4,7 @@ from typing import List
import logging
import traceback
import functools
import re
from pathlib import Path
from . import ghw_parse
......@@ -47,11 +48,13 @@ class TclFuncs:
def sigtype(self, sig: str):
fqn = sig.replace('/', '.')
fqn = re.sub(r'__([0-9]+)', r'(\1)', fqn)
type = ghw_parse.find(self.hierarchy, fqn)
return type
def convsig(self, sig: str) -> str:
fqn = sig.replace('/', '.')
fqn = re.sub(r'__([0-9]+)', r'(\1)', fqn)
type = ghw_parse.find(self.hierarchy, fqn)
if ghw_parse.is_array(type):
ranges, type = ghw_parse.strip_array(type)
......
global TCOMP
set TCOMP tb_bit_stuffing_unit_test/tb/i_test
# set TCOMP tb/i_test
proc start_CAN_simulation {test_wrapper} {
}
......
......@@ -28,6 +28,16 @@ class ReferenceTests(TestsBase):
default = self.config['default']
self.add_modelsim_gui_file(tb, default, 'sanity')
tcl = self.build / 'modelsim_init_reference.tcl'
with tcl.open('wt', encoding='utf-8') as f:
print(dedent('''\
global TCOMP
set TCOMP i_test
'''), file=f)
init_files = get_common_modelsim_init_files()
init_files += [str(tcl)]
for data_set,cfg in self.config['tests'].items():
dict_merge(cfg, default)
# bm = len_to_matrix(cfg['topology'], cfg['bus_len_v'])
......@@ -44,17 +54,8 @@ class ReferenceTests(TestsBase):
psl_opts = self.create_psl_cov_file_opt(data_set)
tb.add_config(data_set, generics=generics, sim_options=psl_opts)
else:
tb.add_config(data_set, generics=generics)
tcl = self.build / 'modelsim_init_{}.tcl'.format(data_set)
with tcl.open('wt', encoding='utf-8') as f:
print(dedent('''\
global TCOMP
set TCOMP i_test
'''), file=f)
init_files = get_common_modelsim_init_files()
init_files += [str(tcl)]
tb.add_config(data_set, generics=generics)
tb.set_sim_option("modelsim.init_files.after_load", init_files)
self.add_modelsim_gui_file(tb, cfg, data_set)
self.add_modelsim_gui_file(tb, cfg, data_set, init_files)
return True
import logging
from textwrap import dedent
from .test_common import TestsBase, add_sources, dict_merge, vhdl_serialize, \
get_seed
get_seed, get_common_modelsim_init_files
log = logging.getLogger(__name__)
......@@ -54,9 +55,19 @@ class SanityTests(TestsBase):
return {"ghdl.sim_flags" : [psl_flag]}
def configure(self):
# TODO: wave
tb = self.lib.get_test_benches('*tb_sanity')[0]
default = self.config['default']
tcl = self.build / 'modelsim_init_sanity.tcl'
with tcl.open('wt', encoding='utf-8') as f:
print(dedent('''\
global TCOMP
set TCOMP tb_sanity
'''), file=f)
init_files = get_common_modelsim_init_files()
init_files += [str(tcl)]
for name, cfg in self.config['tests'].items():
if 'wave' in cfg:
log.warn('"wave" in sanity test config {} is ignored' +
......@@ -91,5 +102,5 @@ class SanityTests(TestsBase):
else:
tb.add_config(name, generics=generics)
self.add_modelsim_gui_file(tb, default, 'sanity')
self.add_modelsim_gui_file(tb, default, 'sanity', init_files)
return True
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment