SlideShare a Scribd company logo
Controller
Anees Akhtar
12-ENC-20
Muhammad Nabi Yasinzai
12-ENC-36
Controller Structure
Top Module
• Arithmetic Logic Unit
• Register File
• Program Memory
• Control Unit
Top Module
Program
Memory
Controller
Register File ALU
INST
Opcode
Write Enable
INC
Data A
Address Register A
Address Register B
Output
Data B
Top Module
module Top_Module(Clk,Reset,PRO_COUNT,INSTRUCTION, AD_A, AD_B, AD_D, A_Out , B_Out,ALU_Out,W_E,OP_CODE);
• input Clk , Reset ;
• output [15:0] INSTRUCTION;
• output [3:0] PRO_COUNT;
• output [15:0] A_Out , B_Out ;
• output [2:0] AD_A, AD_B, AD_D;
• output [15:0] ALU_Out;
• output [3:0] OP_CODE;
• output W_E ;
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 ;
DIFFERENT ALU FUNCTIONS OPCODES
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]
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
OUR INSTRUCTIONS SEQUENCE
OPCODE D_Adress A_Adress B_Adress W_Enable OPERATION
1. 00 0010 000 000 001 0 Addition
2. 00 0101 000 100 011 0 Subtraction
3. 00 0001 000 010 000 0 Increment( A )
4. 00 1000 000 111 110 0 Logical AND
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 ;
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
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
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
Controller Implementation in Verilog

More Related Content

What's hot (20)

PPT
Encoder decoder
dennis gookyi
 
PPTX
Introduction to System verilog
Pushpa Yakkala
 
PPTX
Arduino uno lcd display 16x2
Robomart India
 
ODP
Apb
Azad Mishra
 
PPTX
Axi protocol
Rohit Kumar Pathak
 
PDF
VLSI Lab manual PDF
UR11EC098
 
ODP
APB protocol v1.0
Azad Mishra
 
DOCX
VHDL CODES
OmkarDarekar6
 
PPT
8051 microcontroller lecture ppt by Tarun Khaneja ( 9034406598 )
Tarun Khaneja
 
PPTX
Amba axi 29 3_2015
kiemnhatminh
 
PPTX
AXI Protocol.pptx
Yazan Yousef
 
PPT
SPI Bus Protocol
Sudhanshu Janwadkar
 
PDF
SPI Protocol
Anurag Tomar
 
PPTX
Ambha axi
HARINATH REDDY
 
PPTX
Hardware description languages
Akhila Rahul
 
PPTX
Arduino & NodeMcu
Guhan Ganesan
 
ODP
axi protocol
Azad Mishra
 
PPT
Coding style for good synthesis
Vinchipsytm Vlsitraining
 
PDF
Verilog HDL CODES
OmkarDarekar6
 
PDF
Vhdl lab manual
Mukul Mohal
 
Encoder decoder
dennis gookyi
 
Introduction to System verilog
Pushpa Yakkala
 
Arduino uno lcd display 16x2
Robomart India
 
Axi protocol
Rohit Kumar Pathak
 
VLSI Lab manual PDF
UR11EC098
 
APB protocol v1.0
Azad Mishra
 
VHDL CODES
OmkarDarekar6
 
8051 microcontroller lecture ppt by Tarun Khaneja ( 9034406598 )
Tarun Khaneja
 
Amba axi 29 3_2015
kiemnhatminh
 
AXI Protocol.pptx
Yazan Yousef
 
SPI Bus Protocol
Sudhanshu Janwadkar
 
SPI Protocol
Anurag Tomar
 
Ambha axi
HARINATH REDDY
 
Hardware description languages
Akhila Rahul
 
Arduino & NodeMcu
Guhan Ganesan
 
axi protocol
Azad Mishra
 
Coding style for good synthesis
Vinchipsytm Vlsitraining
 
Verilog HDL CODES
OmkarDarekar6
 
Vhdl lab manual
Mukul Mohal
 

Similar to Controller Implementation in Verilog (20)

PPTX
Unit2pptx__2021_12wqeqw_27_08_56_15 (1).pptx
rutvikrathod2324
 
PPTX
material for studentbasic computer organization and design .pptx
jainyshah20
 
PDF
3. Single Cycle Data Path in computer architecture
bsse20142018
 
PPTX
Introduction to Microprocesso programming and interfacing.pptx
vipinkmenon1
 
PPTX
Computer Organization & Architecture (COA) Unit 2
parthivrathodlits
 
PPTX
chapter3_CA.pptt nnnnnnnnnnnnnnnnnnnnnnn
NineTo1
 
PPTX
Unit_2 (4).pptx
AyushiBhatla
 
PPTX
Computer architecture chapter 5 bca.pptx
amulyaverma038
 
PPTX
Basic computer organization design
ndasharath
 
PPT
Lec20 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Da...
Hsien-Hsin Sean Lee, Ph.D.
 
PPT
First seminar
Nishant Srivastav
 
PPTX
Computer instructions
Stacey Bisnar
 
PPT
Register Transfer Language and Micro Operations
KAVITHA N S
 
PDF
Design of microcontroller CPU.pdf
ssuserbefd221
 
PPTX
BASICS OF MIPS ARCHITECTURE AND THEIR INSTRUCTION SET
Saritha Sri
 
PDF
CAAL_CCSU_U1.pdf
salabhmehrotra
 
PPTX
Computer instruction
Sanjeev Patel
 
PPT
COMPUTER ORGANIZATION - Design of control unit final
KAVITHA N S
 
PDF
CO Unit 3.pdf (Important chapter of coa)
guptakrishns23
 
Unit2pptx__2021_12wqeqw_27_08_56_15 (1).pptx
rutvikrathod2324
 
material for studentbasic computer organization and design .pptx
jainyshah20
 
3. Single Cycle Data Path in computer architecture
bsse20142018
 
Introduction to Microprocesso programming and interfacing.pptx
vipinkmenon1
 
Computer Organization & Architecture (COA) Unit 2
parthivrathodlits
 
chapter3_CA.pptt nnnnnnnnnnnnnnnnnnnnnnn
NineTo1
 
Unit_2 (4).pptx
AyushiBhatla
 
Computer architecture chapter 5 bca.pptx
amulyaverma038
 
Basic computer organization design
ndasharath
 
Lec20 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Da...
Hsien-Hsin Sean Lee, Ph.D.
 
First seminar
Nishant Srivastav
 
Computer instructions
Stacey Bisnar
 
Register Transfer Language and Micro Operations
KAVITHA N S
 
Design of microcontroller CPU.pdf
ssuserbefd221
 
BASICS OF MIPS ARCHITECTURE AND THEIR INSTRUCTION SET
Saritha Sri
 
CAAL_CCSU_U1.pdf
salabhmehrotra
 
Computer instruction
Sanjeev Patel
 
COMPUTER ORGANIZATION - Design of control unit final
KAVITHA N S
 
CO Unit 3.pdf (Important chapter of coa)
guptakrishns23
 
Ad

Recently uploaded (20)

PPTX
UNIT 1 - INTRODUCTION TO AI and AI tools and basic concept
gokuld13012005
 
PPTX
OCS353 DATA SCIENCE FUNDAMENTALS- Unit 1 Introduction to Data Science
A R SIVANESH M.E., (Ph.D)
 
PDF
Water Industry Process Automation & Control Monthly July 2025
Water Industry Process Automation & Control
 
PDF
3rd International Conference on Machine Learning and IoT (MLIoT 2025)
ClaraZara1
 
PDF
NTPC PATRATU Summer internship report.pdf
hemant03701
 
PDF
Submit Your Papers-International Journal on Cybernetics & Informatics ( IJCI)
IJCI JOURNAL
 
PDF
Electrical Engineer operation Supervisor
ssaruntatapower143
 
PDF
Data structures notes for unit 2 in computer science.pdf
sshubhamsingh265
 
PPTX
Water Resources Engineering (CVE 728)--Slide 4.pptx
mohammedado3
 
PPTX
原版一样(EC Lille毕业证书)法国里尔中央理工学院毕业证补办
Taqyea
 
PDF
WD2(I)-RFQ-GW-1415_ Shifting and Filling of Sand in the Pond at the WD5 Area_...
ShahadathHossain23
 
PPT
Footbinding.pptmnmkjkjkknmnnjkkkkkkkkkkkkkk
mamadoundiaye42742
 
PPTX
MODULE 03 - CLOUD COMPUTING AND SECURITY.pptx
Alvas Institute of Engineering and technology, Moodabidri
 
PPTX
Introduction to Internal Combustion Engines - Types, Working and Camparison.pptx
UtkarshPatil98
 
PPTX
Biosensors, BioDevices, Biomediccal.pptx
AsimovRiyaz
 
PDF
mbse_An_Introduction_to_Arcadia_20150115.pdf
henriqueltorres1
 
PPTX
MODULE 05 - CLOUD COMPUTING AND SECURITY.pptx
Alvas Institute of Engineering and technology, Moodabidri
 
PDF
Halide Perovskites’ Multifunctional Properties: Coordination Engineering, Coo...
TaameBerhe2
 
PDF
AI TECHNIQUES FOR IDENTIFYING ALTERATIONS IN THE HUMAN GUT MICROBIOME IN MULT...
vidyalalltv1
 
PPTX
仿制LethbridgeOffer加拿大莱斯桥大学毕业证范本,Lethbridge成绩单
Taqyea
 
UNIT 1 - INTRODUCTION TO AI and AI tools and basic concept
gokuld13012005
 
OCS353 DATA SCIENCE FUNDAMENTALS- Unit 1 Introduction to Data Science
A R SIVANESH M.E., (Ph.D)
 
Water Industry Process Automation & Control Monthly July 2025
Water Industry Process Automation & Control
 
3rd International Conference on Machine Learning and IoT (MLIoT 2025)
ClaraZara1
 
NTPC PATRATU Summer internship report.pdf
hemant03701
 
Submit Your Papers-International Journal on Cybernetics & Informatics ( IJCI)
IJCI JOURNAL
 
Electrical Engineer operation Supervisor
ssaruntatapower143
 
Data structures notes for unit 2 in computer science.pdf
sshubhamsingh265
 
Water Resources Engineering (CVE 728)--Slide 4.pptx
mohammedado3
 
原版一样(EC Lille毕业证书)法国里尔中央理工学院毕业证补办
Taqyea
 
WD2(I)-RFQ-GW-1415_ Shifting and Filling of Sand in the Pond at the WD5 Area_...
ShahadathHossain23
 
Footbinding.pptmnmkjkjkknmnnjkkkkkkkkkkkkkk
mamadoundiaye42742
 
MODULE 03 - CLOUD COMPUTING AND SECURITY.pptx
Alvas Institute of Engineering and technology, Moodabidri
 
Introduction to Internal Combustion Engines - Types, Working and Camparison.pptx
UtkarshPatil98
 
Biosensors, BioDevices, Biomediccal.pptx
AsimovRiyaz
 
mbse_An_Introduction_to_Arcadia_20150115.pdf
henriqueltorres1
 
MODULE 05 - CLOUD COMPUTING AND SECURITY.pptx
Alvas Institute of Engineering and technology, Moodabidri
 
Halide Perovskites’ Multifunctional Properties: Coordination Engineering, Coo...
TaameBerhe2
 
AI TECHNIQUES FOR IDENTIFYING ALTERATIONS IN THE HUMAN GUT MICROBIOME IN MULT...
vidyalalltv1
 
仿制LethbridgeOffer加拿大莱斯桥大学毕业证范本,Lethbridge成绩单
Taqyea
 
Ad

Controller Implementation in Verilog

  • 2. Controller Structure Top Module • Arithmetic Logic Unit • Register File • Program Memory • Control Unit
  • 3. Top Module Program Memory Controller Register File ALU INST Opcode Write Enable INC Data A Address Register A Address Register B Output Data B
  • 4. Top Module module Top_Module(Clk,Reset,PRO_COUNT,INSTRUCTION, AD_A, AD_B, AD_D, A_Out , B_Out,ALU_Out,W_E,OP_CODE); • input Clk , Reset ; • output [15:0] INSTRUCTION; • output [3:0] PRO_COUNT; • output [15:0] A_Out , B_Out ; • output [2:0] AD_A, AD_B, AD_D; • output [15:0] ALU_Out; • output [3:0] OP_CODE; • output W_E ;
  • 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
  • 9. OUR INSTRUCTIONS SEQUENCE OPCODE D_Adress A_Adress B_Adress W_Enable OPERATION 1. 00 0010 000 000 001 0 Addition 2. 00 0101 000 100 011 0 Subtraction 3. 00 0001 000 010 000 0 Increment( A ) 4. 00 1000 000 111 110 0 Logical AND
  • 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