- #1
kbaumen
- 192
- 0
[SOLVED] Sequential logic simulation
I have built a circuit (using the SystemVue software package) that has a 5 bit adder (adds two 2s-complement five-bit numbers - A4A3A2A1A0 and B4B3B2B1B0) with overflow detection and saturation circuits. I am trying to clock the data in so I can check if it works with all possible combinations of the two input numbers. Hence I have 10 JK flipflops cascaded at the input as a frequency divider (all Js and Ks tied to 1, Q fed into clock of the next flipflop). Therefore I get all possible combinations of A's against every possible combination of B's for the input carry being both 0 and 1.
All of that seems more or less fine to me. What is causing me problems is simulating this circuit. I am feeding a pulse train into the first flipflop with a frequency of 1024 Hz and a pulse width of 50e-6 s. I then set the simulation to run with 1024 samples with a sampling frequency of 4096 Hz. The estimated time is determined (by the system) to be 0.4 s. It actually takes about 4 minutes to do the simulation. And if I set up a probe at the pulse train source, it gives a straight line, no sign of a pulse train. I think what I am having trouble with has to be something to do with the sampling rates and simulation. I don't understand it that well and have introductory DSP only next semester.
Does anyone have any idea why the output of the pulse train is staying constant and what I might be doing wrong?
EDIT: Hmm, choosing a sampling frequency at least 4 times the number of samples (say 256 samples, then at least 1024 Hz sampling frequency) made it work. I don't know why, but it works now.
I have built a circuit (using the SystemVue software package) that has a 5 bit adder (adds two 2s-complement five-bit numbers - A4A3A2A1A0 and B4B3B2B1B0) with overflow detection and saturation circuits. I am trying to clock the data in so I can check if it works with all possible combinations of the two input numbers. Hence I have 10 JK flipflops cascaded at the input as a frequency divider (all Js and Ks tied to 1, Q fed into clock of the next flipflop). Therefore I get all possible combinations of A's against every possible combination of B's for the input carry being both 0 and 1.
All of that seems more or less fine to me. What is causing me problems is simulating this circuit. I am feeding a pulse train into the first flipflop with a frequency of 1024 Hz and a pulse width of 50e-6 s. I then set the simulation to run with 1024 samples with a sampling frequency of 4096 Hz. The estimated time is determined (by the system) to be 0.4 s. It actually takes about 4 minutes to do the simulation. And if I set up a probe at the pulse train source, it gives a straight line, no sign of a pulse train. I think what I am having trouble with has to be something to do with the sampling rates and simulation. I don't understand it that well and have introductory DSP only next semester.
Does anyone have any idea why the output of the pulse train is staying constant and what I might be doing wrong?
EDIT: Hmm, choosing a sampling frequency at least 4 times the number of samples (say 256 samples, then at least 1024 Hz sampling frequency) made it work. I don't know why, but it works now.
Last edited: