Пример #1
0
 def write_clock(self, period):
     """ Create the buffered clock signal for setup/hold analysis """
     self.sf.write("* Buffer for the clk signal\n")
     stimuli.add_buffer(stim_file=self.sf,
                        buffer_name="buffer",
                        signal_list=["clk"])
     self.sf.write("\n")
     stimuli.gen_pulse(stim_file=self.sf,
                       sig_name="clk",
                       offset=period,
                       period=period,
                       t_rise=tech.spice["rise_time"],
                       t_fall=tech.spice["fall_time"])
     self.sf.write("\n")
Пример #2
0
    def write_data(self, mode, period, target_time, correct_value):
        """ Create the buffered data signals for setup/hold analysis """
        self.sf.write("* Buffer for the DATA signal\n")
        stimuli.add_buffer(stim_file=self.sf,
                           buffer_name="buffer",
                           signal_list=["DATA"])
        self.sf.write("* Generation of the data and clk signals\n")
        incorrect_value = stimuli.get_inverse_value(correct_value)
        if mode == "HOLD":
            start_value = correct_value
            end_value = incorrect_value
        else:
            start_value = incorrect_value
            end_value = correct_value

        stimuli.gen_pulse(stim_file=self.sf,
                          sig_name="DATA",
                          v1=start_value,
                          v2=end_value,
                          offset=target_time,
                          period=2 * period,
                          t_rise=tech.spice["rise_time"],
                          t_fall=tech.spice["fall_time"])
        self.sf.write("\n")
Пример #3
0
    def write_stimulus(self, period, load, slew):
        """Creates a stimulus file for simulations to probe a certain bitcell, given an address and data-position of the data-word 
        (probe-address form: '111010000' LSB=0, MSB=1)
        (probe_data form: number corresponding to the bit position of data-bus, begins with position 0) 
        """
        self.check_arguments()

        # obtains list of time-points for each rising clk edge
        self.obtain_cycle_times(period)

        # creates and opens stimulus file for writing
        temp_stim = "{0}/stim.sp".format(OPTS.openram_temp)
        self.sf = open(temp_stim, "w")
        self.sf.write(
            "* Stimulus for period of {0}n load={1} slew={2}\n\n".format(
                period, load, slew))

        # include files in stimulus file
        model_list = tech.spice["fet_models"] + [self.sram_sp_file]
        stimuli.write_include(stim_file=self.sf, models=model_list)

        # add vdd/gnd statements

        self.sf.write("* Global Power Supplies\n")
        stimuli.write_supply(self.sf)

        # instantiate the sram
        self.sf.write("* Instantiation of the SRAM\n")
        stimuli.inst_sram(stim_file=self.sf,
                          abits=self.addr_size,
                          dbits=self.word_size,
                          sram_name=self.name)

        self.sf.write("* SRAM output loads\n")
        for i in range(self.word_size):
            self.sf.write("CD{0} D[{0}] 0 {1}f\n".format(i, load))

        # add access transistors for data-bus
        self.sf.write(
            "* Transmission Gates for data-bus and control signals\n")
        stimuli.inst_accesstx(stim_file=self.sf, dbits=self.word_size)

        # generate data and addr signals
        self.sf.write("* Generation of data and address signals\n")
        for i in range(self.word_size):
            if i == self.probe_data:
                stimuli.gen_data(stim_file=self.sf,
                                 clk_times=self.cycle_times,
                                 sig_name="DATA[{0}]".format(i),
                                 period=period,
                                 slew=slew)
            else:
                stimuli.gen_constant(stim_file=self.sf,
                                     sig_name="D[{0}]".format(i),
                                     v_val=self.gnd)

        stimuli.gen_addr(self.sf,
                         clk_times=self.cycle_times,
                         addr=self.probe_address,
                         period=period,
                         slew=slew)

        # generate control signals
        self.sf.write("* Generation of control signals\n")
        stimuli.gen_csb(self.sf, self.cycle_times, period, slew)
        stimuli.gen_web(self.sf, self.cycle_times, period, slew)
        stimuli.gen_oeb(self.sf, self.cycle_times, period, slew)

        self.sf.write("* Generation of global clock signal\n")
        stimuli.gen_pulse(stim_file=self.sf,
                          sig_name="CLK",
                          v1=self.gnd,
                          v2=self.vdd,
                          offset=period,
                          period=period,
                          t_rise=slew,
                          t_fall=slew)

        self.write_measures(period)

        # run until the last cycle time
        stimuli.write_control(self.sf, self.cycle_times[-1])

        self.sf.close()
Пример #4
0
    def write_stimulus(self, period, load, slew):
        """ Creates a stimulus file for simulations to probe a bitcell at a given clock period.
        Address and bit were previously set with set_probe().
        Input slew (in ns) and output capacitive load (in fF) are required for charaterization.
        """
        self.check_arguments()

        # obtains list of time-points for each rising clk edge
        self.obtain_cycle_times(period)

        # creates and opens stimulus file for writing
        temp_stim = "{0}/stim.sp".format(OPTS.openram_temp)
        self.sf = open(temp_stim, "w")
        self.sf.write("* Stimulus for period of {0}n load={1}fF slew={2}ns\n\n".format(period,load,slew))

        # include files in stimulus file
        model_list = tech.spice["fet_models"] + [self.sram_sp_file]
        stimuli.write_include(stim_file=self.sf, models=model_list)

        # add vdd/gnd statements

        self.sf.write("\n* Global Power Supplies\n")
        stimuli.write_supply(self.sf)

        # instantiate the sram
        self.sf.write("\n* Instantiation of the SRAM\n")
        stimuli.inst_sram(stim_file=self.sf,
                          abits=self.addr_size, 
                          dbits=self.word_size, 
                          sram_name=self.name)

        self.sf.write("\n* SRAM output loads\n")
        for i in range(self.word_size):
            self.sf.write("CD{0} d[{0}] 0 {1}f\n".format(i,load))
        
        # add access transistors for data-bus
        self.sf.write("\n* Transmission Gates for data-bus and control signals\n")
        stimuli.inst_accesstx(stim_file=self.sf, dbits=self.word_size)

        # generate data and addr signals
        self.sf.write("\n* Generation of data and address signals\n")
        for i in range(self.word_size):
            if i == self.probe_data:
                self.gen_data(clk_times=self.cycle_times,
                              sig_name="data[{0}]".format(i),
                              period=period,
                              slew=slew)
            else:
                stimuli.gen_constant(stim_file=self.sf,
                                     sig_name="d[{0}]".format(i),
                                     v_val=self.gnd)

        self.gen_addr(clk_times=self.cycle_times,
                         addr=self.probe_address,
                         period=period,
                         slew=slew)

        # generate control signals
        self.sf.write("\n* Generation of control signals\n")
        self.gen_csb(self.cycle_times, period, slew)
        self.gen_web(self.cycle_times, period, slew)
        self.gen_oeb(self.cycle_times, period, slew)

        self.sf.write("\n* Generation of global clock signal\n")
        stimuli.gen_pulse(stim_file=self.sf,
                          sig_name="CLK",
                          v1=self.gnd,
                          v2=self.vdd,
                          offset=period,
                          period=period,
                          t_rise=slew,
                          t_fall=slew)
                          
        self.write_measures(period)

        # run until the end of the cycle time
        stimuli.write_control(self.sf,self.cycle_times[-1] + period)

        self.sf.close()