VHDL Implementation of A Mips-32 Pipeline Processor
VHDL Implementation of A Mips-32 Pipeline Processor
11 (2012)
© Research India Publications; http://www.ripublication.com/ijaer.htm
1
Kirat Pal Singh, 2Shivani Parmar
1,2
Assistant Professor
1,2
Electronics and Communication Engineering Department
1
SSET, Surya World Institutions of Academic Excellence, Bapror, Rajpura, Punjab, India
2
Sachdeva Engineering College for Girls, Gharuan, Punjab, India
Email: [email protected], [email protected]
program counter was controlled by the hazard detection unit in with some information about the output – whether it is zero or
the instruction decode stage. negative. This was accomplished by a large case statement
dependent on the input control signals.
The Decode Stage is the stage of the CPU's pipeline where
the fetched instruction is decoded, and values are fetched from The determine Branch object is responsible for looking at
the register bank. It is responsible for mapping the different the output of the alu, and the type of instruction it is decoding,
sections of the instruction into their proper representations and determining whether the system is to branch or not. For
(based on R or I type instructions). The Decode stage consists example, if the determine Branch unit sees a BEQ instruction;
of the Control unit, the Hazard Detection Unit, the Sign it will be looking at the 'is Zero' output of the ALU to
Extender, and the Register bank, and is responsible for determine branch success. The output of this unit is fed back to
connecting all of these components together. It splits the the decode stage's hazard detection unit.
instruction into its various parts and feeds them to the
corresponding components. Regisers Rs and Rt are fed to the The forwarding unit is responsible for choosing what input
register bank, the immediate section is fed to the sign extender, is to be fed into the ALU. It takes the input from the decode
and the ALU opcode and function codes are sent to the control stage, the value that the alu has fed to the Memory stage, and
the value that the Alu has fed to the write back stage, as well as
unit. The outputs of these corresponding components are then
clocked and stored for the next stage. the register numbers corresponding to all of these, and
determines if any conflicts exist. It will choose which of these
The Control unit takes the given Opcode, as well as the values must be sent to the ALU. For example, if one
function code from the instruction, and translates it to the instruction uses a value that was calculated in the previous
individual instruction control lines needed by the three instruction, the forwarding unit would ignore the basic input
remaining stages. This is accomplished via a large case value, and instead forward the output of the memory stage to
statement the input of the alu instead.
The hazard detection unit monitors output from the execute The Memory stage is responsible for taking the output of
stage to determine hazard conditions. Hazards occur when we the alu and committing it to the proper memory location if the
read a value that was just written from memory, as the value instruction is a store. The memory stage contains one
won't be available for forwarding until the end of the memory component: the data_memory object. It connects the data
stage, and when we branch. The hazard detection unit will memory to a register bank for the write back stage to read, and
introduce a stall cycle by replacing the control lines with 0s, also forwards on information about the current write back
and disabling the program counter from updating. When a register. This register's number and calculated value are fed
branch is detected the hazard detection unit will allow the PC back to the forwarding unit in the execute stage to allow it to
to write, but will feed it the branch address instead of the next determine which value to pass to the ALU.
counted value.
The data_mem object is a simulation of actual memory. It
The sign extender is responsible for two functions. It takes is a 1k block of cache that acts as data storage. This memory is
the immediate value and sign extends it if the current responsible for storing both words and bytes, so it must
instruction is a signed operation. It also has a shifted output for implement optional sign extension for bytes. It must handle
branches. both read and write operations as requested.
One of the primary pieces of data storage in the CPU is the The writeback stage is responsible for writing the
register bank contained within the instruction decode stage. calculated value back to the proper register. It has input
This bank of registers is directly reference from the MIPS control lines that tell it whether this instruction writes back or
instructions and is designed to allow rapid access to data and not, and whether it writes back ALU output or Data memory
avoid the use of much slower data memory when possible. The output. It then chooses one of these outputs and feeds it to the
register bank contained in the CPU consisted of the MIPS register bank based on these control lines.
standard 32 registers with register 0 being defined as always
zero. The registers are defined as being written in the first half IV. SIMULATION RESULTS
of the cycle and read in the second half. This is done to avoid For simulation, a number of instructions were fed into the CPU
structural hazards when one instruction is attempting to write to and the outputs of registers 0 through 5 were monitored. The
the register bank while another is reading it. Setting the instructions that were tested included register based and
register bank to this configuration also avoids a data hazard immediate adds, subtracts (both signed and unsigned),
because a value that was just written can be read out in the multiplication (signed and unsigned), reading and writing data
same cycle. memory, and a loop that would force the CPU to jump back to
The execute stage is responsible for taking the data and the start of instruction memory and execute those same
actually performing the specified operation on it. The execute instructions again. The different adds were important because
stage consists of an ALU, a Determine Branch unit, and a each exercised different parts of the CPU including the data
Forwarding Unit. The execute stage connects these forwarding unit, multiple registers and different functions
components together so that the ALU will process the data within the ALU itself. The multiply instruction was also
properly, given inputs chosen by the forwarding unit, and will significant in that it proved that the instruction itself worked
notify the decode stage if a branch is indeed to be taken. but also that the MFHI and MFLO registers within the ALU
could be read and written to properly for the storing and
The alu is responsible for performing the actual calculations reading of the 64 bit resultant. The jump instruction was very
specified by the instruction. It takes two 32 bit inputs and important also in that it exercised the branch detection unit,
some control signals, and gives a single 32 bit output along hazard detection unit as well as the ability of the instruction
International Journal of Applied Engineering Research, ISSN 0973-4562 Vol. 7 No.11 (2012)
© Research India Publications; http://www.ripublication.com/ijaer.htm
fetch stage to be able to jump to an address and continue Table 1. Area and speed
execution with only the input of a single stall cycle. The Module Area(nm2 Speed (ns)
simulation results can be seen in figures 6, 7 and 8. )
V. CONCLUSION
MIPS processor is widely used RISC processor in industry and
research area. In this paper, we have successfully designed and
synthesized a basic model of pipelined MIPS processor. The
design has been modeled in VHDL and functional verification
policies adopted for it. The simulation results show that
Figure 8. Simulation Waveform maximum frequency of pipeline processor is increased from
100MHz to 200MHz.
This was then synthesized using Design Compiler. A clock
speed of 200 MHz was achieved, along with an area of VI. FUTURE WORK
896546.44 nm2. See Table 1. This paper presents a comparative performance analysis and
finding longer path delay at different pipeline stages using
different technologies device. Our future work includes
changing the processor architecture to make it capable of
handling multiple threads and supporting network security
application more effectively.
International Journal of Applied Engineering Research, ISSN 0973-4562 Vol. 7 No.11 (2012)
© Research India Publications; http://www.ripublication.com/ijaer.htm
VII. REFERENCES