In Simulations, the waveforms which I target must be possible, but I failed to get using both 'wait' and 'after' and even with combo of these two too. So maybe I am missing some key points. Synthesis can be achieved by a different approach, but first thing is Simulations and get the required behaviorWhat are you trying to achieve? If you are targeting to synthesizable HDL, timed wait statements must replaced by clocked timers. 10 ns resolution (100 MHz clock) should be no problem with recent FPGA or CPLD.
Shows that this is a testbench use case!wait until rising_edge(clk);
This is program code, not the testbench. I was using after previously as you mentioned but second after nullifies first one for each of if else above. Wait actually is doing something at least, but output is not right one. I think its not possible to simulate it in this way in VHDL, at least by using the transport, after and wait given in language itself.Shows that this is a testbench use case!
You can use "wait" statements to wait for a specific amount of time.
To delay a signal before assigning it to some other signal at the testbench, you can use transport dealy modeling (e.g. sig2 <= sig1 after 7 ns).
But since it seems you are writing a test bench for some sequential logic (cpu, etc...). So I would highly advise you to write a testbench containing process statements which has the clock in the sensitivity list. You will have a lot of control and clear understanding of what is being done. I do not support the way you have written the TB to simulate your DUT.
Additionally - the advice given in the post above!
Then just put this in the garbage bin (yes I am being this straightforward) and write fresh RTL code in which you have process blocks with sensitivity lists.This is program code, not the testbench
This approach for logic design is also completely wrong!Synthesis can be achieved by a different approach, but first thing is Simulations and get the required behavior
With your suggestion the waveform came closer to what the expected waveform is, but still not exactly there. I have attached a photo of that. You suggested if, I used while too with other lines exactly as you mentioned, but that didn't work too according to expectation.You need need the execution to happen only once during the frame. Declare checker and try this:
if (int >= 0 and int <= 500) then -- alu/j
checker <= '0'
load_logic <= '0';
store_logic <= '0';
branch_logic <= '0';
If checker = '0' then
wait for 20 ns; alu_logic <= '1';
wait for 20 ns; alu_logic <= '0'; checker <= '1';
end if;
Add checker to all cases in this way.
Here you're just using checker to get it to happen just once. If this doesn't solve it, then we will modify it to get it to work.
Its the same, I just added those lines of you with signal checker..Intiially there is extra cycle added as you see in waveform. It is taking an extra cycle instead of just one, to make Alu_logic a 1. You cant simulate it at your end?Let's see your latest code then, and we can take a further look at it.
You yourself dont know VHDL, thats why you suggested use of after statement. After statement gives inertial delay, but you think its transport delay. I have already told you after statement doesn't work for this program. You are just wasting time of both of us. Why dont you learn VHDL first, before telling me to learn it??Then just put this in the garbage bin (yes I am being this straightforward) and write fresh RTL code in which you have process blocks with sensitivity lists.
You must write synthesizable RTL code and there are rules to write synthesizable RTL code.
--- Updated ---
This approach for logic design is also completely wrong!
You must FIRST write RTL code which is synthesizable and then write code for test bench, which will generate peripheral signals to verify your synthesizable code using behavorial simulation.
Nevertheless follow a good tutorial for RTL design and learn the basics first!
That was because when I saw statements like "wait until rising_edge(clk);" in your post, I thought you were writing testbench code. So I wanted to tell you about various delays that can be used in VHDL testbench code. But at Post #6 you told me that it was synthesizable code!You yourself dont know VHDL, thats why you suggested use of after statement. After statement gives inertial delay, but you think its transport delay. I have already told you after statement doesn't work for this program. You are just wasting time of both of us. Why dont you learn VHDL first, before telling me to learn it??
Dont waste my time anymore, my focus is towards my code and algorithms which can be implemented on it, not towards people like youlol....you newbies are so modest!
Sorry that I tried to help you. I am out of this thread.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?