Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| waveforms_-_rom_logic [2016/11/28 10:57] – [3. ROM logic User Interface in WaveForms 2015] Mircea Dabacan | waveforms_-_rom_logic [2022/10/04 11:38] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 13: | Line 13: | ||
| For the ROM logic, a Boolean function Truth Table is stored in the Pattern Memory. An n-bit input bus (from DIO pins) builds the address for the Pattern Memory. | For the ROM logic, a Boolean function Truth Table is stored in the Pattern Memory. An n-bit input bus (from DIO pins) builds the address for the Pattern Memory. | ||
| - | Since the size of the Pattern Memory is limited to 2n locations, the input buffer IB is only present for the first n DIO pins (0 to n-1). However, any DIO pin can implement a Boolean function of DIO pins 0 to n-1. | + | Since the size of the Pattern Memory is limited to 2< |
| For Analog Discovery, Analog Discovery 2 and Electronics Explorer default configurations, | For Analog Discovery, Analog Discovery 2 and Electronics Explorer default configurations, | ||
| Line 49: | Line 49: | ||
| // | // | ||
| - | ===== 3. ROM logic User Interface in WaveForms | + | ===== 3. ROM logic User Interface in WaveForms ===== |
| In the Pattern Generator, click the green “plus” sign and select ROM logic, as shown below. | In the Pattern Generator, click the green “plus” sign and select ROM logic, as shown below. | ||
| Line 66: | Line 66: | ||
| * If a signal is used in both input and output panes, it is a State Variable; the input pane shows its value in the Current State and the output pane indicates its value in the Next State. | * If a signal is used in both input and output panes, it is a State Variable; the input pane shows its value in the Current State and the output pane indicates its value in the Next State. | ||
| * Use 0, 1 or X (don’t care) in the input pane. | * Use 0, 1 or X (don’t care) in the input pane. | ||
| - | * An expanded Truth Table (no X input values) with n input signals has 2n lines. A line including k X values is the collapsed version of 2k lines of the expanded Truth Table. | + | * An expanded Truth Table (no X input values) with n input signals has 2< |
| - | * Make sure that all possible input cases are covered, i.e. the logical reunion of all input lines is 2n. | + | * Make sure that all possible input cases are covered, i.e. the logical reunion of all input lines is 2< |
| * Use 1, 0, “SignalName” or “/ | * Use 1, 0, “SignalName” or “/ | ||
| * The table lines are “sequential”, | * The table lines are “sequential”, | ||
| Line 76: | Line 76: | ||
| ===== 4. Example: Three input, synchronous AND gate. ===== | ===== 4. Example: Three input, synchronous AND gate. ===== | ||
| - | In Figure | + | In Figure |
| - | In the Truth Table tab, the first line describes the default case, with the output signal value of 0. With three X-es in the input pane, this line is equivalent to 23=8 expanded lines. However, the second line overrides one line out of the eight, forcing the output signal to 1 when all inputs are 1. | + | |
| + | In the Truth Table tab, the first line describes the default case, with the output signal value of 0. With three X-es in the input pane, this line is equivalent to 2< | ||
| The equivalent VHDL code is: | The equivalent VHDL code is: | ||
| Line 103: | Line 104: | ||
| To observe the dynamic behavior of the synchronized 3-input AND gate, define a binary counter on DIO2…DIO0 in the Pattern Generator. Set the clock frequency to 3MHz. (However, the closest frequency WaveForms can generate is 2.941MHz.) This frequency is chosen not to be integer multiple or submultiple of the ROM logic frequency (5MHz). Also define a 5MHz clock on DIO4 (same as for the ROM logic). This clock is not used by the ROM logic, but will serve as reference for observation in the Logic Analyzer. | To observe the dynamic behavior of the synchronized 3-input AND gate, define a binary counter on DIO2…DIO0 in the Pattern Generator. Set the clock frequency to 3MHz. (However, the closest frequency WaveForms can generate is 2.941MHz.) This frequency is chosen not to be integer multiple or submultiple of the ROM logic frequency (5MHz). Also define a 5MHz clock on DIO4 (same as for the ROM logic). This clock is not used by the ROM logic, but will serve as reference for observation in the Logic Analyzer. | ||
| + | |||
| Open a Logic Analyzer. Add/Bus with DIO2…DIO0, | Open a Logic Analyzer. Add/Bus with DIO2…DIO0, | ||
| + | |||
| Run a Single step in the Logic analyzer. Observe that DIO3 (the AND gate output) does not synchronize with the edges of Bus1 inputs, but with DIO4: DIO4 is not the actual ROM Logic clock, but it has the same frequency and phase, so it can be used as an image of the actual ROM Logic clock. Since the ROM Logic is synchronized to the completion of each clock period, and DIO4 starts with a 0 and continues with a 1, the DIO3 seems to be synchronized on the falling edge of DIO4. | Run a Single step in the Logic analyzer. Observe that DIO3 (the AND gate output) does not synchronize with the edges of Bus1 inputs, but with DIO4: DIO4 is not the actual ROM Logic clock, but it has the same frequency and phase, so it can be used as an image of the actual ROM Logic clock. Since the ROM Logic is synchronized to the completion of each clock period, and DIO4 starts with a 0 and continues with a 1, the DIO3 seems to be synchronized on the falling edge of DIO4. | ||
| Line 113: | Line 116: | ||
| ===== 5. Example: Binary counter with Count Enable input. ===== | ===== 5. Example: Binary counter with Count Enable input. ===== | ||
| - | In the figure below, DIO8 is renamed CE and is used as Count Enable. DIO7…DIO0 are renamed c7…c0 and are the state/ | + | In the figure below, DIO8 is renamed CE and is used as Count Enable. DIO7…DIO0 are renamed c7…c0 and are the state/ |
| - | Line 1 in the Truth Table (equivalent to 28=256 expanded lines) means: when LSB c0=’0’: all bits c7…c1 keep value; c0 changes to ‘1’ only if CE=’1’. All other lines cover the cases when c0=’1’. | + | |
| - | Line 2 (equivalent to 27=128 expanded lines): means when c1=’0’ and c0=’1’: both will swap if CE=’1’ or keep their value if CE=’0’; all other bits keep their value. | + | Line 1 in the Truth Table (equivalent to 2< |
| - | All nine lines are equivalent to 29=512 expanded lines and define all possible cases (8 bit+1 Count Enable). | + | |
| + | Line 2 (equivalent to 2< | ||
| + | |||
| + | All nine lines are equivalent to 2< | ||
| To verify the behavior, add a clock signal on DIO8 (Frequency=1kHz, | To verify the behavior, add a clock signal on DIO8 (Frequency=1kHz, | ||
| + | |||
| In the Logic Analyzer, Add/Bus DIO7…DIO0 and Add/Signal DIO8. Run Pattern Generator and Single step Logic Analyzer. Observe the behavior of the binary counter. | In the Logic Analyzer, Add/Bus DIO7…DIO0 and Add/Signal DIO8. Run Pattern Generator and Single step Logic Analyzer. Observe the behavior of the binary counter. | ||
| Line 150: | Line 158: | ||
| // | // | ||
| - | A 5-bit counter is implemented in a ROM logic object, as below, on DIO9…DIO5, | + | A 5-bit counter is implemented in a ROM logic object, as below, on DIO9…DIO5, |
| {{: | {{: | ||
| Line 156: | Line 164: | ||
| // | // | ||
| - | A second ROM logic (sheet PWM in RomLogicTrouthTables.xls) compares DIO9…DIO5 = c4…c0 = “5BitCounter” with DIO4…DIO0 = s4…s0 = ”Sample”. DIO10 = CY = ”CarryOut” is High when “Sample” is higher. Notice again how higher order bits (later lines in the Truth Table) override the lower order bits (earlier lines in the Truth Table). | + | A second ROM logic (sheet PWM in {{: |
| {{: | {{: | ||
| Line 162: | Line 170: | ||
| // | // | ||
| - | An external RC Low Pass Filter (100kΩ, 1nF) is used to build the analog signal, removing the carrier from the PWM signal. The WaveForms scope shows the PWM signal (C1) and the filtered signal (C 2). | + | An external RC Low Pass Filter (100kΩ, 1nF) is used to build the analog signal, removing the carrier from the PWM signal. The WaveForms scope shows the PWM signal (C1) and the filtered signal (C2). |
| {{: | {{: | ||
| Line 179: | Line 187: | ||
| // | // | ||
| - | Variable n-bit sample can be used as a modulator signal. For the second experiment, set a custom 5-bit Bus 1 in the Pattern Generator, to drive a sinus signal with 100 samples per period. Generate a .csv file, with 100 values of form (sheet SinusSamples in RomLogicTrouthTables.xls): | + | Variable n-bit sample can be used as a modulator signal. For the second experiment, set a custom 5-bit Bus 1 in the Pattern Generator, to drive a sinus signal with 100 samples per period. Generate a .csv file, with 100 values of form (sheet SinusSamples in {{: |
| $$sample_i=16+int(15*sin((2∙π∙i)/ | $$sample_i=16+int(15*sin((2∙π∙i)/ | ||
| Line 204: | Line 212: | ||
| ===== 7. Example: PDM modulator. ===== | ===== 7. Example: PDM modulator. ===== | ||
| - | In the figure below, an n-bit accumulator is used to add the sample value over and over. The Carry Out bit is the Pulse Density Modulated (PDM) signal. The accumulator is refreshed with fcnt frequency, while samples succeed with fsample | + | In the figure below, an n-bit accumulator is used to add the sample value over and over. The Carry Out bit is the Pulse Density Modulated (PDM) signal. The accumulator is refreshed with f< |
| {{: | {{: | ||
| Line 216: | Line 224: | ||
| // | // | ||
| - | A 5-bit PDM modulator is implemented in the PDM Accumulator ROM logic object, with DIO 9…DIO5 = a4…a0 as “Accumulator”, | + | A 5-bit PDM modulator is implemented in the PDM Accumulator ROM logic object, with DIO 9…DIO5 = a4…a0 as “Accumulator”, |
| {{: | {{: | ||
| Line 226: | Line 234: | ||
| $$(CY, | $$(CY, | ||
| - | To compare with PWM, similar examples are used. The same external RC filter, the clock frequency of the modulator, the sinus sample LUT and sample frequency are all the same as in the corresponding PWM experiments. | + | To compare with PWM, similar examples are used. The same external RC filter, the clock frequency of the modulator, the sinus Sample Memory |
| - | In the static experiment, the same duty factor is generated, with a much higher frequency, resulting in a much smaller ripple of the analog signal. | + | |
| + | In the static experiment, the same duty factor is generated, with a much higher frequency, resulting in a much smaller ripple of the analog signal. | ||
| {{: | {{: | ||
| Line 234: | Line 243: | ||
| In the dynamic experiment, the same sinus custom Bus1 was used, as for the PWM. The average Duty Factor is again around 50%, the frequency is variable and the average frequency is much higher compared to PWM, for the same clock frequency. The ripple of the analog signal is also much smaller. | In the dynamic experiment, the same sinus custom Bus1 was used, as for the PWM. The average Duty Factor is again around 50%, the frequency is variable and the average frequency is much higher compared to PWM, for the same clock frequency. The ripple of the analog signal is also much smaller. | ||
| - | The lowest instantaneous frequency of the PDM signal happens when the sample value is either 1LSB or 2n-1LSB, and is the same as the constant frequency of the PWM signal. For all other values of the samples, the resulting instantaneous frequency is higher, up to half of the clock frequency, when the sample value is at half of the range. | + | |
| + | The lowest instantaneous frequency of the PDM signal happens when the sample value is either 1LSB or 2< | ||
| Having both instances of the Pattern generator open, is very easy to run them alternatively for easy comparison on the scope instrument. Hitting Run on one instance automatically turns the other instance in Busy state. | Having both instances of the Pattern generator open, is very easy to run them alternatively for easy comparison on the scope instrument. Hitting Run on one instance automatically turns the other instance in Busy state. | ||
| Line 242: | Line 253: | ||
| The spectrum analyzer instrument is used to analyze data in the frequency domain. The two traces correspond to the two scope channels in the experiments above. In the spectral view, a cursor is set at fcarrier. Some parameters of the modulated and analog signals are shown in the measurements window. | The spectrum analyzer instrument is used to analyze data in the frequency domain. The two traces correspond to the two scope channels in the experiments above. In the spectral view, a cursor is set at fcarrier. Some parameters of the modulated and analog signals are shown in the measurements window. | ||
| + | |||
| The carrier fundamental and harmonics are significant for PWM, while PDM spread those components more uniformly in the spectrum. | The carrier fundamental and harmonics are significant for PWM, while PDM spread those components more uniformly in the spectrum. | ||
| + | |||
| The measurements have much better values for SFDR, SNR, SINAD and ENOB in the case of PDM. | The measurements have much better values for SFDR, SNR, SINAD and ENOB in the case of PDM. | ||

