Answered step by step
Verified Expert Solution
Link Copied!

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

1. Objectives:
To design and verify a simple pipelined RISC processor in Verilog
2. Processor Specifications
1. The instruction size and the words size is 32 bits
2.1632-bit general-purpose registers: from R0 to R15.
3.32-bit special purpose register for the program counter (PC)
4.32-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.
5. 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 push/pop elements on/from the stack. The stack stores the
return address, registers values upon function calls, etc.
6. Four instruction types (R-type, I-type, J-type, and S-type).
7. Separate data and instructions memories
8. Byte addressable memory
9. Big endian byte ordering
10. 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 2 of 7
3. Instruction Types and Formats
As mentioned above, this ISA has four instruction formats, namely, R-type, I-type, J-type, and S-type. These four
types have a common 6-bit opcode field, which determines the specific operation of the instruction
R-Type (Register Type)
Opcode6 Rd4
Rs14
Rs24 Unused14
4-bit Rd: destination register
4-bit Rs1: first source register
4-bit Rs2: second source register
14-bit unused
I-Type (Immediate Type)
Opcode6 Rd4
Rs14
Immediate16 Mode2
4-bit Rd: destination register
4-bit Rs1: first source register
16-bit immediate: unsigned for logic instructions, and signed otherwise.
2-bit mode: this is used with load/store instructions only, such that
00: no increment/decrement of the base register
01: post increment the base register
01: pre increment the base register
11: post decrement the base register
For example:
lw Rd, imm (Rs1) # Reg[Rd]= Memory [Reg[Rs1]+ sign_extend(imm)]
Mode Value Action
00 lw Rd, imm (Rs1) # No inc/dec of the base register
01
LW.PRI Rd, imm (Rs1) # load word pre-increment
Before the address is sent to the memory, the base register is incremented
Reg[Rs1]= Reg[Rs1]+4
It is incremented by four because lw loads one word and the word size is 4 bytes
10
LW.POI Rd, imm (Rs1) # load word post-increment
After the address is sent to the memory, the base register is incremented
Reg[Rs1]= Reg[Rs1]+4
11
LW.POD Rd, imm (Rs1) # load word post-decrement
After the address is sent to the memory, the base register is decremented
Reg[Rs1]= Reg[Rs1]-4
Page 3 of 7
J-Type (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 6-bit of the current PC with the 26-bit
offset
Opcode6
Jump Offset26
ret # return from a function.
# the next PC will be the top element of the stack
Opcode6 Unused26
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
Opcode6 Rsd
4 Unused22
S-Type (Stack)
4-bit Rd: destination register
4-bit Rs1: first source register
Opcode6 Rd4
Rs14 Unused18
push.1 Rd # push one. push the value of Rd on the top of the stack
push.m Rd, Rs1 # push many. Push the values of the registers in the range
#Rd to Rs1 in order on the top of the stack
pop.1 Rd # pop one. Pop the stack and store the topmost element in Rd
pop.m Rd, Rs1 # pop many. Pop the top (Rs1 Rd)+1 elements from the
# stack, and store the values of these elements in the
# registers from Rd to Rs1.
# The topmost element is stored in Rd, and so on.
Page 4 of 7
4. 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
R-Type Instructions
1 AND Reg(Rd)= Reg(Rs1) & Reg(Rs2)000000
2 ADD Reg(Rd)= Reg(Rs1)+ Reg(Rs2)000001
3 SUB Reg(Rd)= Reg(Rs1)- Reg(Rs2)000010
4 OR Reg(Rd)= Reg(Rs1) I Reg(Rs2)000011
I-Type Instructions
5 ANDI Reg(Rd)= Reg(Rs1) & Imm16000100
6 ADDI Reg(Rd)= Reg(Rs1)+ Imm16000101
7 LW Reg(Rd)= Mem(Reg(Rs1)+ Imm16
)000110
8
LW.PRI
Reg(Rd)= Mem(Reg(Rs1)+4+ Imm16
)
Reg[Rs1]= Reg[Rs1]+4
000111
9
LW.POI
Reg(Rd)= Mem(Reg(Rs1)+ Imm16
)
Reg[Rs1]= Reg[Rs1]+4
001000
10
LW.POD
Reg(Rd)= Mem(Reg(Rs1)+ Imm16
)
R

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Harness The Power Of Big Data The IBM Big Data Platform

Authors: Paul Zikopoulos, David Corrigan James Giles Thomas Deutsch Krishnan Parasuraman Dirk DeRoos Paul Zikopoulos

1st Edition

0071808183, 9780071808187

More Books

Students also viewed these Databases questions

Question

Define Management by exception

Answered: 1 week ago

Question

Explain the importance of staffing in business organisations

Answered: 1 week ago

Question

What are the types of forms of communication ?

Answered: 1 week ago