SlideShare a Scribd company logo
Design of FPGA based 8-bit RISC controller IP core
using VHDL
Aneesh.R

Jiju.K

ER & DCI-IT,
C-DAC Thiruvananthapuram, Kerala
aneeshr2020@gmail.com

Power Electronics Group
C-DAC Thiruvananthapuram, Kerala
jijuk@cdac.in

Abstract—This paper describes the design, development and
implementation of an 8-bit RISC controller IP core. The
controller has been designed using Very high speed integrated
circuit Hardware Description Language (VHDL). The design
constraints are speed, power and area. This controller is efficient
for specific applications and suitable for small applications. This
non-pipelined controller has four units: - Fetch, Decode, Execute
and a stage control unit. It has an in built program and data
memory. Also it has four ports for communicating with other I/O
devices. A hierarchical approach has been used so that basic
units can be modeled using behavioral programming. The basic
units are combined using structural programming. The design
has been implemented using ALTERA STRATIX II FPGA.
Keywords-RISC CPU, Microcontoller design,VHDL, IP core

I.

INTRODUCTION

A microcontroller is a computer-on-a-chip, or, a single-chip
computer. Micro suggests that the device is small, and
controller tells you that the device might be used to control
objects, processes, or events. Performance is the main criteria
for designing such controllers. The proposed RISC controllers
are efficient for specific applications and suitable for small
applications.
CISC processors are mainly emphasis on hardware. They
support various address modes and data types. The instruction
length varies from instruction to instruction. They are generally
implemented using micro-programmed model. Execution of an
instruction requires more than one cycle. The RISC controllers
are mainly emphasis on software. They operate on very few
instructions and addressing modes. The instruction length is
fixed and the decoding is easier. They generally support
hardwired architecture. Most of the instructions are working
on the data stored in the internal registers. Only LOAD and
STORE instruction access data in the data memory.
The proposed 8-bit controller follows the non-pipelined
architecture. It has three 4 stages; Fetch, Decode, Execute, and
a stage control. The Fetch unit fetches the instructions from
program memory. The decode unit decodes the instructions
according to the instruction set architecture. The execute unit
executes the instruction. The stage control unit helps to follow
the fetch, decode and execute path.

Fig 1:- Top Level entity: - Proposed Controller
The top level entity of the proposed 8-bit RISC
microcontroller is show in Fig 1. The processor has Clock,
Reset as input signal and PORTA_8, PORTB_8, PORTC_8,
PORTD_8 are the 8-bit I/O ports used for communicating with
other devices.
II.

INSTRCUSTION SET ARCHITECTURE

The first step in designing a controller is to fix the
instruction for the execution. The proposed controller supports
sixteen instructions of fixed length opcode. The instruction
register width is 16-bit; the first four bits are used as opcode.
A. Register File
The proposed microcontroller supports two types of
registers: - general purpose and special purpose registers. It has
sixteen general purpose registers (R0-R16), are used for
communication within the controller. Also it has four special
purpose registers (porta, portb, portc, portd), are used for
communicating with I/O devices. All registers in the design can
hold an 8-bit data. The base resister for the proposed design is
R0.
B. Instruction Formats
All the instructions are of fixed length and instruction
register length is sixteen bit. The proposed microcontroller
design supports three types of instruction formats. Immediate
type, Register type, and Jump type. The different instruction
format is shown in fig 2.

978-1-4673-2272-0/12/$31.00 ©2012 IEEE

427
Fig 2:- Instruction Formats
The op-code length for a proposed microcontroller is 4-bit.
Also 4 bit used to represent the source and destination registers.
In immediate type instructions an 8-bit immediate data is a part
of the instruction. In this type a destination register is also
available. In register type instruction format both the source
and destination be registers. Also in jump type, a 12-bit
program memory address is used as part of the instruction.
C. Instrustion set
The proposed IP core design has sixteen instructions of
fixed length op-code. The design supports two flags:-ZERO
and CARRY. The Table 1 represents the instruction set used in
this design.

this operation is R0 register. The Instructions ADD and SUB
performs the addition and subtraction operation between
destination and source registers and the result is stored in
destination register. If the result of operation is zero, it sets the
zero flag otherwise cleared. If any carry or borrow occur during
the operation of an addition or a subtraction operation, carry
flag is set or otherwise it is reset. The XOR operation performs
the Exclusive-OR operation between the destination and source
registers. It affects the zero flag only. The CMP instruction
performs the comparison operation between source and
destination registers. If the destination register is higher than
source register, carry flag is set otherwise it is in reset
condition.
The JMP instruction performs the unconditional jump in the
program memory. The jump address is specified as part of the
instruction. The JNZ and JEQ are conditional jump
instructions, they performs jump operation based on zero and
carry flag. The IN and OUT instructions are used to
communicate with other I/O devices. The ports are memory
mapped to first four locations in the data memory. The port
address is specified as part of the instruction. The base register
used for these operations are R0. The IN instruction loads the
value from the specified port address to the base register R0.
The OUT instruction stores the value on the R0 to the specified
port address. The BS and BC instructions are used to set and
clear the bit positions in the destination register.
III.

INTERNAL ARCHITECTURE

Fig 3 shows the internal diagram of the proposed 8 bit RISC
microcontroller. The design uses a program counter of 13-bit,
so the program memory depth is 8k x 16. Data memory is of
size 256 bytes. The first four locations of data memory is
memory mapped for the four ports. Basic units in this
controller are stage control unit, Fetch unit, Decode unit and
Execution unit.
A. Stage Control Unit
The stage control unit is used to control the flow of
execution of an instruction in various stages (Fetch, Decode
and Execute). The top level entity is show in Fig 4.

Table 1:- Instruction set
The NOP instruction performs the no operation; it delays
the controller clock by 1 cycle. The MOV instructions perform
the data movement between source and destination registers.
The MVI instruction performs the movement of an immediate
data to the destination register. The LD and ST instructions
loads and stores the data to or from the data memory, memory
address is specified as part of instruction. The base register for

Fig 4:- Top Level entity: - Stage Control Unit
This unit is a combinational unit. It checks for the
completion signal from one unit and provides an enable signal
to the next unit. The algorithm used for this is shown in Fig5.

428
Fig 3:- Internal Architecture

Fig 6:- Top Level Entity:-Fetch Unit
The fetch module is directly connected to the program
memory. The flow chart for the working of a fetch unit is
shown in Fig 7.

Fig 5:- Algorithm- Stage Control unit
After the removal of reset signal it is in Fetch_aft_rst state
and enables the fetch unit and wait for the completion signal
from the fetch unit. If fetch completion occurs then it moves to
the Decode state and enables the decode unit. Once the
decoding is complete it moves to the Execute state and enables
the execution unit. As the execution unit completes its
operation then it moves to the Fetch state for fetching the new
instruction, and the operation continues.
B. Fetch unit
Fetch unit fetches the instructions from the program memory.
It consists of a 13-bit Program counter (PC), which holds the
address of next instruction to be executed and a 16-bit
Instruction Register (IR) which holds the current instruction to
be executed. The top level entity is shown in Fig 6.

Fig 7:- Flowchart-Fetch Unit
When a reset is applied, the Program counter and
instruction register are set to be zero. After the removal of
reset it comes to the work state and checks for the fetch enable
signal, if it is enabled it places the program counter value on to
the address bus of program memory and provides a read signal
to the program memory. Within the one clock cycle duration
the program memory will performs the read operation and
state changes to update state.

429
In update state the value on to the data bus of the program
memory is copied to the instruction register and program
counter is incremented by one. After this operation a fetch
completion signal is given to the stage control unit and state
changed to work state.

D. Execution unit
The execution unit performs the execution of the
instructions that is already decoded. The execution unit is
divided into several subunits to perform operations. The
internal diagram of an execution unit is shown in Fig 10.

C. Decode unit
The decode unit in the proposed controller performs the
decoding of the instruction register obtained from the fetch
unit. The top level entity of the decode unit is shown in Fig 8

Fig 8: Top Level Entity: - Decode Unit
The input to the decode module is Inst_reg, a 16 bit
register from the fetch unit. It has output of destination register
(4-bit), source register (4-bit), immediate bus (8-bit), Branch
address (12-bit), and a bit position (3 bit). The source and
destination register is used to identify the source and
destination registers used. The immediate bus is used to hold
an 8-bit immediate value for immediate data transfers. The
branch address bus is a 12-bit bus used to hold the addresses
for jump operations. The Bit_pos bus is an 8-bit used for
holding the bit position for the bit set and clear operations.
The state diagram for a decode unit is shown in Fig 9.

Fig 10:- Internal Diagram-Execution unit
The Execution unit performs the proposed instruction set
[Table 1]. The 16 instructions are grouped into 7 sub units.
a. MOVE unit
The MOVE unit is designed to perform MVI and MOV
instructions. The MVI is move immediate. It performs the
immediate movement of an 8-bit data to destination register.
The example is: - MVI R0, 00010010.This instruction
performs the movement of immediate value 00010010 to the
destination register R0. The MOV instruction performs the
movement of data between source and destination registers.
The example is:-MOV R1, R2. This instruction performs the
movement of the content of R2 into R1.
b. ARITHMETIC unit
The ARITHMETIC unit is designed to perform ADD and
SUB instructions. The ADD instruction performs the addition
of content in registers. The example is: - ADD R0, R1.This
instruction performs the addition of contents in register R0 and
R1. After the addition the result of operation is stored in
destination register (R0). If any carry occur during the
addition operation a carry flag is set. The content of register
R1 is not altered.

Fig 9: State Diagram: - Decode unit
The state machine of the decode unit contains 4 states;
RESET, IDLE, DECODE, DECODE_COMP. The RESET
state is for reset operations. The IDLE state is the default state
in decode unit. It checks for the enable signal of the decode
unit. If it is enabled then it moves to the DECODE state
otherwise it stays in IDLE state. In DECODE state it performs
the decode operation and moves to the DECODE_COMP state
and produces a decode completion signal In DECODE state
first it checks for the first 4 bit to identify the opcode, based
on that it performs the appropriate information extraction.

The SUB instruction performs the subtraction of contents
in register. The example is: - SUB R0, R1.This instruction
performs the subtraction of contents in register R0 and R1.
After the subtraction the result of operation is stored in
destination register (R0). If any borrow occur during the
subtraction operation a carry flag is set.
c. LOGIC unit
The LOGIC unit is designed to perform XOR and CMP
instructions. The XOR instruction is used performs the
Exclusive-OR operation between the source and destination
registers. The example is: -XOR R2, R3. This instruction
performs the Exclusive-OR operation between registers R2
and R3.After the execution of operation the result is stored on

430
to the register R2. The content of register R3 is not altered. If
the result of operation is zero then a zero flag is set.
The CMP instruction is used to perform comparison
between source and destination registers. The example is: CMP R2, R3. This instruction performs the comparison
operation between registers R2 and R3. After the execution of
operation the result is stored on to the register R2. If the
contents of registers are same the zero flag is set or otherwise
it is reset. The content of registers is not altered after the
execution.
d. LOAD_STORE unit
The LOAD_STORE unit is designed to perform LD and
ST instructions. The base register used for load and store
operation is R0.The LD instruction is used to perform the
LOAD operation. As a part of instruction an 8-bit data
memory address is specified. The example is:-LD 00100000.
This instruction loads the content of memory location
00100000 (0x20H) in the base register R0. The ST instruction
is used to perform the STORE operation. The memory address
is specified as a part of the instruction. The example is:ST 00100000.This instruction stores the contents of base
register on to the memory location 00100000 (0x20H).
e. JUMP unit
The JUMP unit is designed to perform JMP, JNZ, and JEQ
instructions. It performs the jump in program memory. The
jump address is specified as a part of instruction. The JMP is
an unconditional jump instruction and JNZ and JEQ are
conditional jump instruction. The maximum supported jump
in program memory is 212. This unit works on the content of
status of flag registers. The examples are JMP 0x020,
JNZ 0x1FF, JEQ 0X2FF.
In the instruction JMP 0x020 it jumps to the program
memory location 0x020.For this instruction only the program
counter (PC) value is substituted with jump address, and
normal instruction fetch continuous. In the instruction
JNZ0x1FF it jumps to the program memory location 0x1FF
only the zero flag is in reset condition (active LOW). If the
zero flag set then this instruction is not been executed. The
instruction JEQ 0x2FF it jumps to the program memory
location 0x2FF, only the zero flag is set. If the zero flag is low
then this instruction is not been executed.

register R0. The OUT instructions load the base register on to
the port 00000001. All the ports are directly mapped to the
first four locations in the data memory.
g. SET_CLEAR unit
The SET_CLEAR unit is used to perform bit setting and
resetting of the specified register. This operation is done by
specifying the bit position as a part of the instruction. The
example is BS R0, 00000001. This instruction sets (high) the
first position in the R0 register. Also BC R0, 00000000, this
instruction resets (zero) the zeroth bit position in R0 register.
h. NOP unit
The NOP unit is used to perform the no operation. This
operation used to wait the operation of the controller to 3
clock cycle. Only opcode is used as a part of the instruction. It
doesn’t alter the content of any register.
IV.

SIMULATION RESULTS

The proposed microcontroller is developed using VHDL
and simulated using ModelSim 6.4SE. For simulation, place a
piece of code on to the program memory and perform the
simulation and verify the operations. Fig 11 shows the
movement of an instruction MOV R2, 00000010. Fig 12
shows the movement of data from R2 to R1.

Fig 11: MOV R2, 00000010

f. IN_OUT unit
The IN and OUT instructions used for transferring data to
and from the Input/output ports. The IN instruction stores the
data from port to the base register R0. The OUT instruction
stores the data on to the I/O port from base register R0.The
address of ports are shown in Table 2.

Table 2:- Port address
The examples are IN 00000001, OUT 00000001.The IN
instruction stores the status of the port 00000001 to the base

Fig 12:- MOV R1, R2

431
V.

IMPLEMENTATION ON FPGA

The proposed microcontroller is synthesized using
ALTERA QUARTUS II software. Fig 13 shows the Register
Transfer Level (RTL) view of proposed controller. The
controller is implemented on ALTERA STRATIX II
EP2S60F672C3N FPGA. Table 3 shows the device utilization
of the proposed controller.

VI.

CONCLUSION

In this paper, how to design an 8-bit microcontroller IP core
is presented. We adopted a top-down method and uses VHDL
to describe system. First we design each module
independently and the uses a structural programming to obtain
an IP core. This uses Harvard Bus architecture and most of the
instructions are single machine cycle instructions. This
controller supports 16 instructions. The proposed controller is
implemented in System on Chip environment to work for a
certain specific applications. The controller can support a
maximum frequency of 253.8MHz.
REFERENCES
[1]

[2]

Fig 13:- RTL View- Proposed controller
[3]
[4]
[5]
[6]
[7]

Table 3: Device Utilization

Mamun Bin Ibne Reaz, Md. Shabiul Islam, Mohd. S. Sulaiman,”A single
clcok cycle MIPS RISC processor design using VHDL”. ICSE2002 Proc.
2002, Penang, Malaysia. pp 199–203.
Mrs. Rupali S. Balpande, Mrs.Rashmi S. Keote,’’Design of FPGA based
Instruction Fetch & Decode module of 32-bit RISC (MIPS)Processor’’.
2011 International Conference on Communication Systems and Network
Technologies.pp 409–413.
Enoch O Hwang , Digital Logic and Microprocessor Design with
VHDL. 2005.
Jan Gray, Building a RISC system in an FPGA: Part 1,2 & 3, Circuit
Cellar. Magazine (http://www.circuitcellar.com),
David A. Patterson, John L. Hennessy, Computer Organization &
Design, Morgan Kaufmann Publishers, 1999.
Chan, P, Mourad, S Digital Design Using Field Programmable Gate
Arrays, Prentice-Hall, Inc. Englewood Cliffs, NJ, 1994].
Douglas L. Perry, VHDL, McGraw-Hill Companies, Inc.: Singapore,
1999.

432
Ad

Recommended

PDF
Unit 3 mpmc
tamilnesaner
 
PPT
microprocessor
ATTO RATHORE
 
PPT
microprocessor
ATTO RATHORE
 
PDF
Introduction to 8085 Microprocessor
Prof. Dr. K. Adisesha
 
PDF
8080 8085 assembly language_programming manual programando
Universidad de Tarapaca
 
PDF
Unit 5
tamilnesaner
 
PDF
Ca basic computer organization
Prof. Dr. K. Adisesha
 
PDF
Unit 4
tamilnesaner
 
PDF
Design and Fabrication of 4-bit processor
Priyatham Bollimpalli
 
PDF
Central processor organization
Prof. Dr. K. Adisesha
 
PDF
8085 alp programs
Prof. Dr. K. Adisesha
 
PDF
Unit 1 MPMC
tamilnesaner
 
PDF
MICROPROCESSOR 8085 WITH PROGRAMS
Sabin Gautam
 
PDF
Microprocessor & Microcontoller short questions with answers
Mathankumar S
 
DOCX
Architecture of 8051
OGAGA OTOBOR
 
DOC
M.sc I-sem-8086 notes
Dr.YNM
 
PDF
Microcontroller pic 16f877 addressing modes instructions and programming
Nilesh Bhaskarrao Bahadure
 
DOC
Microprocessor Basics 8085 Ch-1
Neelam Kapoor
 
PDF
Introduction to 8085 Microprocessors
Veerakumar S
 
PDF
Ec6703 embedded and real time systems(1)
viswnathan
 
PDF
4bit PC report
tanvin
 
PPT
8085-microprocessor
ATTO RATHORE
 
PDF
Viva
Nithin Mohan
 
PPT
2.computer org.
Mahesh Kumar Attri
 
PDF
01 dsp intro_1
Ghulam Raza
 
PPTX
Pipelineing idealisam
Aneesh Raveendran
 
PPT
CPU
robledano22
 
PPT
Choosing the right processor
Pantech ProLabs India Pvt Ltd
 

More Related Content

What's hot (18)

PDF
Design and Fabrication of 4-bit processor
Priyatham Bollimpalli
 
PDF
Central processor organization
Prof. Dr. K. Adisesha
 
PDF
8085 alp programs
Prof. Dr. K. Adisesha
 
PDF
Unit 1 MPMC
tamilnesaner
 
PDF
MICROPROCESSOR 8085 WITH PROGRAMS
Sabin Gautam
 
PDF
Microprocessor & Microcontoller short questions with answers
Mathankumar S
 
DOCX
Architecture of 8051
OGAGA OTOBOR
 
DOC
M.sc I-sem-8086 notes
Dr.YNM
 
PDF
Microcontroller pic 16f877 addressing modes instructions and programming
Nilesh Bhaskarrao Bahadure
 
DOC
Microprocessor Basics 8085 Ch-1
Neelam Kapoor
 
PDF
Introduction to 8085 Microprocessors
Veerakumar S
 
PDF
Ec6703 embedded and real time systems(1)
viswnathan
 
PDF
4bit PC report
tanvin
 
PPT
8085-microprocessor
ATTO RATHORE
 
PDF
Viva
Nithin Mohan
 
PPT
2.computer org.
Mahesh Kumar Attri
 
Design and Fabrication of 4-bit processor
Priyatham Bollimpalli
 
Central processor organization
Prof. Dr. K. Adisesha
 
8085 alp programs
Prof. Dr. K. Adisesha
 
Unit 1 MPMC
tamilnesaner
 
MICROPROCESSOR 8085 WITH PROGRAMS
Sabin Gautam
 
Microprocessor & Microcontoller short questions with answers
Mathankumar S
 
Architecture of 8051
OGAGA OTOBOR
 
M.sc I-sem-8086 notes
Dr.YNM
 
Microcontroller pic 16f877 addressing modes instructions and programming
Nilesh Bhaskarrao Bahadure
 
Microprocessor Basics 8085 Ch-1
Neelam Kapoor
 
Introduction to 8085 Microprocessors
Veerakumar S
 
Ec6703 embedded and real time systems(1)
viswnathan
 
4bit PC report
tanvin
 
8085-microprocessor
ATTO RATHORE
 
2.computer org.
Mahesh Kumar Attri
 

Viewers also liked (11)

PDF
01 dsp intro_1
Ghulam Raza
 
PPTX
Pipelineing idealisam
Aneesh Raveendran
 
PPT
CPU
robledano22
 
PPT
Choosing the right processor
Pantech ProLabs India Pvt Ltd
 
DOCX
Singapore
zoolainsudan
 
PPSX
Evaluation Question 1
LydiaGreenwood
 
PDF
Unalligned versus natureally alligned memory access
Aneesh Raveendran
 
PPTX
Evaluation Question 1: In what ways does your media product use, develop or c...
LydiaGreenwood
 
PDF
ISE FundHub product guide
gerrysugrue
 
PPTX
Transforming learning with new technologies
tonikaperry
 
PDF
25 Important Content Marketing Statistics
The Content Strategist
 
01 dsp intro_1
Ghulam Raza
 
Pipelineing idealisam
Aneesh Raveendran
 
Choosing the right processor
Pantech ProLabs India Pvt Ltd
 
Singapore
zoolainsudan
 
Evaluation Question 1
LydiaGreenwood
 
Unalligned versus natureally alligned memory access
Aneesh Raveendran
 
Evaluation Question 1: In what ways does your media product use, develop or c...
LydiaGreenwood
 
ISE FundHub product guide
gerrysugrue
 
Transforming learning with new technologies
tonikaperry
 
25 Important Content Marketing Statistics
The Content Strategist
 
Ad

Similar to Design of FPGA based 8-bit RISC Controller IP core using VHDL (20)

PDF
16-bit Microprocessor Design (2005)
Susam Pal
 
PPTX
Basic Computer Organization and Design
Kamal Acharya
 
PDF
4bit pc report[cse 08-section-b2_group-02]
shibbirtanvin
 
PDF
An Enhanced FPGA Based Asynchronous Microprocessor Design Using VIVADO and ISIM
journalBEEI
 
PDF
IRJET- To Design 16 bit Synchronous Microprocessor using VHDL on FPGA
IRJET Journal
 
PPTX
Unit 1 dasic cimputer organisation and design.pptx
ELAKYARINT
 
PDF
Chapter 3 computer organization and artpdf
Mohammed472103
 
PDF
Bca examination 2015 csa
Anjaan Gajendra
 
PDF
Design and Implementation of Pipelined 8-Bit RISC Processor using Verilog HDL...
IRJET Journal
 
PDF
MPMC PPT_MODULE 1&2 Jan202mmmmmmmmmmm4.pdf
anishasabesan
 
PDF
Dm25671674
IJERA Editor
 
PPTX
CSA PPT UNIT 1.pptx
sukhpreetsingh295239
 
PDF
8 bit Microprocessor with Single Vectored Interrupt
Hardik Manocha
 
PPTX
Chapter 3 Assembly level machine organization Assembly level machine organiza...
shumawakjira26
 
PDF
Design and development of a 5-stage Pipelined RISC processor based on MIPS
IRJET Journal
 
DOC
viva q&a for mp lab
g yugandhar srinivas
 
PDF
Basic Computer Organization and Design
mekind
 
PDF
A044050107
IJERA Editor
 
PDF
Design & Simulation of RISC Processor using Hyper Pipelining Technique
IOSR Journals
 
PDF
Microprocessor and microcontroller (MPMC).pdf
XyzjakhaAbhuvs
 
16-bit Microprocessor Design (2005)
Susam Pal
 
Basic Computer Organization and Design
Kamal Acharya
 
4bit pc report[cse 08-section-b2_group-02]
shibbirtanvin
 
An Enhanced FPGA Based Asynchronous Microprocessor Design Using VIVADO and ISIM
journalBEEI
 
IRJET- To Design 16 bit Synchronous Microprocessor using VHDL on FPGA
IRJET Journal
 
Unit 1 dasic cimputer organisation and design.pptx
ELAKYARINT
 
Chapter 3 computer organization and artpdf
Mohammed472103
 
Bca examination 2015 csa
Anjaan Gajendra
 
Design and Implementation of Pipelined 8-Bit RISC Processor using Verilog HDL...
IRJET Journal
 
MPMC PPT_MODULE 1&2 Jan202mmmmmmmmmmm4.pdf
anishasabesan
 
Dm25671674
IJERA Editor
 
CSA PPT UNIT 1.pptx
sukhpreetsingh295239
 
8 bit Microprocessor with Single Vectored Interrupt
Hardik Manocha
 
Chapter 3 Assembly level machine organization Assembly level machine organiza...
shumawakjira26
 
Design and development of a 5-stage Pipelined RISC processor based on MIPS
IRJET Journal
 
viva q&a for mp lab
g yugandhar srinivas
 
Basic Computer Organization and Design
mekind
 
A044050107
IJERA Editor
 
Design & Simulation of RISC Processor using Hyper Pipelining Technique
IOSR Journals
 
Microprocessor and microcontroller (MPMC).pdf
XyzjakhaAbhuvs
 
Ad

More from Aneesh Raveendran (7)

PPT
Single_Electron_Transistor_Aneesh_Raveendran
Aneesh Raveendran
 
PDF
Universal Asynchronous Receive and transmit IP core
Aneesh Raveendran
 
PPT
Branch prediction
Aneesh Raveendran
 
PPT
Performance Enhancement with Pipelining
Aneesh Raveendran
 
PDF
Reversible Logic Gate
Aneesh Raveendran
 
PDF
Architecture and Implementation of the ARM Cortex-A8 Microprocessor
Aneesh Raveendran
 
PDF
Design and Implementation of Bluetooth MAC core with RFCOMM on FPGA
Aneesh Raveendran
 
Single_Electron_Transistor_Aneesh_Raveendran
Aneesh Raveendran
 
Universal Asynchronous Receive and transmit IP core
Aneesh Raveendran
 
Branch prediction
Aneesh Raveendran
 
Performance Enhancement with Pipelining
Aneesh Raveendran
 
Reversible Logic Gate
Aneesh Raveendran
 
Architecture and Implementation of the ARM Cortex-A8 Microprocessor
Aneesh Raveendran
 
Design and Implementation of Bluetooth MAC core with RFCOMM on FPGA
Aneesh Raveendran
 

Recently uploaded (20)

PDF
Plugging AI into everything: Model Context Protocol Simplified.pdf
Abati Adewale
 
PDF
Enhancing Environmental Monitoring with Real-Time Data Integration: Leveragin...
Safe Software
 
DOCX
Daily Lesson Log MATATAG ICT TEchnology 8
LOIDAALMAZAN3
 
PPTX
Enabling the Digital Artisan – keynote at ICOCI 2025
Alan Dix
 
PDF
Database Benchmarking for Performance Masterclass: Session 2 - Data Modeling ...
ScyllaDB
 
PDF
Kubernetes - Architecture & Components.pdf
geethak285
 
PDF
Cracking the Code - Unveiling Synergies Between Open Source Security and AI.pdf
Priyanka Aash
 
PDF
Hyderabad MuleSoft In-Person Meetup (June 21, 2025) Slides
Ravi Tamada
 
PPTX
Smarter Governance with AI: What Every Board Needs to Know
OnBoard
 
PDF
Darley - FIRST Copenhagen Lightning Talk (2025-06-26) Epochalypse 2038 - Time...
treyka
 
PDF
The Future of Product Management in AI ERA.pdf
Alyona Owens
 
PDF
Automating the Geo-Referencing of Historic Aerial Photography in Flanders
Safe Software
 
PDF
Optimizing the trajectory of a wheel loader working in short loading cycles
Reno Filla
 
PDF
Database Benchmarking for Performance Masterclass: Session 1 - Benchmarking F...
ScyllaDB
 
PPSX
Usergroup - OutSystems Architecture.ppsx
Kurt Vandevelde
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PPTX
UserCon Belgium: Honey, VMware increased my bill
stijn40
 
PPTX
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
pcprocore
 
PDF
Why aren't you using FME Flow's CPU Time?
Safe Software
 
PPTX
01_Approach Cyber- DORA Incident Management.pptx
FinTech Belgium
 
Plugging AI into everything: Model Context Protocol Simplified.pdf
Abati Adewale
 
Enhancing Environmental Monitoring with Real-Time Data Integration: Leveragin...
Safe Software
 
Daily Lesson Log MATATAG ICT TEchnology 8
LOIDAALMAZAN3
 
Enabling the Digital Artisan – keynote at ICOCI 2025
Alan Dix
 
Database Benchmarking for Performance Masterclass: Session 2 - Data Modeling ...
ScyllaDB
 
Kubernetes - Architecture & Components.pdf
geethak285
 
Cracking the Code - Unveiling Synergies Between Open Source Security and AI.pdf
Priyanka Aash
 
Hyderabad MuleSoft In-Person Meetup (June 21, 2025) Slides
Ravi Tamada
 
Smarter Governance with AI: What Every Board Needs to Know
OnBoard
 
Darley - FIRST Copenhagen Lightning Talk (2025-06-26) Epochalypse 2038 - Time...
treyka
 
The Future of Product Management in AI ERA.pdf
Alyona Owens
 
Automating the Geo-Referencing of Historic Aerial Photography in Flanders
Safe Software
 
Optimizing the trajectory of a wheel loader working in short loading cycles
Reno Filla
 
Database Benchmarking for Performance Masterclass: Session 1 - Benchmarking F...
ScyllaDB
 
Usergroup - OutSystems Architecture.ppsx
Kurt Vandevelde
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
UserCon Belgium: Honey, VMware increased my bill
stijn40
 
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
pcprocore
 
Why aren't you using FME Flow's CPU Time?
Safe Software
 
01_Approach Cyber- DORA Incident Management.pptx
FinTech Belgium
 

Design of FPGA based 8-bit RISC Controller IP core using VHDL

  • 1. Design of FPGA based 8-bit RISC controller IP core using VHDL Aneesh.R Jiju.K ER & DCI-IT, C-DAC Thiruvananthapuram, Kerala [email protected] Power Electronics Group C-DAC Thiruvananthapuram, Kerala [email protected] Abstract—This paper describes the design, development and implementation of an 8-bit RISC controller IP core. The controller has been designed using Very high speed integrated circuit Hardware Description Language (VHDL). The design constraints are speed, power and area. This controller is efficient for specific applications and suitable for small applications. This non-pipelined controller has four units: - Fetch, Decode, Execute and a stage control unit. It has an in built program and data memory. Also it has four ports for communicating with other I/O devices. A hierarchical approach has been used so that basic units can be modeled using behavioral programming. The basic units are combined using structural programming. The design has been implemented using ALTERA STRATIX II FPGA. Keywords-RISC CPU, Microcontoller design,VHDL, IP core I. INTRODUCTION A microcontroller is a computer-on-a-chip, or, a single-chip computer. Micro suggests that the device is small, and controller tells you that the device might be used to control objects, processes, or events. Performance is the main criteria for designing such controllers. The proposed RISC controllers are efficient for specific applications and suitable for small applications. CISC processors are mainly emphasis on hardware. They support various address modes and data types. The instruction length varies from instruction to instruction. They are generally implemented using micro-programmed model. Execution of an instruction requires more than one cycle. The RISC controllers are mainly emphasis on software. They operate on very few instructions and addressing modes. The instruction length is fixed and the decoding is easier. They generally support hardwired architecture. Most of the instructions are working on the data stored in the internal registers. Only LOAD and STORE instruction access data in the data memory. The proposed 8-bit controller follows the non-pipelined architecture. It has three 4 stages; Fetch, Decode, Execute, and a stage control. The Fetch unit fetches the instructions from program memory. The decode unit decodes the instructions according to the instruction set architecture. The execute unit executes the instruction. The stage control unit helps to follow the fetch, decode and execute path. Fig 1:- Top Level entity: - Proposed Controller The top level entity of the proposed 8-bit RISC microcontroller is show in Fig 1. The processor has Clock, Reset as input signal and PORTA_8, PORTB_8, PORTC_8, PORTD_8 are the 8-bit I/O ports used for communicating with other devices. II. INSTRCUSTION SET ARCHITECTURE The first step in designing a controller is to fix the instruction for the execution. The proposed controller supports sixteen instructions of fixed length opcode. The instruction register width is 16-bit; the first four bits are used as opcode. A. Register File The proposed microcontroller supports two types of registers: - general purpose and special purpose registers. It has sixteen general purpose registers (R0-R16), are used for communication within the controller. Also it has four special purpose registers (porta, portb, portc, portd), are used for communicating with I/O devices. All registers in the design can hold an 8-bit data. The base resister for the proposed design is R0. B. Instruction Formats All the instructions are of fixed length and instruction register length is sixteen bit. The proposed microcontroller design supports three types of instruction formats. Immediate type, Register type, and Jump type. The different instruction format is shown in fig 2. 978-1-4673-2272-0/12/$31.00 ©2012 IEEE 427
  • 2. Fig 2:- Instruction Formats The op-code length for a proposed microcontroller is 4-bit. Also 4 bit used to represent the source and destination registers. In immediate type instructions an 8-bit immediate data is a part of the instruction. In this type a destination register is also available. In register type instruction format both the source and destination be registers. Also in jump type, a 12-bit program memory address is used as part of the instruction. C. Instrustion set The proposed IP core design has sixteen instructions of fixed length op-code. The design supports two flags:-ZERO and CARRY. The Table 1 represents the instruction set used in this design. this operation is R0 register. The Instructions ADD and SUB performs the addition and subtraction operation between destination and source registers and the result is stored in destination register. If the result of operation is zero, it sets the zero flag otherwise cleared. If any carry or borrow occur during the operation of an addition or a subtraction operation, carry flag is set or otherwise it is reset. The XOR operation performs the Exclusive-OR operation between the destination and source registers. It affects the zero flag only. The CMP instruction performs the comparison operation between source and destination registers. If the destination register is higher than source register, carry flag is set otherwise it is in reset condition. The JMP instruction performs the unconditional jump in the program memory. The jump address is specified as part of the instruction. The JNZ and JEQ are conditional jump instructions, they performs jump operation based on zero and carry flag. The IN and OUT instructions are used to communicate with other I/O devices. The ports are memory mapped to first four locations in the data memory. The port address is specified as part of the instruction. The base register used for these operations are R0. The IN instruction loads the value from the specified port address to the base register R0. The OUT instruction stores the value on the R0 to the specified port address. The BS and BC instructions are used to set and clear the bit positions in the destination register. III. INTERNAL ARCHITECTURE Fig 3 shows the internal diagram of the proposed 8 bit RISC microcontroller. The design uses a program counter of 13-bit, so the program memory depth is 8k x 16. Data memory is of size 256 bytes. The first four locations of data memory is memory mapped for the four ports. Basic units in this controller are stage control unit, Fetch unit, Decode unit and Execution unit. A. Stage Control Unit The stage control unit is used to control the flow of execution of an instruction in various stages (Fetch, Decode and Execute). The top level entity is show in Fig 4. Table 1:- Instruction set The NOP instruction performs the no operation; it delays the controller clock by 1 cycle. The MOV instructions perform the data movement between source and destination registers. The MVI instruction performs the movement of an immediate data to the destination register. The LD and ST instructions loads and stores the data to or from the data memory, memory address is specified as part of instruction. The base register for Fig 4:- Top Level entity: - Stage Control Unit This unit is a combinational unit. It checks for the completion signal from one unit and provides an enable signal to the next unit. The algorithm used for this is shown in Fig5. 428
  • 3. Fig 3:- Internal Architecture Fig 6:- Top Level Entity:-Fetch Unit The fetch module is directly connected to the program memory. The flow chart for the working of a fetch unit is shown in Fig 7. Fig 5:- Algorithm- Stage Control unit After the removal of reset signal it is in Fetch_aft_rst state and enables the fetch unit and wait for the completion signal from the fetch unit. If fetch completion occurs then it moves to the Decode state and enables the decode unit. Once the decoding is complete it moves to the Execute state and enables the execution unit. As the execution unit completes its operation then it moves to the Fetch state for fetching the new instruction, and the operation continues. B. Fetch unit Fetch unit fetches the instructions from the program memory. It consists of a 13-bit Program counter (PC), which holds the address of next instruction to be executed and a 16-bit Instruction Register (IR) which holds the current instruction to be executed. The top level entity is shown in Fig 6. Fig 7:- Flowchart-Fetch Unit When a reset is applied, the Program counter and instruction register are set to be zero. After the removal of reset it comes to the work state and checks for the fetch enable signal, if it is enabled it places the program counter value on to the address bus of program memory and provides a read signal to the program memory. Within the one clock cycle duration the program memory will performs the read operation and state changes to update state. 429
  • 4. In update state the value on to the data bus of the program memory is copied to the instruction register and program counter is incremented by one. After this operation a fetch completion signal is given to the stage control unit and state changed to work state. D. Execution unit The execution unit performs the execution of the instructions that is already decoded. The execution unit is divided into several subunits to perform operations. The internal diagram of an execution unit is shown in Fig 10. C. Decode unit The decode unit in the proposed controller performs the decoding of the instruction register obtained from the fetch unit. The top level entity of the decode unit is shown in Fig 8 Fig 8: Top Level Entity: - Decode Unit The input to the decode module is Inst_reg, a 16 bit register from the fetch unit. It has output of destination register (4-bit), source register (4-bit), immediate bus (8-bit), Branch address (12-bit), and a bit position (3 bit). The source and destination register is used to identify the source and destination registers used. The immediate bus is used to hold an 8-bit immediate value for immediate data transfers. The branch address bus is a 12-bit bus used to hold the addresses for jump operations. The Bit_pos bus is an 8-bit used for holding the bit position for the bit set and clear operations. The state diagram for a decode unit is shown in Fig 9. Fig 10:- Internal Diagram-Execution unit The Execution unit performs the proposed instruction set [Table 1]. The 16 instructions are grouped into 7 sub units. a. MOVE unit The MOVE unit is designed to perform MVI and MOV instructions. The MVI is move immediate. It performs the immediate movement of an 8-bit data to destination register. The example is: - MVI R0, 00010010.This instruction performs the movement of immediate value 00010010 to the destination register R0. The MOV instruction performs the movement of data between source and destination registers. The example is:-MOV R1, R2. This instruction performs the movement of the content of R2 into R1. b. ARITHMETIC unit The ARITHMETIC unit is designed to perform ADD and SUB instructions. The ADD instruction performs the addition of content in registers. The example is: - ADD R0, R1.This instruction performs the addition of contents in register R0 and R1. After the addition the result of operation is stored in destination register (R0). If any carry occur during the addition operation a carry flag is set. The content of register R1 is not altered. Fig 9: State Diagram: - Decode unit The state machine of the decode unit contains 4 states; RESET, IDLE, DECODE, DECODE_COMP. The RESET state is for reset operations. The IDLE state is the default state in decode unit. It checks for the enable signal of the decode unit. If it is enabled then it moves to the DECODE state otherwise it stays in IDLE state. In DECODE state it performs the decode operation and moves to the DECODE_COMP state and produces a decode completion signal In DECODE state first it checks for the first 4 bit to identify the opcode, based on that it performs the appropriate information extraction. The SUB instruction performs the subtraction of contents in register. The example is: - SUB R0, R1.This instruction performs the subtraction of contents in register R0 and R1. After the subtraction the result of operation is stored in destination register (R0). If any borrow occur during the subtraction operation a carry flag is set. c. LOGIC unit The LOGIC unit is designed to perform XOR and CMP instructions. The XOR instruction is used performs the Exclusive-OR operation between the source and destination registers. The example is: -XOR R2, R3. This instruction performs the Exclusive-OR operation between registers R2 and R3.After the execution of operation the result is stored on 430
  • 5. to the register R2. The content of register R3 is not altered. If the result of operation is zero then a zero flag is set. The CMP instruction is used to perform comparison between source and destination registers. The example is: CMP R2, R3. This instruction performs the comparison operation between registers R2 and R3. After the execution of operation the result is stored on to the register R2. If the contents of registers are same the zero flag is set or otherwise it is reset. The content of registers is not altered after the execution. d. LOAD_STORE unit The LOAD_STORE unit is designed to perform LD and ST instructions. The base register used for load and store operation is R0.The LD instruction is used to perform the LOAD operation. As a part of instruction an 8-bit data memory address is specified. The example is:-LD 00100000. This instruction loads the content of memory location 00100000 (0x20H) in the base register R0. The ST instruction is used to perform the STORE operation. The memory address is specified as a part of the instruction. The example is:ST 00100000.This instruction stores the contents of base register on to the memory location 00100000 (0x20H). e. JUMP unit The JUMP unit is designed to perform JMP, JNZ, and JEQ instructions. It performs the jump in program memory. The jump address is specified as a part of instruction. The JMP is an unconditional jump instruction and JNZ and JEQ are conditional jump instruction. The maximum supported jump in program memory is 212. This unit works on the content of status of flag registers. The examples are JMP 0x020, JNZ 0x1FF, JEQ 0X2FF. In the instruction JMP 0x020 it jumps to the program memory location 0x020.For this instruction only the program counter (PC) value is substituted with jump address, and normal instruction fetch continuous. In the instruction JNZ0x1FF it jumps to the program memory location 0x1FF only the zero flag is in reset condition (active LOW). If the zero flag set then this instruction is not been executed. The instruction JEQ 0x2FF it jumps to the program memory location 0x2FF, only the zero flag is set. If the zero flag is low then this instruction is not been executed. register R0. The OUT instructions load the base register on to the port 00000001. All the ports are directly mapped to the first four locations in the data memory. g. SET_CLEAR unit The SET_CLEAR unit is used to perform bit setting and resetting of the specified register. This operation is done by specifying the bit position as a part of the instruction. The example is BS R0, 00000001. This instruction sets (high) the first position in the R0 register. Also BC R0, 00000000, this instruction resets (zero) the zeroth bit position in R0 register. h. NOP unit The NOP unit is used to perform the no operation. This operation used to wait the operation of the controller to 3 clock cycle. Only opcode is used as a part of the instruction. It doesn’t alter the content of any register. IV. SIMULATION RESULTS The proposed microcontroller is developed using VHDL and simulated using ModelSim 6.4SE. For simulation, place a piece of code on to the program memory and perform the simulation and verify the operations. Fig 11 shows the movement of an instruction MOV R2, 00000010. Fig 12 shows the movement of data from R2 to R1. Fig 11: MOV R2, 00000010 f. IN_OUT unit The IN and OUT instructions used for transferring data to and from the Input/output ports. The IN instruction stores the data from port to the base register R0. The OUT instruction stores the data on to the I/O port from base register R0.The address of ports are shown in Table 2. Table 2:- Port address The examples are IN 00000001, OUT 00000001.The IN instruction stores the status of the port 00000001 to the base Fig 12:- MOV R1, R2 431
  • 6. V. IMPLEMENTATION ON FPGA The proposed microcontroller is synthesized using ALTERA QUARTUS II software. Fig 13 shows the Register Transfer Level (RTL) view of proposed controller. The controller is implemented on ALTERA STRATIX II EP2S60F672C3N FPGA. Table 3 shows the device utilization of the proposed controller. VI. CONCLUSION In this paper, how to design an 8-bit microcontroller IP core is presented. We adopted a top-down method and uses VHDL to describe system. First we design each module independently and the uses a structural programming to obtain an IP core. This uses Harvard Bus architecture and most of the instructions are single machine cycle instructions. This controller supports 16 instructions. The proposed controller is implemented in System on Chip environment to work for a certain specific applications. The controller can support a maximum frequency of 253.8MHz. REFERENCES [1] [2] Fig 13:- RTL View- Proposed controller [3] [4] [5] [6] [7] Table 3: Device Utilization Mamun Bin Ibne Reaz, Md. Shabiul Islam, Mohd. S. Sulaiman,”A single clcok cycle MIPS RISC processor design using VHDL”. ICSE2002 Proc. 2002, Penang, Malaysia. pp 199–203. Mrs. Rupali S. Balpande, Mrs.Rashmi S. Keote,’’Design of FPGA based Instruction Fetch & Decode module of 32-bit RISC (MIPS)Processor’’. 2011 International Conference on Communication Systems and Network Technologies.pp 409–413. Enoch O Hwang , Digital Logic and Microprocessor Design with VHDL. 2005. Jan Gray, Building a RISC system in an FPGA: Part 1,2 & 3, Circuit Cellar. Magazine (http://www.circuitcellar.com), David A. Patterson, John L. Hennessy, Computer Organization & Design, Morgan Kaufmann Publishers, 1999. Chan, P, Mourad, S Digital Design Using Field Programmable Gate Arrays, Prentice-Hall, Inc. Englewood Cliffs, NJ, 1994]. Douglas L. Perry, VHDL, McGraw-Hill Companies, Inc.: Singapore, 1999. 432