Question

In: Electrical Engineering

make 4 bit universal shift register in vhdl plz include the test bench. I will rate

make 4 bit universal shift register in vhdl plz include the test bench. I will rate

Solutions

Expert Solution

4 BIT VHDL CODE

library IEEE;  
 use IEEE.STD_LOGIC_1164.ALL;  
 use IEEE.STD_LOGIC_ARITH.ALL;  
 use IEEE.STD_LOGIC_UNSIGNED.ALL;  
 -- ENTITY  
 entity four_bit_shifter is  
   Port ( Data_In : in std_logic_vector(3 downto 0);  
       G : in std_logic_vector(2 downto 0);  
       Output : out std_logic_vector(3 downto 0));  
 end four_bit_shifter;  
 -- ARCHITECTURE  
 architecture Behavioral of four_bit_shifter is  
 -- COMPONENTS  
 component nBitShiftRotateM   
   generic(n:positive:=4);  
       Port (Data_In1 : in std_logic_vector(n-1 downto 0);  
             Data_In2 : in std_logic_vector(n-1 downto 0);  
             Right_In : in std_logic;  
             Right_Select : in std_logic;  
             Left_In : in std_logic;  
             Left_Select : in std_logic;  
             Control : in std_logic_vector (1 downto 0);  
          Output : out std_logic_vector (n-1 downto 0));  
 end component;  
 component shiftcontrollogic   
   Port ( input : in STD_LOGIC_VECTOR (2 downto 0);  
       output : out STD_LOGIC_VECTOR (1 downto 0));  
 end component;  
 -- SIGNAL  
 signal shift_control : std_logic_vector (1 downto 0);  
 begin  
      logic_device : shiftcontrollogic port map (G, shift_control);  
      -- instantiate an n-bit shift_rotate device with generic value "n"   
      -- mapped to a bit-width of 4. Note that the second data input is   
      -- connected directly to ground by using the 4-bit value "0000".   
      shift_device : nBitShiftRotateM  generic map (4) port map (Data_In, "0000", G(0), G(1), G(0), G(1), shift_control, Output);   
 end Behavioral;  

Test bench code:

LIBRARY ieee;  
 USE ieee.std_logic_1164.ALL;  
 USE ieee.std_logic_unsigned.all;  
 USE ieee.numeric_std.ALL;  
 ENTITY four_bit_shifter_tb_vhd IS  
 END four_bit_shifter_tb_vhd;  
 ARCHITECTURE behavior OF four_bit_shifter_tb_vhd IS   
      -- Component Declaration for the Unit Under Test (UUT)  
      COMPONENT four_bit_shifter  
      PORT(  
           Data_In : IN std_logic_vector(3 downto 0);  
           G : IN std_logic_vector(2 downto 0);       
           Output : OUT std_logic_vector(3 downto 0)  
           );  
      END COMPONENT;  
      --Inputs  
      SIGNAL Data_In : std_logic_vector(3 downto 0) := (others=>'0');  
      SIGNAL G : std_logic_vector(2 downto 0) := (others=>'0');  
      --Outputs  
      SIGNAL Output : std_logic_vector(3 downto 0);  
 BEGIN  
      -- Instantiate the Unit Under Test (UUT)  
      uut: four_bit_shifter PORT MAP(  
           Data_In => Data_In,  
           G => G,  
           Output => Output  
      );  
      tb : PROCESS  
      BEGIN  
           -- Wait 100 ns for global reset to finish  
           wait for 100 ns;  
        G <= "000";            -- test Pass  
           Data_In <= "0101";  
           wait for 100 ns;  
        G <= "001";            -- test rotate left  
           Data_In <= "0101";  
           wait for 100 ns;  
        G <= "010";            -- test shift left (insert 0)  
           Data_In <= "1111";  
           wait for 100 ns;  
        G <= "011";            -- test shift left (insert 1)  
           Data_In <= "0000";  
           wait for 100 ns;  
        G <= "100";            -- test Pass  
           Data_In <= "1010";  
           wait for 100 ns;  
        G <= "101";            -- test rotate right  
           Data_In <= "1010";  
           wait for 100 ns;  
        G <= "110";            -- test shift right (insert 0)  
           Data_In <= "1111";  
           wait for 100 ns;  
        G <= "111";            -- test shift right (insert 1)  
           Data_In <= "0000";  
           wait for 100 ns;  
           -- Place stimulus here  
           wait; -- will wait forever  
      END PROCESS;  
 END;

Related Solutions

Can anyone write a Verilog code and a test bench for a universal shift register with...
Can anyone write a Verilog code and a test bench for a universal shift register with 4 bits using D flip flop? Thanks
Write the VHDL codes for (7494) 4 bit shift register using Behavioral style of modeling. this...
Write the VHDL codes for (7494) 4 bit shift register using Behavioral style of modeling. this is the datasheet for this Quation ( http://www.ralphselectronics.com/productimages/SEMI-SN7494N.PDF )
3-(7494) Design and implementation of 4 bit shift register using VHDL Behavioral style of modeling
3-(7494) Design and implementation of 4 bit shift register using VHDL Behavioral style of modeling
4- a) Draw a 4-Bit Shift Register that shifts from right to left instead of left...
4- a) Draw a 4-Bit Shift Register that shifts from right to left instead of left to right using D-Flip flops. b) Draw the serial transfer from shift register A on the right to the shift register B on the left in block form including the timing diagrammes. c) Draw the serial transfer table in the following form, assuming an initial value of 1101 in the register A and 0110 in the register B. Timing Pulse Shift Register B Shift...
(7494) Design and implementation of 4 bit shift register using Behavioral style of modeling .... by...
(7494) Design and implementation of 4 bit shift register using Behavioral style of modeling .... by VHDL .. the program should based on the data sheet of 7494 and the truth table ... 13 input and one output D.
Can someone create a Test bench for this 4 Bit USR code so that it can...
Can someone create a Test bench for this 4 Bit USR code so that it can shift left, shift right and Load. This is in VHDL. Please type out the code. library IEEE; use IEEE.STD_LOGIC_1164.ALL; entity Uni_reg is port( LR,SP,clk,clear,shL,shR: in std_logic; -- shL = shift left shR= shift right Da,Db,Dc : in std_logic; --inputs for load Qa,Qb,Qc : out std_logic); --out puts from the flipflops end Uni_reg; architecture Structural of Uni_reg is signal lr1,lr2,sp1,sp2,R1,R2,R3 : std_logic; signal L1,L2,L3,LOAD1,LOAD2,LOAD3:std_logic; signal...
Write the Verilog code for a 12-bit shift register with ability to shift left or right,...
Write the Verilog code for a 12-bit shift register with ability to shift left or right, synchronized parallel load, asynchronous reset, and serial output? The register is able to load the 12-bit input value (at the positive edge of the clock) if the load signal is one, shift the value in register one bit to the right (at the positive edge of the clock) if the rss signal is one, shift the value in register one bit to the left(at...
write the report about (7494) Design and implementation of 4 bit shift register using Behavioral style...
write the report about (7494) Design and implementation of 4 bit shift register using Behavioral style of modeling 1-truth table 2. VHDL program cods 3. Conclusion Should reflect on what logic is implemented, what modelling style is used to implement the logic. Discuss simulation and board level testing results.
Create a 4 bit register and explain how it works
Create a 4 bit register and explain how it works
I want VHDL program and testbench program for 4 bit binary full adder with fast carry...
I want VHDL program and testbench program for 4 bit binary full adder with fast carry using behavioral and structural style modling (ls7483)
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT