5. Arithmetic Logic Unit
OpCode [3:0] INST[13:10]
A[15:0]
ALU_Out
[15:0]
B[15:0]
โข Two 16 Bit Data inputs (Input A , Input B)
โข 4 Bit OpCode(Select lines) To choose A desired Function
โข In Our design we have 8 arithmetic operations
& Four Logical Operations.
โข One 16 bit ALU output.
โข In Our Design the OpCode Holds the [13:10] bits of the instruction.
module AL_Unit (OpCode , A , B , ALU_Out ) ;
input [15 : 0] A , B ;
input [3 : 0] OpCode ;
output [15 : 0] ALU_Out ;
7. Register File
A address
A_A[2:0]
iNST[4:6]
โข Two Read Adresses To Read the Data From two Loctions in the registerfile
โข A_Out and B_Out are the output data selected by their addresses.
โข Write enable(W_E) is used to write Data on the location selected by
Destination Adress(D_A).
module REGISTER_FILE ( Reset , Clk , A_A , A_B , A_Out , B_Out , W_E, D_A , D_Input);
input Reset, Clk;
input [ 2:0] A_A, A_B;
input W_E;
input [ 2:0] D_A;
input [15:0] D_Input;
output [15:0] A_Out,B_Out;
D-addres
A_B[2:0]
iNST[7:9]
Wrie
enable
iNST[0]
B address
A_B[2:0]
iNST[4:6]
8. Program Memory
โข Progarm memory contains the list of the instructions to be
decoded by the Control unit
โข It has a Counter input which increments after each machine cycle
โข The counter locates the address of the instruction to be executed
โข The instruction is the Output form Progarm Memory and is
provided to the control unit
10. Control Unit
โข Contol Unit decodes the instruction From the Program Memory and Provides signals to the Other
components.
Its execution consists of three steps.
1. Fetching
2. Decoding
3. Loading
module CONTROL(Clk,Reset,INST_IN,COUNT_ADD,AD_A,AD_B,AD_D,OP_CODE,W_E);
input [15:0]INST_IN;
input Clk,Reset ;
output W_E;
output [3:0] COUNT_ADD ;
output [3:0] OP_CODE ;
output [2:0] AD_A, AD_B, AD_D ;
11. Clock
Reset
Counter at 0
count
INSTRUCTION
STORED AT 0
OPCODE FOR
ADDITION
Adress of A
000
Adress of B
001
Destination
address
010
Data stored
in register
001
Data stored
in register
000
SUM OF THE
INPUT DATA
12. Clock
Reset
Counter at 1
count
0001
INSTRUCTION
STORED AT
0001
OPCODE FOR
Subtraction
Adress of A
100
Adress of B
011
Destination
address
000
Data stored
in register
100
Data stored
in register
011
Difference
OF THE
INPUT DATA
13. Clock
Reset
Counter at 2
count
0010
INSTRUCTION
STORED AT
0010
OPCODE FOR
Increment
0001
Adress of A
010
Adress of B
000
Destination
address
000
Data stored
in register A
010
Data stored
in register B
000
INREMENTED
RESULT