Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1 . Objectives: To design and verify a simple pipelined RISC processor in Verilog 2 . Processor Specifications 1 . The instruction size and the
Objectives:
To design and verify a simple pipelined RISC processor in Verilog
Processor Specifications
The instruction size and the words size is bits
bit generalpurpose registers: from R to R
bit special purpose register for the program counter PC
bit special purpose register for the stack pointer SP which points to the topmost empty element of
the stack. This register is visible to the programmer.
The program memory layout comprises the following three segments:
i Data segment
ii Code segment
iii Stack segment. It is a LIFO Last in First out data structure. This machine has explicit instructions
that enables the programmer to pushpop elements onfrom the stack. The stack stores the
return address, registers values upon function calls, etc.
Four instruction types Rtype, Itype, Jtype, and Stype
Separate data and instructions memories
Byte addressable memory
Big endian byte ordering
You need to generate the required signals from the ALU to calculate the condition branch outcome
taken not taken These signals might include zero, carry, overflow, etc.
Page of
Instruction Types and Formats
As mentioned above, this ISA has four instruction formats, namely, Rtype, Itype, Jtype, and Stype. These four
types have a common bit opcode field, which determines the specific operation of the instruction
RType Register Type
Opcode Rd
Rs
Rs Unused
bit Rd: destination register
bit Rs: first source register
bit Rs: second source register
bit unused
IType Immediate Type
Opcode Rd
Rs
Immediate Mode
bit Rd: destination register
bit Rs: first source register
bit immediate: unsigned for logic instructions, and signed otherwise.
bit mode: this is used with loadstore instructions only, such that
: no incrementdecrement of the base register
: post increment the base register
: pre increment the base register
: post decrement the base register
For example:
lw Rd imm Rs # RegRd Memory RegRs signextendimm
Mode Value Action
lw Rd imm Rs # No incdec of the base register
LWPRI Rd imm Rs # load word preincrement
Before the address is sent to the memory, the base register is incremented
RegRs RegRs
It is incremented by four because lw loads one word and the word size is bytes
LWPOI Rd imm Rs # load word postincrement
After the address is sent to the memory, the base register is incremented
RegRs RegRs
LWPOD Rd imm Rs # load word postdecrement
After the address is sent to the memory, the base register is decremented
RegRs RegRs
Page of
JType Jump Type
This type includes the following instruction formats. The opcode is used to distinguish each instruction
jmp L # Unconditional jump to the target L
call F # Call the function F F is a label.
# The return address is pushed on the stack
The target address is calculated by concatenating the most significant bit of the current PC with the bit
offset
Opcode
Jump Offset
ret # return from a function.
# the next PC will be the top element of the stack
Opcode Unused
jr Rd # jump to the target address stored in the register Rd
call.r Rd # Call the function whose address is stored in the register Rd
Opcode Rsd
Unused
SType Stack
bit Rd: destination register
bit Rs: first source register
Opcode Rd
Rs Unused
push Rd # push one. push the value of Rd on the top of the stack
push.m Rd Rs # push many. Push the values of the registers in the range
#Rd to Rs in order on the top of the stack
pop Rd # pop one. Pop the stack and store the topmost element in Rd
pop.m Rd Rs # pop many. Pop the top Rs Rd elements from the
# stack, and store the values of these elements in the
# registers from Rd to Rs
# The topmost element is stored in Rd and so on
Page of
Instructions Encoding
For simplicity, you are required to implement a subset only of this processors ISA. The table below shows the
different instructions you are required to implement. It shows their type, the opcode value, and their meaning
in RTN Register Transfer Notation Although the instruction set is reduced, it is still rich enough to write useful
programs.
No Instr Meaning Opcode
Value
RType Instructions
AND RegRd RegRs & RegRs
ADD RegRd RegRs RegRs
SUB RegRd RegRs RegRs
OR RegRd RegRs I RegRs
IType Instructions
ANDI RegRd RegRs & Imm
ADDI RegRd RegRs Imm
LW RegRd MemRegRs Imm
LWPRI
RegRd MemRegRs Imm
RegRs RegRs
LWPOI
RegRd MemRegRs Imm
RegRs RegRs
LWPOD
RegRd MemRegRs Imm
R
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started