Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Introduction:
A central processing unit (CPU) is the physical component within a computer that is responsible of executing
the instructions of a computer program. A computer would have at least one CPU which is usually divided
into a control unit, buses, temporary storages, and an ALU. Control Units fetch the signals/instructions,
while the bus is used to provide an access to the data, and the ALU to perform actual arithmetic and logical
operations. Finally a temporary storage unit such as register files or latches is used to provide an easy access
to data within the CPU.
In this laboratory students will develop and test a processor with all the previously specified components.
Equipments Required:
ALU: has two 8-bits inputs for the operands (user provided), one 8-bits input selector that
selects the operation to be performed, and one 8-bits output for the result. The operation
of the ALU is clocked. Table1 illustrates the functionality of this circuit (Hint: Refer to
Experiment 1).
Control Unit: consists of a synchronous up-counter synchronized with the clock and used
in conjunction with a decoder to generate a different bit pattern for each of the ALU
functions. For example, when the counter value equals 1, the first bit of the decoder (bit(0))
should be active which in turn drives the add function of the ALU, whereas when the
counter equals 2 the second bit of the decoder should be active to drive the second
function of the ALU and so on. Table 1 illustrates this.
Storage Units: two strobed latches will be used to provide a temporary storage for the
input values for 8-bit A and B.
Counter
Decoder Operation
value
1 00000001 AND
2 00000010 OR
3 00000100 XOR
4 00001000 NOR
5 00010000 NOT
6 00100000 ADD
7 01000000 SUB
8 10000000 NEG
Procedure:
1. Write the VHDL code for the above circuit.
Hint: Use Components to write the code for individual elements of the circuits then connect them all
in a single design.
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
--use UNISIM.VComponents.all;
entity Fdesign is
strobe_a : in std_logic;
strobe_b : in std_logic;
clk,rst : in std_logic);
end Fdesign;
component Storage_Unit is
strobe : in STD_LOGIC;
end component;
component ALU is
clk : in STD_LOGIC;
end component;
component Decoder is
clk : in STD_LOGIC;
end component;
signal q0,q1,q2 : std_logic_vector (7 downto 0);
begin
end Behavioral;
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
--library UNISIM;
--use UNISIM.VComponents.all;
entity ALU is
clk : in STD_LOGIC;
end ALU;
begin
process (clk)
begin
end if;
end if;
end process;
end Behavioral;
===============================================
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
--library UNISIM;
--use UNISIM.VComponents.all;
entity Decoder is
clk : in STD_LOGIC;
end Decoder;
begin
q(0) <= ((not counter(2)) and (not counter(1)) and (not counter(0)));
else
end if;
end if;
end process;
end Behavioral;
==========================
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
--library UNISIM;
--use UNISIM.VComponents.all;
entity Storage_Unit is
strobe : in STD_LOGIC;
end Storage_Unit;
begin
process (strobe,input)
begin
if(strobe='1') then
q<=input;
end if;
end process;
end Behavioral;
2. Show the RTL schematic for your circuit for each component and for the whole circuit (up to
2 levels).
Conclusion:
Finally at this experiment we design and construct a simple Processor (CPU) using VHDL and test its
functionality. The CPU is the primary component of a computer that processes instructions. It runs
the operating system and applications .The computer would have at least one CPU which is usually
divided into a control unit, buses, temporary storages, and an ALU. our design of CPU is with Control
Unit that consists of a synchronous up-counter , Storage Units which is two strobed latches and ALU.