You are on page 1of 7

IJRET: International Journal of Research in Engineering and Technology eISSN: 2319-1163 | pISSN: 2321-7308

DESIGN & SIMULATION OF A 32-BIT RISC BASED MIPS


PROCESSOR USING VERILOG

Priyavrat Bhardwaj1, Siddharth Murugesan2


1
Department of Electrical & Electronics Engineering, Guru Tegh Bahadur Institute of Technology, New Delhi, India
2
Department of Electrical & Electronics Engineering, Guru Tegh Bahadur Institute of Technology, New Delhi, India

Abstract
This research paper presents design & simulation of a high performance five stage pipelined 32-bit Microprocessor without
Interlocked Pipeline Stages (MIPS),which is a Reduced Instruction Set Computing (RISC) architecture based processor. The
purpose of RISC microprocessor is to execute a minuscule batch of instructions, with the intention of proliferating the celerity of
the processor. This processor was designed with5 phases of pipeline in particular Instruction Fetch (IF), Instruction Decode&
Register Fetch (ID), Execution& Address Calculation (EX), Memory Access (MEM) and Write Back (WB) modules. The designing
process was done using a myriad of modules which are the ALU, Control Unit, Program Counter, MUX, Instruction Memory,
Data Memory, CPU, Register File, Sign Extension. The designing of this processor is developed using the Hardware Description
Language (HDL) - Verilog in ModelSim simulator. The supreme aim of this paper is to develop the RTL logic design using Xilinx
tool.

Keywords- MIPS, RISC, CISC, Verilog, RTL, ModelSim, Xilinx


---------------------------------------------------------------------***---------------------------------------------------------------------

1. INRODUCTION instruction set to load data from the memory and store
instruction set to Write Back (WB) the data into memory
Microprocessors & Microcontrollers are generally designed without any instructions [1].
in the vicinity of two main computer architectures: Complex
Instruction Set Computing i.e. CISC architecture and
2. MIPS INSTRUCTION SET ARCHITECTURE
Reduced Instruction Set Computing i.e. RISC architecture.
The concept of CISC is based on Instruction Set The instruction set can be categorized under three
Architecture (ISA) design that redoubles performing further classifications in the MIPS ISA, these are: Register type (R),
with several instructions utilizing changeable number of Immediate type (I) and Jump type (J). Each instruction starts
operands and an out spread variation of addressing modes in with a 6-Bit Opcode. Alongside these opcode, Register type
disparate locations in its Instruction Set. Thus causing them (R)define 3 (three) registers, Immediate ype (I) instructions
to have varying execution time and lengths thereby define2 (two)registers and a 16Bitevaluation; Jump type (J)
authoritatively mandating an intricate Control Unit, which instructions have an opcode of 26Bit[1].
inhabits an immensely existent region on the chip.
Compared with their CISC analogue, RISC processors The following table demonstrates the three formats used for
typically support a minuscule set of instructions. A display the MIPS core instruction set architecture:
that juxtaposes RISC processor with CISC processor, the
number of instructions in a RISC Processor is low while the Table 1
number of general purpose registers, addressing modes,
fixed instruction length and load-store architecture is more
this in turn facilitates the execution of instructions to be
carried out in a short time thus achieving higher overall
performance [1].

Currently, the efficacy of the RISC processors is generally


accepted to be greater than that of their CISC counterparts.
Before their execution the instructions are translated into
RISC instructions in even the most popular CISC
processors. The attributes mentioned above accentuate the
design strength of RISC in the market for embedded systems
known as "system-on-a-chip (SoC)"[12]. The premier micro
processors exhibiting reduced instruction set are SPARC,
ARM, MIPS and IBM's PowerPC. RISC processor typically
has load store architecture. This denotes there are two
instructions for accessing memory which are a load
_______________________________________________________________________________________________
Volume: 05 Issue: 11 | Nov-2016, Available @ http://ijret.esatjournals.org 166
IJRET: International Journal of Research in Engineering and Technology eISSN: 2319-1163 | pISSN: 2321-7308

2.1 Register (R) Type Instructions:


Fig. 2 illustrates Register (R) type Instructions Data path
[1]. Its main usage is in performing mathematical operations
such as addition and subtraction. E.g. add Rd, Rs, Rt. In this
the value received by Rd is the signed addition of Rs and Rt
Fig. 1. Register-Type Instructions i.e. Rs plus (+) Rt.

The instruction format illustrated in Fig. 1.is that of Register 2.2 Immediate (I) Type Instructions:
(R) Type. In it the Opcode is represented by the last 6 bits.
The 3 register types on which the operations are executed
are Rs, Rt and Rd which are represented in the above
illustration by 15-bits that follow the Opcode. The starting Fig. 3. Immediate Type Instructions
or the source registers are Rs andRt while the ending or
target register is Rd. Succeeding 5-bits are the shift sum Immediate (I) type instructions are demonstrated in Fig.3.
which betokens the number of bits that are to be moved. The The four fields portrayed in this type of arrangement
final 6-bits represent the function field points to the function represent - the Opcode, which is of 6-bitthat is utilized to
which are to be executed on the registers. select the Instruction type, storing of data is done in the
Source Register and Target Registers which are Rs and Rt
respectively. Each are of 5-Bit. The final 16-bit
Address/Immediate Valuefield wielding prompt data.

Fig. 2. Register Type Instructions Data Path

Fig. 4. Data Path for Immediate (I) type instructions

Fig. 4 delineates the data path for Immediate (I) type 2.3 Jump (J) type Instructions (Branch Format)
instruction [1]. It demonstrates the dichotomy of Rt register
which can be used both as a source and a destination. The
immediate value received by sign extend is represented by
the last 16-bits which is then sent to the Arithmetic and Fig. 5. Jump Type Instructions
Logical Unit for playing out the desired function.

_______________________________________________________________________________________________
Volume: 05 Issue: 11 | Nov-2016, Available @ http://ijret.esatjournals.org 167
IJRET: International Journal of Research in Engineering and Technology eISSN: 2319-1163 | pISSN: 2321-7308

The instruction format shown in Fig. 5. is that of Branch


Type [1]. The two fields illustrated in this arrangement type
are the Opcode which is of 6-bit, utilized to choose the kind
of instruction organization and Ending or Target address of
26-bit, utilized to determine where the address has to be
branched.

Fig. 6. Data Path for Jump Type Instructions Fig. 7. Basic MIPS Architecture

The data path for Jump (J) type instruction is illustrated in Microprocessor without Interlocked Pipeline Stages (MIPS)
Fig. 6.[1]. The figure demonstrates that a 32-bit jump (J) is a RISC (Reduced Instruction Set Computing) architecture.
address is obtained when the last 4 bits of PC + 4 are Pipelined MIPS has five stages which are IF, ID, EX, MEM
and WB. Pipelining means several operations in single data
attached to the shift left by 2 values of a 26-bit instruction
path at the same instant. Pipelining is used to enhance the
captured out from MEM. In addition, it jumps to the capabilities of the RISC processor which is the reason for its
destination by omitting any alternate instruction. utilization in this type of computer architecture. A
multicycle CPU comprises of countless tasks. So if one task
3. MIPS ARCHITECTURE occurs, rather than waiting for the process to finish, at the
same time another task is initiated in the same data path
The accompanying outline demonstrates the fundamental
simultaneously without interfering with the previous task.
architecture of a MIPS-based framework: The processes is thus divided into different pipelined stages.
Following every clock a new operation is instigated in the
pipeline stage to which the process is being fed to. The
triggering is done without causing any interruptions to the
past process. This makes simultaneous utilization of all
stages in the data path possible. This thusly can increment
the throughput of MIPS.

Fig. 8. 5-Stage Pipelined MIPS


_______________________________________________________________________________________________
Volume: 05 Issue: 11 | Nov-2016, Available @ http://ijret.esatjournals.org 168
IJRET: International Journal of Research in Engineering and Technology eISSN: 2319-1163 | pISSN: 2321-7308

MIPS processor has been executed utilizing five pipeline data of ID stage is received from IF stage as shown in Fig.
stages, which are Instruction Fetch (IF), Instruction Decode 8.This decoding stage includes four different instructions:
(ID), Execution (EX), Memory access (MEM) and Write Register (R) type, Immediate (I)type, Jump (J) type and
Back (WB).The isolation of these stages is achieved by Input/Output (I/O) type instructions. Depending upon these
special registers known as pipeline registers. The aim of instructions the function will be performed utilizing above
these registers is to isolate the stages of the instructions so mentioned formats. Fig. 10. indicates Instruction Decode
that there is no inadmissible information because of various (ID) stage operation [22].
directions being executed all the while. They are named in
the middle of each of these: IF/ID Register, EX/MEM 3.3 Execute (EX)
Register and MEM/WB Register. The data path
demonstrated in Fig. 8. is that of the MIPS pipelined
processor.

3.1 Instruction Fetch (IF) Fig. 11. Execution Stage (EX) representation
The command relayed to the Program Counter (PC) to fetch
the instruction from the cache memory is what instigates the Following the Instruction Decoder(ID), the instructions are
primary pipelining operation of the IF stage. The storage of sent to execute stage(EXE or EX). Execute (EX) stage
PC and Instruction for the successive clock cycle is done in performs Arithmetic and Logical Unit (ALU) processes.
the IF/ID pipelined register as RAM (Random Access Execution of operations is the fundamental aspect of
Memory) Execute (EX) stage, for instance arithmetic operations such
as addition and difference and OR & AND. In particular,
EX/MEM pipelined register receives the result upon the
execution of specific instructions (i.e. FP ALU). Execute
stage representation is shown in Fig. 11. [22].

Fig. 9. IF Stage representation 3.4 Memory Access &Input/Output (MEM)


IF stage for the most part relies on upon PCs represent
value. On the basis of the PC value the processor gets the
instructions from the cache and followed by which the
Program Counter value is incremented by 1. Thus, the IF/ID
Fig. 12. Memory Access representation
register receives this information followed by which the
information is relayed to the decoder unit. The Instruction The storing and loading of values along with inputting and
Fetch (IF) stage operation has been represented in Fig. 9 outputting data from the processor is the primary function of
[22]. the memory access (MEM) stage. The outcome will be
dispatched to the WB stage in a scenario where the
3.2 Instruction Decoder (ID) instruction is neither memory nor IO instruction. After the
result is figured the primary function is to store the data
values in the destination register. The Memory Access
(MEM) stage operation is demonstrated in Figure 12 [22].

3.5 Write Back (WB)

Fig. 10. ID Stage representation


Fig. 13. Write Back representation
The Opcode is relayed to the decoder unit at the instant
when the instruction is obtained from the IF stage. As per Fig. 13., the Write-Back (WB) operation is the final
Instruction Decoder ID stage directs the controlling stage of the RISC based MIPS architecture which composes
command to the various units of the MIPS processor the result, store information and input data from and to the
examining the Opcode of the instructions. Thus the register file [22]. Writing the data that has been fetched from
procurement of data from the MIPS registers is carried out the MIPS register to the target register is the main aim of
by the Read register. The Branch unit is likewise this stage.
incorporated into Instruction Decoder (ID) stage. The Input

_______________________________________________________________________________________________
Volume: 05 Issue: 11 | Nov-2016, Available @ http://ijret.esatjournals.org 169
IJRET: International Journal of Research in Engineering and Technology eISSN: 2319-1163 | pISSN: 2321-7308

4. RESULT
4.1 RTL Design

Fig. 14. RTL Design view of RISC based MIPS Processor

As per the design, the Write-Back (WB) operation writes (IF) stage receives the Opcode from the ID unit which is
back the result, stores the information and inputs the then sent for execution in the EX stage. The instruction
information to the Register file and vice-versa. For instance, configuration chosen is dependent on the Opcode. The
the result is given by ADD Rd, Rs, Rt instructions. It is execution of the instruction in the EX stage occurs in
analogous to the Feedback operation in various engineering accordance with the assigned Opcode. Storage of Opcode to
systems. The Register Transfer Logic as illustrated in Fig. the memory and fetching it from the memory is the primary
14. is that of 32-Bit RISC based MIPS Processor [2]. It task of the memory unit.
contains Instruction decoder (ID) unit, Instruction Fetch (IF)
unit, memory unit (MEM) and execution unit (EX). In this 4.2 Simulation Result
process, the program counter (PC) is utilized while fetching
the Opcode from Instruction Fetch (IF) stage and sending The Resulting output waves of 5-staged pipelined MIPS
the code to Instruction Decode (ID) stage. Instruction Fetch RISC processor is shown below:

_______________________________________________________________________________________________
Volume: 05 Issue: 11 | Nov-2016, Available @ http://ijret.esatjournals.org 170
IJRET: International Journal of Research in Engineering and Technology eISSN: 2319-1163 | pISSN: 2321-7308

Control and Computing Teclmologies (ICACCCT),


2014 IEEE.
[2] Pranjali S. Kelgaonkar, Prof. ShilpaKodgire, Design
of 32 Bit MIPS RISC Processor Based on Soc,
International Journal of Latest Trends in Engineering
and Technology (IJLTET), January 2016.
[3] Ramandeep Kaur, Anuj, 8 Bit RISC Procesor Using
Verilog HDL, Int. Journal if Engineering Research
and Applications, March 2014.
[4] PreetamBhosle, Hari Krishna Moorth, FPGA
Implementation of low power pipeline 32-bit RISC
Proessor, International Journal of Innovative
Technology and Exploring Engineering (IJITEE),
Fig. 15 (a). Output Wave Simulation August 2014.
[5] Gautham P, Parthasarathy R, Karthi, Balasubramanian,
Low Power Pipelined MIPS Processor Design, in the
proceedings of the 2009, 12th international symposium,
2009 pp. 462-465.
[6] Neenu Joseph, Sabarinath S, FPGA based
Implementation of High Performance Architectural
level Low Power 32-bit RISC Core, 2009 IEEE.
[7] Computer Organization and Design- the
hardware/software interface, 3rd edition by David A.
Patterson and John L. Hennessy, pp. 370-412.
Fig. 15 (b). Output Wave Simulation [8] Mrs. RupaliBalpande, Mrs. RashmiKeote, Design of
FPGA based Instruction Fetch & Decode Module of
32-bit RISC (MIPS) Processor, International
Conference on Communication Systems and Network
Technologies, 978-0-7695-4437-3/11, 2011 IEEE.
[9] Harpreet Kaur, Nitika Gulati, Pipelined MIPS with
Improved Datapath, IJERA, Vol. 3, Issue 1, January
February 2013, pp. 762-765.
[10] Sharda P. Katke, G.P. Jain,"Design and Implementation
of 5 Stages Pipelined Architecture in 32 Bit RISC
Procesor, IJETAE, Volume 2, Issue 4, April 2012, pp.
340-346.
[11] PejmanLotfi-Kamran, Ali-Asghar, ZainalabedinNavabi,
Dynamic Power Reduced of Stalls in Pipelined
Fig. 15 (c). Output Wave Simulation Architeture Processors, International Journal of
Design, Analysis and Tools for Circuits and Systems,
As illustrated in the waveforms, Fig. 15 (a), (b) and (c) Vol. 1, No. 1, June 2011.
demonstrates simulation result for R-type, I-type & J-type [12] Neeraj Jain, VLSI Design and Optimized
instruction formats. Implementation of a MIPS RISC Procesor using
XILINX Tool, International Journal of Advancd
5. CONCLUSION Research in Computer Science and Electronics
Engineering (IJARCSEE) Volume 1, Issue 10,
This research paper outlines a 32-bit Microprocessor without December 2012.
Interlocked Pipeline Stages (MIPS) based RISC processor is [13] Mamun Bin IbneReaz, MEEE, Md. Shabiul Islam,
executed effectively with pipelining. In a five stage MEEE, Mohd. S. Sulaiman, MEEE, A Single Clock
pipelining system the execution of each direction occurs in a Cycle MIPS RISC Processor Design using VHDL,
single clock cycle. This design demonstrates the usage of ICSE2002 Proc. 2002, Penang, Malaysia, 0-7803-7578-
MIPS based CPU equipped for taking care of different S/02/S, 2002 IEEE.
Register type, Jump type and Immediate type of instructions [14] Kui YI, Yue-Hua DING, 32-bit RISC CPU Based on
and each of these classifications has a diverse configuration. MIPS Instruction Fetch Module Design, 2009
International Joint Conference on Artificial
REFERENCES Intelligence, 978-0-7695-3615-6/09, 2009 IEEE.
[15] Rohit Sharma, Vivek Kumar Sehgal, Nitin Nitin1,
[1] Mohit N. Topiwala, N. Sarawathi, Implementation of Pranav Bhasker, IshitaVerma, Design and
a 32-bit MIPS Based RISC Processor using Cadence, Implementation of a 64-bit RISC Processor using
International Conference on Advanced Communication VHDL, UKSim 2009: 11th International Conference on

_______________________________________________________________________________________________
Volume: 05 Issue: 11 | Nov-2016, Available @ http://ijret.esatjournals.org 171
IJRET: International Journal of Research in Engineering and Technology eISSN: 2319-1163 | pISSN: 2321-7308

Computer Modelling and Simulation, 978-0-7695-


3593-7/09, 2009 IEEE.
[16] Pravin S. Mane, Indra Gupta, M. K. Vasantha,
Implementation of RISC Processor on FPGA, 1-
4244-0726-5/06, 2006 IEEE.
[17] Shuchita Pare, Dr. Rita Jain, 32Bit Floating Point
Arithmetic Logic Unit ALU Design and Simulation,
Dec 2012, IJETECS. Bai-ZhongYing, Computer
Organization, Science Press, 2000.11.
[18] Wang-AiYing, Organization and Structure of
Computer, TsinghuaUniversity Press, 2006.
[19] Wang-Yuan Zhen, IBM-PC Macro Asm Program,
Huazhong Universityof Science and Technology Press,
1996.9.
[20] MIPS Technologies, Inc. MIPS32 Architecture For
ProgrammersVolume II: The MIPS32 Instruction Set
June 9, 2003.
[21] Zheng-WeiMin, Tang-ZhiZhong, Computer System
Structure (Thesecond edition), Tsinghua University
Press, 2006.
[22] Mr. Sagar P. Ritpurkar, Prof. Mangesh N. Thakare,
Prof. Girish D.Korde, Review on 32Bit MIPS RISC
Processor using VHDL,International Conference on
Advances in Engineering & Technology 2014
(ICAET-2014), PP 46-50, IOSR.
[23] PowerPC 755/745 RISC Microprocessor 2013
datasheet, e2vsemiconductors SAS.
[24] AM1806 ARM Microprocessor 2014 datasheet,
TEXASINSTRUMENTS.
[25] AM1808 ARM Microprocessor 2014 datasheet,
TEXASINSTRUMENTS.
[26] ADSP-BF592 Blackfin Embedded Processor 2013
datasheet, AnalogDevices.
[27] Sitara AM335x ARM Cortex-A8 Microprocessors
(MPUs) 2013datasheet, TEXAS INSTRUMENTS.
[28] MPC7457 RISC Microprocessor 2013 datasheet,
FreescaleSemiconductor.
[29] STM32F205xx, STM32F207xx 2013 datasheet,
STMicroelectronics.

_______________________________________________________________________________________________
Volume: 05 Issue: 11 | Nov-2016, Available @ http://ijret.esatjournals.org 172

You might also like