Question

Lab 7: Design a 4 bit register in VHDL. The register file has a synchronous load...

Lab 7:


Design a 4 bit register in VHDL. The register file has a synchronous load signal and an asynchronous reset. When the reset signal is high the register file should be cleared. The input is stored only when the load and clock signal is high. 


0 0
Add a comment Improve this question Transcribed image text
Answer #1

-- VHDL code for 4 bit register

--library declaration

library IEEE;

use IEEE.std_logic_1164.all;

--entity declaration for 4 bit register

entity register_4bit is

port(

clk : in std_logic; -- clock input

reset: in std_logic ; -- Asynchronous reset input

load: in std_logic ; --synchronous load input

D: in std_logic_vector(3 downto 0); --4 bit data input to register

Q: out std_logic_vector(3 downto 0) -- 4 bit register output

);

end register_4bit;

--architecture body declaration for 4 bit register

architecture behavioral of register_4bit is

begin

process (clk,reset)

begin

--when reset is high, register is cleared

if(reset = '1') then

Q <= "0000";

--if not reset and load is high during postive edge occurance of clock , then data D is loaded into register

elsif (CLK'event and CLK='1') then

if (load = '1') then

Q <= D;

end if;

end if;

end process;

end behavioral;

-- VHDL Testbench code for 4 bit register

library IEEE;

use IEEE.std_logic_1164.all;

--entity declaration for testbench

entity test_reg is

end test_reg;

--architecture declaration for testbench

architecture behavioral of test_reg is

--component instantiation of 4 bit register

component register_4bit is

port(

clk : in std_logic; -- clock input

reset: in std_logic ; -- Asynchronous reset input

load: in std_logic ; --synchronous load input

D: in std_logic_vector(3 downto 0); --4 bit data input to register

Q: out std_logic_vector(3 downto 0) -- 4 bit register output

);

end component ;

--internal signal declarations

signal clk: std_logic;

signal reset: std_logic;

signal load: std_logic;

signal D: std_logic_vector(3 downto 0);

signal Q: std_logic_vector(3 downto 0);

  

begin

  

--port mapping of 4 bit register

DUT: register_4bit port map ( clk => clk,

reset => reset,

load => load,

D => D,

Q => Q );

--clock input generation

clock_proc:process

begin

clk <= '0';

wait for 5 ns;

clk <= '1';

wait for 5 ns;

end process;

--input generation

stim_proc:process

begin

reset <= '1'; load <= '0'; D <= "0000";

wait for 10 ns;

reset <= '0'; load <= '0'; D <= "0010";

wait for 10 ns;

reset <= '0'; load <= '1'; D <= "0110";

wait for 10 ns;

reset <= '0'; load <= '1'; D <= "0010";

wait for 10 ns;

reset <= '0'; load <= '0'; D <= "0100";

wait for 10 ns;

reset <= '1'; load <= '1'; D <= "0010";

wait for 10 ns;

reset <= '0'; load <= '0'; D <= "1111";

wait for 10 ns;

reset <= '0'; load <= '1'; D <= "0100";

wait for 10 ns;

reset <= '1'; load <= '0'; D <= "0010";

wait for 10 ns;

reset <= '0'; load <= '1'; D <= "1111";

wait for 10 ns;

reset <= '0'; load <= '0'; D <= "0010";

wait ;

end process;

end behavioral;

-- simulation waveforms

Add a comment
Know the answer?
Add Answer to:
Lab 7: Design a 4 bit register in VHDL. The register file has a synchronous load...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • in VHDL Show synthesizable VHDL code for a register unit that performs operations shown below. The unit has a 3-bit mod...

    in VHDL Show synthesizable VHDL code for a register unit that performs operations shown below. The unit has a 3-bit mode (md) input, an asynchronous reset (rs) input, a 1-bit output control (oc) input, and an 8-bit bi-directional io bus. The internal register drives the io bus when oc is ‘I, and md is not “11 1". Use std-logic. md-000: does nothing md-001: right shift the register md-010: left shift the register md 011: up count, binary md-100: down count,...

  • Write a HDL code for 1 bit D-register with a rising edge clock, a synchronous active-low reset an...

    WRITE IN SYSTEM VERILOG: Write a HDL code for 1 bit D-register with a rising edge clock, a synchronous active-low reset and an asynchronous active-high enable pin. B2. Write a HDL code for 1 bit D-register with a rising edge clock, a synchronous active-low reset and an asynchronous active-high enable pin. B2.

  • Design in VHDL a 4-bit up-down counter as presented below: The operation of the up-down counter...

    Design in VHDL a 4-bit up-down counter as presented below: The operation of the up-down counter is described by the following truth table: S1 S0 Action 0 0 Hold 0 1 Count up 1 0 Count down 1 1 Parallel Load Provide VHDL code and testbench XЗ Q3 X3X2X1X0 Parallel Load X2 S1SO Function Select Input Q2 RST-Asynchronous Reset Input X1 CLK- Clock Input Q1 хо Q3Q2Q1Q0 - Parallel Output Q0 CLK S1 S0 RST XЗ Q3 X3X2X1X0 Parallel Load...

  • Design a synchronous state machine which detects the serial bit sequence of 0 1 10 on the 1-bit i...

    Design a synchronous state machine which detects the serial bit sequence of 0 1 10 on the 1-bit input signal A (tested one bit at a time) and produces a "Moore-type positive-logic output of Y equal to 1 (and lasting just one clock period) only when that particular bit sequence is observed. At all other times, the output Y should be 0. The final 0 of the desired input sequence 0 110 can persist and become the first 0 of...

  • Use the Quartus Prime Text Editor to implement a structural model of the 4-bit data register show...

    Use the Quartus Prime Text Editor to implement a structural model of the 4-bit data register shown above in a file named reg_4bit.sv. Specify the 4-bit data register’s module according to the interface specification given in the table below. Port Mode Data Type Size Description RST in logic 1-bit Active high asynchronous reset CLK in logic 1-bit Synchronizing clock signal EN in logic 1-bit Synchronous clock enable D in logic vector 4-bits Synchronous data input Q out logic vector 4-bits...

  • I ELE230L Digital Systems Design Laboratory Lab9 - Serial Adder Vaughn College of Aeronautics and...

    I need help putting this serial adder block diagram into multisim software I ELE230L Digital Systems Design Laboratory Lab9 - Serial Adder Vaughn College of Aeronautics and Technology Number of Lab Session (Week): 2 1 Discussion The purpose of this lab is to design, simulate, and implement a 4-bit serial adder SADD. A block diagram is shown below. The SADD has two int bit FA with a carry-hold flip-flop. Its input is a 4-bit data input (D-Do), a rising edge...

  • Lab Description Follow the instructions in the lab tasks below to behaviorially create and simulate a flip-flop. Af...

    Lab Description Follow the instructions in the lab tasks below to behaviorially create and simulate a flip-flop. Afterwards, you will create a register and use your ALU from Lab 3 to create an accumulator-based processor. This will act ike a simple processor; the ALU will execute si operations and each result will be stored in the register. In an accumulator, the value of the register will be updated with each operation; the register is used as an input to the...

  • Consider the circuit in Figure 1. It is a 4-bit (QQ2Q3) synchronous counter which uses four T-typ...

    Consider the circuit in Figure 1. It is a 4-bit (QQ2Q3) synchronous counter which uses four T-type flip-flops. The counter increases its value on each positive edge of the clock if the Enable signal is asserted. The counter is reset to 0 by setting the Clear signal low. You are to implement an 8-bit counter of this type Enable T Q Clock Clear Figure 1. 4-bit synchronous counter (but you need to implement 8-bit counter in this lab) Specific notes:...

  • 1 Simulations to verify a 4-bit Register Simulate and verify a 4-bit Register using behavioral VHDL...

    1 Simulations to verify a 4-bit Register Simulate and verify a 4-bit Register using behavioral VHDL code in ModelSim. Recall that sequential circuits depend on both present and past state. Sequential circuits are in contrast to combinational circuits, which depend on input values from only the present state. Fur- thermore, recall that a flip-flop is a fundamental circuit used to create more complex sequential circuits. A register is an array of storage components, such as flip-flops. For example, a 4-bit...

  • Instructions: For all the questions you are required to submit VHDL codes & test bench simulation...

    Please answer both questions Instructions: For all the questions you are required to submit VHDL codes & test bench simulation screenshot. If anything else is required it is mentioned in the question. Question 1.Design a 16 bit Increment Register with asynchronous reset, and increment capability using the following entity. Also, find out number of registers inferred by your code Entity reg16 is port ( clk, reset, inc load datain in stdalogic. in stdalogic. instdlogic vector (15 downto 0) out td.logicvector...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
Active Questions
ADVERTISEMENT