Skip to main content

RTL Design & Implementation of a RISC- Single Cycle Processor -Part I

  Low cost FPGA development platforms and Hardware Description Languages like Verilog & VHDL have not only made lives of Front-end VLSI  Engineers easier but also hobbyists' . I have been experimenting with a 40$ Xilinx FPGA development board for couple of years and its real fun. And now, a part of my project for ASIC Design Lab course at University of Minnesota requires me to design and implement a microprocessor. Armed with my FPGA board and a new-found enthusiasm amidst my busy schedule at the U of M, I sat up to design a minimalistic CPU in Verilog.

Tools Used:

  1. Verilog/VHDL Simulator (ModelSim, Icarus Verilog, Xilinx ISE,etc)
  2. A decent Code Editor (VIM)
  3. A Xilinx FPGA board (optional)

ARCHITECTURE:

  I chose Load/Store Architecture for my microprocessor design since most RISC machines like ARM, MIPS,etc are based on this architecture. Besides that, quicker prototyping and better understanding of computer architecture was on top priority in my list in this project. And the design is loosely based on MIPS architecture since I designed a custom 16-bit Instruction Set Architecture similar to MIPS ISA.

  Let us see the partial implementation of the processor in this post and the rest will be posted in Part II.

FEATURES:

  1. 16-bit Reduced Instruction Set
  2. Integrated with peripherals like UART, TIMER, GPIO and Peripheral Multiplexer
  3. Planned Support of run-time programming (Doesn't require reprogramming the entire processor core)

BLOCKS USED:

  1. Program Counter
  2. Instruction Memory
  3. Register File
  4. ALU

BLOCK DIAGRAM:

  A simple view of the Processor architecture is shown here. Complete data paths and even components like data memory will be covered in Part II and thus are omitted here in the diagram for simplicity.


Program Counter:


  Program counter(PC) counts and generates the address of the memory where the next instruction is waiting to be executed. Here let us assume that the memory address range is 0-127. So we need a 7-bit counter to generate instruction addresses. A Logisim simulation of a positive edge triggered simple counter is shown below.


Instruction Memory and Register:

  Here for simplicity, instruction memory can store 128 16-bit wide instructions. And I have provided a write functionality to write into the instruction memory so that it can be programmed in run-time while running in the FPGA. And register file has 16 registers of 8-bit width each. When the address is generated and fed to the instruction memory by the program counter, the particular instruction is fetched. The register type instruction is has a opcode, two source registers and one destination register. Opcode determines the type of operation to be performed on the operands. for example, 0000 stands for add instruction.


ALU and CPU:

  For now, the ALU supports minimal instructions like ADD, SUB, AND, OR and NOT functions. More instructions like branch instructions, LOAD &  STORE will be discussed in part II. 


SIMULATION:

  The project is created in Xilinx ISE and simulated using ISIM simulator. Here a testbench is written to simulate an ADD instruction. The instruction is fetched, decoded and executed in single clock cycle. The waveforms are plotted below.


Rest of the modules, data path and support for branch instructions will be covered in Part II. 

Comments

Popular posts from this blog

Shell Scripting to Display Bar Graphs in Linux Terminal

 This week was quite hectic for me with course assignments and their merciless deadlines. One such assignment in Advanced Computer Architecture  was simulation of various benchmarks in alpha architecture in simplescalar , a well-known computer architecture simulator. I was supposed to run a total of 4 benchmarks with different configurations of cache memory, instruction issue widths, commit widths, in-order execution modes, etc and I had to plot the required performance parameters for every benchmark. A conservative estimate would be around 40 plots!  Since the simulation platform was Linux, I could breathe a sigh of relief since most things can be automated using a powerful tool called shell. Scripting made my life easier here since I can automate a bunch of simulations without having to keep an eye on each and every simulation which would take anywhere from 20 minutes to 20 hours.  The problem arose when it came to plotting the performance results. Because, each simulation

Programming STM32 ARM microcontrollers in Arch Linux

Once upon a time, not so long ago, the 8-bit microcontrollers were ruling the hobbyist embedded world. But today, the 32-bit ARM Cortex Microcontrollers are so inexpensive and power efficient that there is no good reason to ignore them. Here, let us see how to program a STM32 ARM cortex Microcontroller in Linux environment. The specific microcontroller used here is an STM32F103C8 (ARM cortex M3) programmed in Arch linux. Components Generic STM32F103 board (blue pill) STLINK-V2 (STM32 programmer) Female-Female connectors All the above components can be bought from ebay for less than $10 total. The STLINK-V2 is optional since you can use any of USB-SERIAL converters like FT232, CP2102, PL2303, CH340 and the built-in UART bootloader of STM32 chip to program. So if you already have any of the above serial converters, you don't really need STLINK to program the STM32F103 microcontroller. But STLINK helps if you plan to use in circuit debugging functionalities. Software The

JTAG - Test Access Port (TAP)Controller based Xilinx FPGA configuration using Raspberry Pi

JTAG - Joint Test Action Group is an IEEE 1149.1 standard used in many silicon devices for programming and debugging purposes. Xilinx FPGAs support this JTAG protocol for their configuration. Here I have designed a JTAG FPGA bitstream programmer using Raspberry Pi which programs the bit file into FPGA in fraction of seconds!  JTAG physical bus has four lines: TMS (Test Mode Select) TDI (Test Data In) TDO (Test Data Out) TCK (Test Clock) Components Used:  Raspberry-Pi Xilinx Spartan 3E FPGA (XC3S250E in Papilio One) Jumper wires BLOCK DIAGRAM: TAP CONTROLLER: The TAP(Test Access Port) controller is a state machine inside the FPGA which changes it's state based on TMS input. For instance, let us assume that the state machine is in " Test-Logic-Reset " state. Now if I drive the TMS pin low and toggle the TCK pin, the state machine will go to " Run-Test/ Idle " state. This is how we move to different states.  Note