SlideShare a Scribd company logo
1 of 14
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

VHDL coding in Xilinx
VHDL coding in XilinxVHDL coding in Xilinx
VHDL coding in XilinxNaveen Kumar
ย 
Microcontroller
MicrocontrollerMicrocontroller
Microcontrollerparassini
ย 
Verilog tutorial
Verilog tutorialVerilog tutorial
Verilog tutorialraju reddy
ย 
8 bit single cycle processor
8 bit single cycle processor8 bit single cycle processor
8 bit single cycle processorDhaval Kaneria
ย 
Encoder decoder
Encoder decoderEncoder decoder
Encoder decoderdennis gookyi
ย 
Basics of peripheral devices and Working
Basics of peripheral devices and WorkingBasics of peripheral devices and Working
Basics of peripheral devices and WorkingDr.YNM
ย 
T iming diagrams of 8085
T iming diagrams of 8085T iming diagrams of 8085
T iming diagrams of 8085Salim Khan
ย 
Modulo n counter
Modulo n counterModulo n counter
Modulo n counterManoj Guha
ย 
Manual LogixPro
Manual LogixProManual LogixPro
Manual LogixProIsai Rivera
ย 
Input output module
Input output moduleInput output module
Input output moduleMuhammad Ishaq
ย 
Arithmetic and logic unit
Arithmetic and logic unitArithmetic and logic unit
Arithmetic and logic unitIndrajaMeghavathula
ย 
15CS32 ADE Module 3
15CS32 ADE Module 315CS32 ADE Module 3
15CS32 ADE Module 3RLJIT
ย 
Verilog Test Bench
Verilog Test BenchVerilog Test Bench
Verilog Test BenchDr.YNM
ย 
Encoder, decoder, multiplexers and demultiplexers
Encoder, decoder, multiplexers and demultiplexersEncoder, decoder, multiplexers and demultiplexers
Encoder, decoder, multiplexers and demultiplexerspubgalarab
ย 
Industrial automation using programmable logic controller (plc)
Industrial automation using programmable logic controller (plc)Industrial automation using programmable logic controller (plc)
Industrial automation using programmable logic controller (plc)Saumya Ranjan Behura
ย 

What's hot (20)

VHDL coding in Xilinx
VHDL coding in XilinxVHDL coding in Xilinx
VHDL coding in Xilinx
ย 
Microcontroller
MicrocontrollerMicrocontroller
Microcontroller
ย 
1.ppi 8255
1.ppi 8255 1.ppi 8255
1.ppi 8255
ย 
Industrial Automation Using PLC.
Industrial Automation Using PLC.Industrial Automation Using PLC.
Industrial Automation Using PLC.
ย 
Verilog tutorial
Verilog tutorialVerilog tutorial
Verilog tutorial
ย 
8 bit single cycle processor
8 bit single cycle processor8 bit single cycle processor
8 bit single cycle processor
ย 
Encoder decoder
Encoder decoderEncoder decoder
Encoder decoder
ย 
Dee2034 chapter 6 register
Dee2034 chapter 6 registerDee2034 chapter 6 register
Dee2034 chapter 6 register
ย 
Basics of peripheral devices and Working
Basics of peripheral devices and WorkingBasics of peripheral devices and Working
Basics of peripheral devices and Working
ย 
T iming diagrams of 8085
T iming diagrams of 8085T iming diagrams of 8085
T iming diagrams of 8085
ย 
Modulo n counter
Modulo n counterModulo n counter
Modulo n counter
ย 
Manual LogixPro
Manual LogixProManual LogixPro
Manual LogixPro
ย 
Input output module
Input output moduleInput output module
Input output module
ย 
Arithmetic and logic unit
Arithmetic and logic unitArithmetic and logic unit
Arithmetic and logic unit
ย 
15CS32 ADE Module 3
15CS32 ADE Module 315CS32 ADE Module 3
15CS32 ADE Module 3
ย 
encoder
encoder encoder
encoder
ย 
Verilog Test Bench
Verilog Test BenchVerilog Test Bench
Verilog Test Bench
ย 
Encoder, decoder, multiplexers and demultiplexers
Encoder, decoder, multiplexers and demultiplexersEncoder, decoder, multiplexers and demultiplexers
Encoder, decoder, multiplexers and demultiplexers
ย 
Ladder
LadderLadder
Ladder
ย 
Industrial automation using programmable logic controller (plc)
Industrial automation using programmable logic controller (plc)Industrial automation using programmable logic controller (plc)
Industrial automation using programmable logic controller (plc)
ย 

Similar to Controller Implementation in Verilog

Introduction to Microprocessor & Code
Introduction to Microprocessor & CodeIntroduction to Microprocessor & Code
Introduction to Microprocessor & CodeAvijit Adhikary
ย 
H64CSA_1B_023799_Osama
H64CSA_1B_023799_OsamaH64CSA_1B_023799_Osama
H64CSA_1B_023799_OsamaOsama Azim
ย 
Instruction Set Architecture
Instruction Set ArchitectureInstruction Set Architecture
Instruction Set ArchitectureDilum Bandara
ย 
Computer Architecture โ€“ An Introduction
Computer Architecture โ€“ An IntroductionComputer Architecture โ€“ An Introduction
Computer Architecture โ€“ An IntroductionDilum Bandara
ย 
Programming A Robot Using
Programming A Robot UsingProgramming A Robot Using
Programming A Robot UsingSpitiq
ย 
chapter 4
chapter 4chapter 4
chapter 4GAGANAP12
ย 
embedded system and AVR
embedded system and AVRembedded system and AVR
embedded system and AVRUrvashi Khandelwal
ย 
Picmico
PicmicoPicmico
Picmicologes91
ย 
MICROCONTROLLER.pptx
MICROCONTROLLER.pptxMICROCONTROLLER.pptx
MICROCONTROLLER.pptxfiqrie mohd
ย 
8255 PPI.pptx
8255 PPI.pptx8255 PPI.pptx
8255 PPI.pptxssuser823c58
ย 
GPIO In Arm cortex-m4 tiva-c
GPIO In Arm cortex-m4 tiva-cGPIO In Arm cortex-m4 tiva-c
GPIO In Arm cortex-m4 tiva-cZakaria Gomaa
ย 
Fundamentals.1
Fundamentals.1Fundamentals.1
Fundamentals.1myrajendra
ย 
Presentation
PresentationPresentation
PresentationAbhijit Das
ย 
20IT204-COA- Lecture 17.pptx
20IT204-COA- Lecture 17.pptx20IT204-COA- Lecture 17.pptx
20IT204-COA- Lecture 17.pptxPerumalPitchandi
ย 

Similar to Controller Implementation in Verilog (20)

Introduction to Microprocessor & Code
Introduction to Microprocessor & CodeIntroduction to Microprocessor & Code
Introduction to Microprocessor & Code
ย 
H64CSA_1B_023799_Osama
H64CSA_1B_023799_OsamaH64CSA_1B_023799_Osama
H64CSA_1B_023799_Osama
ย 
Instruction Set Architecture
Instruction Set ArchitectureInstruction Set Architecture
Instruction Set Architecture
ย 
Computer Architecture โ€“ An Introduction
Computer Architecture โ€“ An IntroductionComputer Architecture โ€“ An Introduction
Computer Architecture โ€“ An Introduction
ย 
Programming A Robot Using
Programming A Robot UsingProgramming A Robot Using
Programming A Robot Using
ย 
chapter 4
chapter 4chapter 4
chapter 4
ย 
Remote ashok
Remote ashokRemote ashok
Remote ashok
ย 
embedded system and AVR
embedded system and AVRembedded system and AVR
embedded system and AVR
ย 
Ch 2.pptx
Ch 2.pptxCh 2.pptx
Ch 2.pptx
ย 
Picmico
PicmicoPicmico
Picmico
ย 
MICROCONTROLLER.pptx
MICROCONTROLLER.pptxMICROCONTROLLER.pptx
MICROCONTROLLER.pptx
ย 
8255 PPI.pptx
8255 PPI.pptx8255 PPI.pptx
8255 PPI.pptx
ย 
PLCpptFeb222017.ppt
PLCpptFeb222017.pptPLCpptFeb222017.ppt
PLCpptFeb222017.ppt
ย 
8255 programming
8255 programming8255 programming
8255 programming
ย 
GPIO In Arm cortex-m4 tiva-c
GPIO In Arm cortex-m4 tiva-cGPIO In Arm cortex-m4 tiva-c
GPIO In Arm cortex-m4 tiva-c
ย 
Fundamentals.1
Fundamentals.1Fundamentals.1
Fundamentals.1
ย 
MPMC Unit-3 PPT.pdf
MPMC  Unit-3 PPT.pdfMPMC  Unit-3 PPT.pdf
MPMC Unit-3 PPT.pdf
ย 
arduinoedit.pptx
arduinoedit.pptxarduinoedit.pptx
arduinoedit.pptx
ย 
Presentation
PresentationPresentation
Presentation
ย 
20IT204-COA- Lecture 17.pptx
20IT204-COA- Lecture 17.pptx20IT204-COA- Lecture 17.pptx
20IT204-COA- Lecture 17.pptx
ย 

Recently uploaded

UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSISrknatarajan
ย 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdfSuman Jyoti
ย 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingrknatarajan
ย 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01KreezheaRecto
ย 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...Call Girls in Nagpur High Profile
ย 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...SUHANI PANDEY
ย 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduitsrknatarajan
ย 
Call Now โ‰ฝ 9953056974 โ‰ผ๐Ÿ” Call Girls In New Ashok Nagar โ‰ผ๐Ÿ” Delhi door step de...
Call Now โ‰ฝ 9953056974 โ‰ผ๐Ÿ” Call Girls In New Ashok Nagar  โ‰ผ๐Ÿ” Delhi door step de...Call Now โ‰ฝ 9953056974 โ‰ผ๐Ÿ” Call Girls In New Ashok Nagar  โ‰ผ๐Ÿ” Delhi door step de...
Call Now โ‰ฝ 9953056974 โ‰ผ๐Ÿ” Call Girls In New Ashok Nagar โ‰ผ๐Ÿ” Delhi door step de...9953056974 Low Rate Call Girls In Saket, Delhi NCR
ย 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . pptDineshKumar4165
ย 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringmulugeta48
ย 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
ย 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
ย 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
ย 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
ย 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
ย 
Vivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design SpainVivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design Spaintimesproduction05
ย 
NFPA 5000 2024 standard .
NFPA 5000 2024 standard                                  .NFPA 5000 2024 standard                                  .
NFPA 5000 2024 standard .DerechoLaboralIndivi
ย 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
ย 

Recently uploaded (20)

UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
ย 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
ย 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
ย 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
ย 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
ย 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
ย 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
ย 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
ย 
Call Now โ‰ฝ 9953056974 โ‰ผ๐Ÿ” Call Girls In New Ashok Nagar โ‰ผ๐Ÿ” Delhi door step de...
Call Now โ‰ฝ 9953056974 โ‰ผ๐Ÿ” Call Girls In New Ashok Nagar  โ‰ผ๐Ÿ” Delhi door step de...Call Now โ‰ฝ 9953056974 โ‰ผ๐Ÿ” Call Girls In New Ashok Nagar  โ‰ผ๐Ÿ” Delhi door step de...
Call Now โ‰ฝ 9953056974 โ‰ผ๐Ÿ” Call Girls In New Ashok Nagar โ‰ผ๐Ÿ” Delhi door step de...
ย 
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
ย 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
ย 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineering
ย 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
ย 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
ย 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
ย 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
ย 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
ย 
Vivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design SpainVivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design Spain
ย 
NFPA 5000 2024 standard .
NFPA 5000 2024 standard                                  .NFPA 5000 2024 standard                                  .
NFPA 5000 2024 standard .
ย 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
ย 

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