mirror of https://github.com/VLSIDA/OpenRAM.git
Add functional comment to aid debugging checks.
This commit is contained in:
parent
e681806f0d
commit
c7f99aef2c
|
|
@ -227,18 +227,18 @@ class functional(simulation):
|
|||
def add_read_check(self, word, port):
|
||||
""" Add to the check array to ensure a read works. """
|
||||
try:
|
||||
self.check
|
||||
self.check_count
|
||||
except:
|
||||
self.check = 0
|
||||
self.read_check.append([word, "{0}{1}".format(self.dout_name, port), self.t_current + self.period, self.check])
|
||||
self.check += 1
|
||||
self.check_count = 0
|
||||
self.read_check.append([word, "{0}{1}".format(self.dout_name, port), self.t_current + self.period, self.check_count])
|
||||
self.check_count += 1
|
||||
|
||||
def read_stim_results(self):
|
||||
# Extract dout values from spice timing.lis
|
||||
for (word, dout_port, eo_period, check) in self.read_check:
|
||||
for (word, dout_port, eo_period, check_count) in self.read_check:
|
||||
sp_read_value = ""
|
||||
for bit in range(self.word_size + self.num_spare_cols):
|
||||
value = parse_spice_list("timing", "v{0}.{1}ck{2}".format(dout_port.lower(), bit, check))
|
||||
value = parse_spice_list("timing", "v{0}.{1}ck{2}".format(dout_port.lower(), bit, check_count))
|
||||
try:
|
||||
value = float(value)
|
||||
if value > self.v_high:
|
||||
|
|
@ -260,7 +260,7 @@ class functional(simulation):
|
|||
|
||||
return (0, error)
|
||||
|
||||
self.read_results.append([sp_read_value, dout_port, eo_period, check])
|
||||
self.read_results.append([sp_read_value, dout_port, eo_period, check_count])
|
||||
return (1, "SUCCESS")
|
||||
|
||||
def check_stim_results(self):
|
||||
|
|
@ -432,12 +432,21 @@ class functional(simulation):
|
|||
# Generate dout value measurements
|
||||
self.sf.write("\n * Generation of dout measurements\n")
|
||||
for (word, dout_port, eo_period, check) in self.read_check:
|
||||
t_intital = eo_period - 0.01 * self.period
|
||||
t_initial = eo_period - 0.01 * self.period
|
||||
t_final = eo_period + 0.01 * self.period
|
||||
for bit in range(self.word_size + self.num_spare_cols):
|
||||
self.stim.gen_meas_value(meas_name="V{0}_{1}ck{2}".format(dout_port, bit, check),
|
||||
dout="{0}_{1}".format(dout_port, bit),
|
||||
t_intital=t_intital,
|
||||
num_bits = self.word_size + self.num_spare_cols
|
||||
for bit in range(num_bits):
|
||||
measure_name = "V{0}_{1}ck{2}".format(dout_port, bit, check)
|
||||
signal_name = "{0}_{1}".format(dout_port, bit)
|
||||
voltage_value = self.stim.get_voltage(word[num_bits - bit - 1])
|
||||
|
||||
self.stim.add_comment("* CHECK {0} {1} = {2} time = {3}".format(signal_name,
|
||||
measure_name,
|
||||
voltage_value,
|
||||
eo_period))
|
||||
self.stim.gen_meas_value(meas_name=measure_name,
|
||||
dout=signal_name,
|
||||
t_initial=t_initial,
|
||||
t_final=t_final)
|
||||
|
||||
self.stim.write_control(self.cycle_times[-1] + self.period)
|
||||
|
|
|
|||
|
|
@ -82,7 +82,13 @@ class setup_hold():
|
|||
|
||||
"""
|
||||
self.sf.write("\n* Generation of the data and clk signals\n")
|
||||
incorrect_value = self.stim.get_inverse_value(correct_value)
|
||||
if correct_value == 1:
|
||||
incorrect_value = 0
|
||||
elif correct_value == 0:
|
||||
incorrect_value = 1
|
||||
else:
|
||||
debug.error("Invalid value {}".format(correct_value))
|
||||
|
||||
if mode=="HOLD":
|
||||
init_value = incorrect_value
|
||||
start_value = correct_value
|
||||
|
|
|
|||
|
|
@ -169,22 +169,14 @@ class stimuli():
|
|||
def gen_constant(self, sig_name, v_val):
|
||||
""" Generates a constant signal with reference voltage and the voltage value """
|
||||
self.sf.write("V{0} {0} 0 DC {1}\n".format(sig_name, v_val))
|
||||
|
||||
def get_inverse_voltage(self, value):
|
||||
if value > 0.5 * self.voltage:
|
||||
|
||||
def get_voltage(self, value):
|
||||
if value == "0" or value == 0:
|
||||
return 0
|
||||
elif value <= 0.5 * self.voltage:
|
||||
elif value == "1" or value == 1:
|
||||
return self.voltage
|
||||
else:
|
||||
debug.error("Invalid value to get an inverse of: {0}".format(value))
|
||||
|
||||
def get_inverse_value(self, value):
|
||||
if value > 0.5:
|
||||
return 0
|
||||
elif value <= 0.5:
|
||||
return 1
|
||||
else:
|
||||
debug.error("Invalid value to get an inverse of: {0}".format(value))
|
||||
debug.error("Invalid value to get a voltage of: {0}".format(value))
|
||||
|
||||
def gen_meas_delay(self, meas_name, trig_name, targ_name, trig_val, targ_val, trig_dir, targ_dir, trig_td, targ_td):
|
||||
""" Creates the .meas statement for the measurement of delay """
|
||||
|
|
@ -228,8 +220,8 @@ class stimuli():
|
|||
t_initial,
|
||||
t_final))
|
||||
|
||||
def gen_meas_value(self, meas_name, dout, t_intital, t_final):
|
||||
measure_string=".meas tran {0} AVG v({1}) FROM={2}n TO={3}n\n\n".format(meas_name, dout, t_intital, t_final)
|
||||
def gen_meas_value(self, meas_name, dout, t_initial, t_final):
|
||||
measure_string=".meas tran {0} AVG v({1}) FROM={2}n TO={3}n\n\n".format(meas_name, dout, t_initial, t_final)
|
||||
self.sf.write(measure_string)
|
||||
|
||||
def write_control(self, end_time, runlvl=4):
|
||||
|
|
@ -310,6 +302,9 @@ class stimuli():
|
|||
for item in list(includes):
|
||||
self.sf.write(".include \"{0}\"\n".format(item))
|
||||
|
||||
def add_comment(self, msg):
|
||||
self.sf.write(msg + "\n")
|
||||
|
||||
def write_supply(self):
|
||||
""" Writes supply voltage statements """
|
||||
gnd_node_name = "0"
|
||||
|
|
|
|||
Loading…
Reference in New Issue