Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to do this in the VHDL testbench

Status
Not open for further replies.

pastro

Junior Member level 3
Joined
Aug 20, 2010
Messages
25
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,538
Hello,

I need to write a VHDL testbench for simulating an FPGA circuit. In the testbench, I want to make an 8 bit waveform (called TB_COUNT) start counting up from zero at 120 ns, and increment by 1 count every 40 ns.

In the past, I've written something like what follows, where TB_COUNT is defined:
signal TB_COUNT : std_logic_vector (7 downto 0) := "00000000";

TB_COUNT <= "00000000" after 120 ns,
"00000001" after 160 ns,
etc


However, I need TB_COUNT to increment 1000x's, so this brute force approach is impractical. So, how do I perform this task elegantly?
 

You can use something like

Code:
  process 
    begin
     wait for 120 ns;
     for i in 0 to 1000000 loop  
     -- loop      -- you can also use this without the loop counter
      TB_COUNT <=TB_COUNT+1;
      wait for 40 ns;     
     end loop;
     wait;   
    end process;

Alex
 
Last edited:
  • Like
Reactions: pastro

    pastro

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top