Testbench

Sezione dedicata al linguaggio di descrizione hardware per logiche programmabili

Testbench

Postby flz47655 » 04 Apr 2012, 11:14

Ciao a tutti
Quartus purtroppo non supporta la simulazione dei testbench e nonostante sia possibile utilizzare ModelSim volevo sapere se utilizzavate qualche altro strumento. Peccato perchè ho letto che che ISE (l'IDE di Xilinx) supporta questa tipologia di simulazione nativamente.

Ciao e grazie a tutti
flz47655
 
Posts: 639
Joined: 19 Jan 2012, 21:16

Re: Testbench

Postby flz47655 » 05 Apr 2012, 18:11

Sono riuscito a scrivere un testbench per un semplice half-adder ma... che fatica usare model-sim!

E' veramente il software più brutto, meno intuitivo e difficile da usare che ho mai visto. Nonostante questo la versione di Altera è gratuita e permette di fare alcune simulazioni seppur con alcune limitazioni.

Mi ha aiutato molto il video tutorial http://www.youtube.com/watch?v=Ef89wnpaFCw&

Una nota che volevo lasciare per chi stesse tentando nell'impresa di imparare VHDL è che la versione gratuita di Altera supporta solamente 1 solo file hdl, quindi sia il sorgente del componente sia il testbench devono essere nel solito file.

Ecco il testbench che ho scritto:
Code: Select all
ENTITY HalfAdderTB IS
END HalfAdderTB;
ARCHITECTURE HalfAdderTB OF HalfAdderTB IS
   COMPONENT HalfAdder
      PORT (
         x, y : IN STD_LOGIC;
         s : OUT STD_LOGIC;
         c : OUT STD_LOGIC
      ) ;
   END COMPONENT;
   signal x,y,s,c : STD_LOGIC;
   constant period : time := 10ns;
   BEGIN
   -- Instantiate the Unit Under Test (UUT)
   uut: HalfAdder PORT MAP (
         x => x,
         y => y,
         s => s,
         c => c
        );          
   stimulus_proc : PROCESS
   BEGIN
      x <= '0'; y <= '0';
      wait for period;
      x <= '0'; y <= '1';
      wait for period;
      x <= '1'; y <= '0';
      wait for period;
      x <= '1'; y <= '1';
      wait for period;
      wait;
   END PROCESS;   
END HalfAdderTB;


Ciao a tutti
flz47655
 
Posts: 639
Joined: 19 Jan 2012, 21:16


Return to VHDL x FPGA

Who is online

Users browsing this forum: No registered users and 2 guests

cron