Skip to content

Implementation of a simple 5-stage 32-bit pipelined processor and its assembler using VHDL and Python

License

Notifications You must be signed in to change notification settings

njokdan/32-bit-risc-pipelined-processor

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Logo

32-bit Pipelined Processor Implementation

Implementation of a simple 5-stage 32-bit pipelined RISC processor and its assembler using VHDL and Python

Table of Contents

About The Project

The processor in this project has a RISC-like instruction set architecture. There are eight 4-byte general purpose registers, R​0​, till R7. Another two general purpose registers, one works as program counter (PC) and the other works as a stack pointer (SP), and hence, points to the top of the stack. The initial value of SP is (​2^11-1​). The memory address space is ​4 KB of 16-bit ​width and is word addressable. The bus between memory and the processor is 16-bit widths for instruction cache and 32-bit widths for data cache. When an interrupt occurs, the processor finishes the currently fetched instructions (instructions that have already entered the pipeline), then the address of the next instruction (in PC) is saved on top of the stack, and PC is loaded from address [2-3] of the memory (the address takes two words). To return from an interrupt, an RTI instruction loads PC from the top of stack, and the flow of the program resumes from the instruction after the interrupted instruction.

Assembler

A program written in Python that compiles sample assembly programs and generate the equivalent machine code hex files to be loaded into the CPU memory.

Running:

Open a terminal in the Assembler directory, then write the following command:

./assembler.exe "<.asm file relative path>"

Example:

./assembler.exe "test cases/Branch.asm"

Common Circuitry

The Common directory contains components that are used in most if not all the processor stages.

Data Hazard Detection Unit:

data-hazard-detection-unit

Fetching Stage

Dynamic Branch Fetching:

dynamic-branch-fetch

Register Fetching:

fetching-reg-fetch

Interrupt Fetching:

interrupt-fetch

PC Fetching:

pc-fetch

Decoding Stage

Control Unit Decoder:

control-unit-decode

Register File Decoder:

reg-file-decode

Execution Stage

ALU Execution:

alu-execute

Branch Detection Unit:

branch-detection

Memory Stage

sp-memory

Write Back Stage

write-back

Built With

Contributors

About

Implementation of a simple 5-stage 32-bit pipelined processor and its assembler using VHDL and Python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • VHDL 66.4%
  • Stata 18.0%
  • Python 9.3%
  • Assembly 6.3%