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
This tutorial uses components to understand the basics of microcontroller design.
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:
VHDL code:
Testbench
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
This tutorial uses components to understand the basics of microcontroller design.
Intended design:
Datapath and controller internals:
Parts working on now:
Constructing the alu:
VHDL code:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity fourinputnorgate is
Port ( a : in STD_LOGIC;
b : in STD_LOGIC;
c : in STD_LOGIC;
d : in STD_LOGIC;
f : out STD_LOGIC);
end fourinputnorgate;
architecture Behavioral of fourinputnorgate is
signal ab,cd,tolastnor1,tolastnor2:std_logic;
begin
a <= a nor b;
tolastnor1 <= ab nor ab;
c<= c nor d;
tolastnor2<= cd nor cd;
f<= tolastnor1 nor tolastnor2;
end Behavioral;
--a b c d f
--0 0 0 0 1
--0 0 0 1 0
--0 0 1 0 0
--0 0 1 1 0
--0 1 0 0 0
--0 1 0 1 0
--0 1 1 0 0
--0 1 1 1 0
--1 0 0 0 0
--1 0 0 1 0
--1 0 1 0 0
--1 0 1 1 0
--1 1 0 0 0
--1 1 0 1 0
--1 1 1 0 0
--1 1 1 1 0
Testbench
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
ENTITY FOURINPUTNORTest IS
END FOURINPUTNORTest;
ARCHITECTURE behavior OF FOURINPUTNORTest IS
-- Component Declaration for the Unit Under Test (UUT)
COMPONENT fourinputnorgate
PORT(
a : IN std_logic;
b : IN std_logic;
c : IN std_logic;
d : IN std_logic;
f : OUT std_logic
);
END COMPONENT;
--Inputs
signal a : std_logic := '0';
signal b : std_logic := '0';
signal c : std_logic := '0';
signal d : std_logic := '0';
--Outputs
signal f : std_logic;
-- No clocks detected in port list. Replace <clock> below with
-- appropriate port name
BEGIN
-- Instantiate the Unit Under Test (UUT)
uut: fourinputnorgate PORT MAP (
a => a,
b => b,
c => c,
d => d,
f => f
);
-- Stimulus process -- test for all possible inputs of four input nor --> 16 combinations
stim_proc: process
begin
wait for 100 ns;
a <= '0';
b <= '0';
c <= '0';
d <= '0';
wait for 100 ns;
a <= '0';
b <= '0';
c <= '0';
d <= '1';
wait for 100 ns;
a <= '0';
b <= '0';
c <= '1';
d <= '0';
wait for 100 ns;
a <= '0';
b <= '0';
c <= '1';
d <= '1';
wait for 100 ns;
a <= '0';
b <= '1';
c <= '0';
d <= '0';
wait for 100 ns;
a <= '0';
b <= '1';
c <= '0';
d <= '1';
wait for 100 ns;
a <= '0';
b <= '1';
c <= '1';
d <= '0';
wait for 100 ns;
a <= '0';
b <= '1';
c <= '1';
d <= '1';
wait for 100 ns;
a <= '1';
b <= '0';
c <= '0';
d <= '0';
wait for 100 ns;
a <= '1';
b <= '0';
c <= '0';
d <= '1';
wait for 100 ns;
a <= '1';
b <= '0';
c <= '1';
d <= '0';
wait for 100 ns;
a <= '1';
b <= '0';
c <= '1';
d <= '1';
wait for 100 ns;
a <= '1';
b <= '1';
c <= '0';
d <= '0';
wait for 100 ns;
a <= '1';
b <= '1';
c <= '0';
d <= '1';
wait for 100 ns;
a <= '1';
b <= '1';
c <= '1';
d <= '0';
wait for 100 ns;
a <= '1';
b <= '1';
c <= '1';
d <= '1';
wait;
end process;
END;
No comments:
Post a Comment