VHDL testbench

Guest #2005657
Rate this post
useful
not useful
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.
Guest #2005708
Rate this post
useful
not useful
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?
Guest #2246480
Rate this post
useful
not useful
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
Guest #2246544
Rate this post
useful
not useful
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
Guest #2246802
Rate this post
useful
not useful
@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

Reply

Please log in before posting.

or

Log in with Google account

Registration is free and takes only a minute.

Register now