def write_measures(self, mode, correct_value): """ Measure statements for setup/hold with right phases. """ if correct_value == 1: dout_rise_or_fall = "RISE" else: dout_rise_or_fall = "FALL" # in SETUP mode, the input mirrors what the output should be if mode == "SETUP": din_rise_or_fall = dout_rise_or_fall else: # in HOLD mode, however, the input should be opposite of the output if correct_value == 1: din_rise_or_fall = "FALL" else: din_rise_or_fall = "RISE" self.sf.write("\n* Measure statements for pass/fail verification\n") trig_name = "clk" targ_name = "dout" trig_val = targ_val = 0.5 * self.vdd # Start triggers right before the clock edge at 2*period stimuli.gen_meas_delay(stim_file=self.sf, meas_name="clk2q_delay", trig_name=trig_name, targ_name=targ_name, trig_val=trig_val, targ_val=targ_val, trig_dir="RISE", targ_dir=dout_rise_or_fall, trig_td=1.9*self.period, targ_td=1.9*self.period) targ_name = "data" # Start triggers right after initialize value is returned to normal # at one period stimuli.gen_meas_delay(stim_file=self.sf, meas_name="setup_hold_time", trig_name=trig_name, targ_name=targ_name, trig_val=trig_val, targ_val=targ_val, trig_dir="RISE", targ_dir=din_rise_or_fall, trig_td=1.2*self.period, targ_td=1.2*self.period)
def write_measures(self, data_value): # meas statement for delay and power measurements self.sf.write("* Measure statements for delay and power\n") # add measure statments for delay trig_name = tech.spice["clk"] + "_buf_buf" targ_name = "{0}".format("DATA[{0}]".format(self.probe_data)) trig_val = targ_val = 0.5 * tech.spice["supply_voltage"] trig_dir = self.read_cycle targ_dir = "RISE" if data_value == tech.spice[ "supply_voltage"] else "FALL" td = self.cycle_times[self.clear_bus_cycle] stimuli.gen_meas_delay(stim_file=self.sf, meas_name="DELAY", trig_name=trig_name, targ_name=targ_name, trig_val=trig_val, targ_val=targ_val, trig_dir=trig_dir, targ_dir=targ_dir, td=td) # add measure statements for power t_initial = self.cycle_times[self.write_cycle] t_final = self.cycle_times[self.write_cycle + 1] stimuli.gen_meas_power(stim_file=self.sf, meas_name="POWER_WRITE", t_initial=t_initial, t_final=t_final) t_initial = self.cycle_times[self.read_cycle] t_final = self.cycle_times[self.read_cycle + 1] stimuli.gen_meas_power(stim_file=self.sf, meas_name="POWER_READ", t_initial=t_initial, t_final=t_final) self.sf.write("\n")
def write_measures(self, period): # meas statement for delay and power measurements self.sf.write("* Measure statements for delay and power\n") trig_name = "clk" targ_name = "{0}".format("D[{0}]".format(self.probe_data)) trig_val = targ_val = 0.5 * self.vdd # add measure statments for delay0 # delay the target to measure after the negetive edge stimuli.gen_meas_delay(stim_file=self.sf, meas_name="DELAY0", trig_name=trig_name, targ_name=targ_name, trig_val=trig_val, targ_val=targ_val, trig_dir="FALL", targ_dir="FALL", td=self.cycle_times[self.read0_cycle] + 0.5 * period) stimuli.gen_meas_delay(stim_file=self.sf, meas_name="DELAY1", trig_name=trig_name, targ_name=targ_name, trig_val=trig_val, targ_val=targ_val, trig_dir="FALL", targ_dir="RISE", td=self.cycle_times[self.read1_cycle] + 0.5 * period) stimuli.gen_meas_delay(stim_file=self.sf, meas_name="SLEW0", trig_name=targ_name, targ_name=targ_name, trig_val=0.9 * self.vdd, targ_val=0.1 * self.vdd, trig_dir="FALL", targ_dir="FALL", td=self.cycle_times[self.read0_cycle] + 0.5 * period) stimuli.gen_meas_delay(stim_file=self.sf, meas_name="SLEW1", trig_name=targ_name, targ_name=targ_name, trig_val=0.1 * self.vdd, targ_val=0.9 * self.vdd, trig_dir="RISE", targ_dir="RISE", td=self.cycle_times[self.read1_cycle] + 0.5 * period) # add measure statements for power t_initial = self.cycle_times[self.write0_cycle] t_final = self.cycle_times[self.write0_cycle + 1] stimuli.gen_meas_power(stim_file=self.sf, meas_name="WRITE0_POWER", t_initial=t_initial, t_final=t_final) t_initial = self.cycle_times[self.write1_cycle] t_final = self.cycle_times[self.write1_cycle + 1] stimuli.gen_meas_power(stim_file=self.sf, meas_name="WRITE1_POWER", t_initial=t_initial, t_final=t_final) t_initial = self.cycle_times[self.read0_cycle] t_final = self.cycle_times[self.read0_cycle + 1] stimuli.gen_meas_power(stim_file=self.sf, meas_name="READ0_POWER", t_initial=t_initial, t_final=t_final) t_initial = self.cycle_times[self.read1_cycle] t_final = self.cycle_times[self.read1_cycle + 1] stimuli.gen_meas_power(stim_file=self.sf, meas_name="READ1_POWER", t_initial=t_initial, t_final=t_final)
def write_measures(self,period): """ Write the measure statements to quantify the delay and power results. """ self.sf.write("\n* Measure statements for delay and power\n") # Output some comments to aid where cycles start and # what is happening for comment in self.cycle_comments: self.sf.write("* {}\n".format(comment)) # Trigger on the clk of the appropriate cycle trig_name = "clk" targ_name = "{0}".format("d[{0}]".format(self.probe_data)) trig_val = targ_val = 0.5 * self.vdd # Delay the target to measure after the negative edge stimuli.gen_meas_delay(stim_file=self.sf, meas_name="DELAY0", trig_name=trig_name, targ_name=targ_name, trig_val=trig_val, targ_val=targ_val, trig_dir="FALL", targ_dir="FALL", trig_td=self.cycle_times[self.read0_cycle], targ_td=self.cycle_times[self.read0_cycle]+0.5*period) stimuli.gen_meas_delay(stim_file=self.sf, meas_name="DELAY1", trig_name=trig_name, targ_name=targ_name, trig_val=trig_val, targ_val=targ_val, trig_dir="FALL", targ_dir="RISE", trig_td=self.cycle_times[self.read1_cycle], targ_td=self.cycle_times[self.read1_cycle]+0.5*period) stimuli.gen_meas_delay(stim_file=self.sf, meas_name="SLEW0", trig_name=targ_name, targ_name=targ_name, trig_val=0.9*self.vdd, targ_val=0.1*self.vdd, trig_dir="FALL", targ_dir="FALL", trig_td=self.cycle_times[self.read0_cycle], targ_td=self.cycle_times[self.read0_cycle]+0.5*period) stimuli.gen_meas_delay(stim_file=self.sf, meas_name="SLEW1", trig_name=targ_name, targ_name=targ_name, trig_val=0.1*self.vdd, targ_val=0.9*self.vdd, trig_dir="RISE", targ_dir="RISE", trig_td=self.cycle_times[self.read1_cycle], targ_td=self.cycle_times[self.read1_cycle]+0.5*period) # add measure statements for power t_initial = self.cycle_times[self.write0_cycle] t_final = self.cycle_times[self.write0_cycle+1] stimuli.gen_meas_power(stim_file=self.sf, meas_name="WRITE0_POWER", t_initial=t_initial, t_final=t_final) t_initial = self.cycle_times[self.write1_cycle] t_final = self.cycle_times[self.write1_cycle+1] stimuli.gen_meas_power(stim_file=self.sf, meas_name="WRITE1_POWER", t_initial=t_initial, t_final=t_final) t_initial = self.cycle_times[self.read0_cycle] t_final = self.cycle_times[self.read0_cycle+1] stimuli.gen_meas_power(stim_file=self.sf, meas_name="READ0_POWER", t_initial=t_initial, t_final=t_final) t_initial = self.cycle_times[self.read1_cycle] t_final = self.cycle_times[self.read1_cycle+1] stimuli.gen_meas_power(stim_file=self.sf, meas_name="READ1_POWER", t_initial=t_initial, t_final=t_final)