Friday, 5 June 2015

VHDL not gate code test in circuit and test bench

This video is part of a series which final design is a Controlled Datapath using a structural approach. A Structural approach consist in designing all components needed for the design such as gates to form subsystems and then joining them together to form a larger design like adders and Arithmetic logic units,etc.

The design in these labs was first developed in VHDL you can check the final VHDL version in the link below as well as intructions on how to set up the Waveshare development board to get started, the setup is the same for VHDL and Verilog:

Lab Sheets:
http://viahold.com/y37

Lab guide

http://cogismith.com/1OwP


Intended design:







Datapath and controller internals:

       

Parts working on now:

Constructing the alu:


For constructing the ALU we need an adder, the adder is formed by two half adders and the half adder is formed with gates. Refer to the lab sheets:  


Testbench:

 LIBRARY ieee;  
 USE ieee.std_logic_1164.ALL;  
 ENTITY test_inv IS  
 END test_inv;  
 ARCHITECTURE behavior OF test_inv IS   
   -- Component Declaration for the Unit Under Test (UUT)  
   COMPONENT inverter  
   PORT(  
      a : IN std_logic;  
      f : OUT std_logic  
     );  
   END COMPONENT;  
   --Inputs  
   signal a : std_logic := '0';  
       --Outputs  
   signal f : std_logic;  
 BEGIN  
      -- Instantiate the Unit Under Test (UUT)  
   uut: inverter PORT MAP (  
      a => a,  
      f => f  
     );  
   -- Stimulus process  
   stim_proc: process  
   begin            
    -- hold reset state for 100 ns.  
           wait for 100 ns; -- wait for global reset   
            sig_a <= '0'; -- check 0   
            wait for 100 ns;   
            sig_a <= '1'; -- check 1  
            wait; -- end of test: wait for ever  
   end process;  
 END;  


VHDL code:

 library IEEE;  
 use IEEE.STD_LOGIC_1164.ALL;  
 entity inverter is  
    Port ( a : in STD_LOGIC;  
        f : out STD_LOGIC);  
 end inverter;  
 architecture Behavioral of inverter is  
 begin  
 f<= not a;  
 end Behavioral;  

TUTORIAL ON HOW TO ADD TIMING CONSTRAINTS IN A MODULE

1 comment: