Question

In: Electrical Engineering

Create a 4-bit Register This is very similar to your flip-flop design from lab task 1....

  1. Create a 4-bit Register
    1. This is very similar to your flip-flop design from lab task 1. Ensure that your 4-bit register has inputs “D” (dat, “CLK” (the clock), and “RST” (an asynchronous reset), and an output “Q”.
    1. [3 pts] Create a test bench and ensure that your 4-bit register operates correctly (test your reset signal and ensure that you can store a couple different values in the register). If your output behavior is correct, then copy your VHDL design code and simulation screenshot below:
    1. Place your 4-bit register’s VHDL design module code here (copy-paste as text, not an image):
    1. Place a screenshot of your simulation here (enlarge your waveform and do not crop the image (it should show the whole screen) or you will lose points):
    1. Explain why your circuit is (or is not) working correctly:

Solutions

Expert Solution

-- VHDL CODE

-- Code your design here
library IEEE;
use IEEE.std_logic_1164.all;

entity register_4bit is
port ( CLK: in std_logic;
D : in std_logic ;
RST : in std_logic;
Q : out std_logic
);
end register_4bit;


architecture structural of register_4bit is

--d flipflop componenet declartion

component dff is
port ( CLK: in std_logic;
D : in std_logic;
RST : in std_logic;
Q : out std_logic );
end component;

signal Q_reg : std_logic_vector(3 downto 0) ;

begin

--instantiate D fliplfops
U1: dff port map ( CLK,D,RST,Q_reg(3));
U2: dff port map ( CLK,Q_reg(3),RST,Q_reg(2));
U3: dff port map ( CLK,Q_reg(2),RST,Q_reg(1));
U4: dff port map ( CLK,Q_reg(1),RST,Q_reg(0));

Q<= Q_reg(0);


end structural;

-- d flilfop verilog code
library IEEE;
use IEEE.std_logic_1164.all;
entity dff is
port ( CLK: in std_logic;
D : in std_logic;
RST : in std_logic;
Q : out std_logic );
end dff;

architecture rtl of dff is

begin
process(CLK,RST)
begin
if (RST) then
Q<='0';
elsif (rising_edge(CLK)) then
Q<=D;
end if;
end process;
end rtl;

-- Code your testbench here
library IEEE;
use IEEE.std_logic_1164.all;

entity test is
end test;

architecture behavioral of test is

component register_4bit is
port ( CLK: in std_logic;
D : in std_logic ;
RST : in std_logic;
Q : out std_logic
);
end component;

signal CLK,D,RST: std_logic;
signal Q : std_logic;

begin
--innstantiate DUT
DUT: register_4bit port map ( CLK => CLK , D => D , RST => RST , Q => Q );

--clocl generation
process
begin
CLK <= '0';
wait for 10 ns;
CLK <= '1';
wait for 10 ns;
end process;

--input stimulus
process
begin
RST <= '1'; D <= '0';
wait for 10 ns;
RST <= '0'; D <= '1';
wait for 10 ns;
RST <= '0'; D <= '0';
wait for 10 ns;
RST <= '0'; D <= '1';
wait for 10 ns;
RST <= '0'; D <= '1';
wait for 10 ns;
RST <= '0'; D <= '0';
wait for 10 ns;
RST <= '0'; D <= '1';
wait;
end process;

end behavioral;

-- simulated waveform

Explanation


Related Solutions

Create a VHDL code of a 4 bit Counter using D flip flop and a Frequency...
Create a VHDL code of a 4 bit Counter using D flip flop and a Frequency Divider that provides the clock signal input for counter
A T flip-flop is a 1-bit synchronous storage component alternative to the D flip-flop, with a...
A T flip-flop is a 1-bit synchronous storage component alternative to the D flip-flop, with a slightly different interface. The T flip-flop has one input t to synchronously control the state of the flip-flop, as follows: When t is 0, the flip-flop does not change its state value. When t is 1, the flip-flop inverts its current state value (0 becomes 1, and 1 becomes 0). Write a Verilog module for the T flip-flop using a behavioral model. The flip-flop...
Design a 5-bit binary counter using JK flip flops. Draw the flip-flop circuit diagram, the state...
Design a 5-bit binary counter using JK flip flops. Draw the flip-flop circuit diagram, the state graph, the timing diagram, the truth table (with clk pulse) and the state table (with present and next states).
Create a 4 bit register and explain how it works
Create a 4 bit register and explain how it works
Design a 4-bit bidirectional serial-in-serial-out shift register using S-R flip flops that trigger on the negative–edge...
Design a 4-bit bidirectional serial-in-serial-out shift register using S-R flip flops that trigger on the negative–edge transition. EXPLAIN its operation if binary input 0101 is applied to the register which initially holds binary data 1101. DRAW the timing-diagram for serial-in operation in right-shift mode only.
Explain in detail the differences between 4-Bit Synchronous and Asynchronous Counters. Each Flip-Flop is negative-edge triggered....
Explain in detail the differences between 4-Bit Synchronous and Asynchronous Counters. Each Flip-Flop is negative-edge triggered. Use the relevant block diagrams, Truth Table of state sequence, and Timing Diagram to support your explanation.
Explain in detail the differences between 4-Bit Synchronous and Asynchronous Counters. Each Flip-Flop is negative-edge triggered....
Explain in detail the differences between 4-Bit Synchronous and Asynchronous Counters. Each Flip-Flop is negative-edge triggered. Use the relevant block diagrams, Truth Table of state sequence, and Timing Diagram to support your explanation.
(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.
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...
(a) Design a 4-bit ring counter. Use an external asynchronous INIT input to initialize the flip-flops...
(a) Design a 4-bit ring counter. Use an external asynchronous INIT input to initialize the flip-flops to a valid initial state. Also remember to hook up the CLOCK to all flip-flops. (b) Design a 4-bit Johnson counter. Use an external asynchronous INIT input to initialize the flip-flops to a valid initial state. Also remember to hook up the CLOCK to all flip-flops. (c) How many states does the ring counter in part (a) have? How many states does the Johnson...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT