Hello experts, I am stuck in doing a VHDL testbench. My VHDL code works just fine, but the problem now is that I cannot make the right testbench. * the first problem is the clock, I made two seperated processes, one for clock and the other one for setting different valuse for the input. The clock process does not work !! the simulation does not show any change in the clock signal. * Same problem for reset, I put the reset signal in the second process, and it doesn't work propely. * regarding setting the values, for the input I used for loop as follows for j in 0 to 7 loop X(i) <= '1' ; wait for 10 ns; end loop; and this also doesn't work properly. any help is truley appreciated.
1 | for j in 0 to 7 loop |
2 | X(i) <= '1' ; --- should this be a X(j) or am I missing some code? |
3 | wait for 10 ns; |
4 | end loop; |
> any help is truley appreciated. Pls show your code... > The clock process does not work !! the simulation does not show any > change in the clock signal. Do you simulate the testbench or your VHDL-Module?
can any1 suggest good book that teaches vhdl testbench from basic. if possible then share the link of the same.
Okay I can't help you with a book I only know german vhdl books but this link seems to be good: http://www.seas.upenn.edu/~ese171/vhdl/vhdl_primer.html And for your problem with the clock an reset signal. When I write a Testbench I do it like this:
1 | ARCHITECTURE DUT_tb_BEHAV OF DUT_tb IS |
2 | |
3 | CONSTANT PERIOD : TIME := 500ns; -- initiate the time value for the system clock |
4 | |
5 | BEGIN
|
6 | |
7 | -- Creating the system clock cycles
|
8 | PROCESS
|
9 | BEGIN
|
10 | clock <= '0'; WAIT FOR PERIOD/2; |
11 | clock <= '1'; WAIT FOR PERIOD/2; |
12 | END PROCESS; |
13 | |
14 | -- Creating the asynchronous clear signal
|
15 | PROCESS
|
16 | BEGIN
|
17 | resetn <= '0'; WAIT FOR PERIOD*2; |
18 | resetn <= '1'; WAIT; |
19 | END PROCESS; |
20 | |
21 | END ARCHITECTURE; |
Greetings Phil
I use the following one-liners for signal generation:
1 | constant tb_clk_period : time := (1 sec / 50_000_000); |
2 | |
3 | signal tb_CLK : std_logic := '0'; |
4 | signal tb_RESET : std_logic; |
5 | |
6 | [...] |
7 | |
8 | tb_CLK <= not tb_CLK after tb_clk_period / 2; |
9 | tb_RESET <= '1', '0' after 10 * tb_clk_period; |
Duke
Hi QTX, "tb_CLK <= not tb_CLK after tb_clk_period / 2;" will not generate a periodic clock, it'll generate a rising edge after tb_clk_period / 2. Use a Process instead and it'll work.
@wollibk: > "tb_CLK <= not tb_CLK after tb_clk_period / 2;" will not generate a > periodic clock, it'll generate a rising edge after tb_clk_period / 2. Check at your simulator first, before post nonsense... Duke
i need to produce a signal with rising edge alone of 1 micro second in test bench, please help.
Pls. do not attach your question to any old thread. Instead start a new thread with your question... And then show what you have, and ask a specific question concerning your problem. This forum here is not for stupidly solving homework...
Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
Log in with Google account
No account? Register here.