The document describes the structure and components of a controller, including:
1. The top module contains an arithmetic logic unit (ALU), register file, program memory, and control unit.
2. The ALU performs arithmetic and logical operations on two 16-bit inputs based on a 4-bit opcode.
3. The register file contains data that can be read from or written to by 3-bit addresses and a write enable signal.
4. The program memory stores instructions that are fetched and decoded by the control unit to provide control signals to other components.
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