The RiSC-16 Instruction-Set Architecture

Similar documents
RiSC-16 Sequential Implementation

The Pipelined RiSC-16

Project 1: Assembler & Simple Verilog CPU (10%)

Project 2: Pipelining (10%) Purpose. Pipelines. ENEE 646: Digital Computer Design, Fall 2017 Assigned: Wednesday, Sep 6; Due: Tuesday, Oct 3

Project 1: Single-Cycle Verilog CPU (15%)

3. Instruction Set Architecture The MIPS architecture

Educational Simulation of the RiSC Processor

COMP303 - Computer Architecture Lecture 8. Designing a Single Cycle Datapath

Unsigned Binary Integers

Unsigned Binary Integers

Computer Architecture

CS 61C: Great Ideas in Computer Architecture Datapath. Instructors: John Wawrzynek & Vladimir Stojanovic

Chapter 4. The Processor. Computer Architecture and IC Design Lab

Name: University of Michigan uniqname: (NOT your student ID number!)

ECE170 Computer Architecture. Single Cycle Control. Review: 3b: Add & Subtract. Review: 3e: Store Operations. Review: 3d: Load Operations

361 datapath.1. Computer Architecture EECS 361 Lecture 8: Designing a Single Cycle Datapath

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: MIPS Instruction Set Architecture

CS3350B Computer Architecture MIPS Instruction Representation

Ch 5: Designing a Single Cycle Datapath

ECE 30 Introduction to Computer Engineering

CISC 662 Graduate Computer Architecture. Lecture 4 - ISA MIPS ISA. In a CPU. (vonneumann) Processor Organization

The MIPS Processor Datapath

LECTURE 5. Single-Cycle Datapath and Control

CISC 662 Graduate Computer Architecture. Lecture 4 - ISA

Data paths for MIPS instructions

Instructions: MIPS ISA. Chapter 2 Instructions: Language of the Computer 1

Computer Organization MIPS Architecture. Department of Computer Science Missouri University of Science & Technology

Pipeline design. Mehran Rezaei

MIPS Instruction Set

CPU Organization (Design)

MIPS ISA. 1. Data and Address Size 8-, 16-, 32-, 64-bit 2. Which instructions does the processor support

CS222: Processor Design

Computer Organization MIPS ISA

MIPS%Assembly% E155%

Instruction encoding. MIPS Instruction encoding

ENCM 369 Winter 2013: Reference Material for Midterm #2 page 1 of 5

Topic Notes: MIPS Instruction Set Architecture

The MIPS Instruction Set Architecture

The Assembly Language of the Boz 5

Stored Program Concept. Instructions: Characteristics of Instruction Set. Architecture Specification. Example of multiple operands

ISA and RISCV. CASS 2018 Lavanya Ramapantulu

ELEC 5200/6200 Computer Architecture and Design Spring 2017 Lecture 4: Datapath and Control

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: MIPS Instruction Set Architecture

COMPUTER ORGANIZATION AND DESIGN. 5 th Edition. The Hardware/Software Interface. Chapter 4. The Processor

ECE232: Hardware Organization and Design

CSE 378 Midterm 2/12/10 Sample Solution

Systems Architecture

Chapter 4. The Processor

bits 5..0 the sub-function of opcode 0, 32 for the add instruction

ECE232: Hardware Organization and Design. Computer Organization - Previously covered

A Processor. Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University. See: P&H Chapter , 4.1-3

Chapter 2A Instructions: Language of the Computer

CS31001 COMPUTER ORGANIZATION AND ARCHITECTURE. Debdeep Mukhopadhyay, CSE, IIT Kharagpur. Instructions and Addressing

UC Berkeley CS61C : Machine Structures

Processor design - MIPS

Outline. EEL-4713 Computer Architecture Designing a Single Cycle Datapath

CS 61C: Great Ideas in Computer Architecture. MIPS CPU Datapath, Control Introduction

Processor (I) - datapath & control. Hwansoo Han

Chapter 4. The Processor

CpE242 Computer Architecture and Engineering Designing a Single Cycle Datapath

MIPS PROJECT INSTRUCTION SET and FORMAT

Introduction to the MIPS. Lecture for CPSC 5155 Edward Bosworth, Ph.D. Computer Science Department Columbus State University

Computer Science and Engineering 331. Midterm Examination #1. Fall Name: Solutions S.S.#:

Course Administration

Math 230 Assembly Programming (AKA Computer Organization) Spring MIPS Intro

Instructions: Assembly Language

COMPSCI 313 S Computer Organization. 7 MIPS Instruction Set

Overview of the MIPS Architecture: Part I. CS 161: Lecture 0 1/24/17

SAM Architecture Reference (Revised)

are Softw Instruction Set Architecture Microarchitecture are rdw

Inf2C - Computer Systems Lecture 12 Processor Design Multi-Cycle

Mark Redekopp, All rights reserved. EE 357 Unit 11 MIPS ISA

Instructions: Language of the Computer

CSE 378 Midterm Sample Solution 2/11/11

COMPUTER ORGANIZATION AND DESIGN. 5 th Edition. The Hardware/Software Interface. Chapter 4. The Processor

EECS 151/251A Fall 2017 Digital Design and Integrated Circuits. Instructor: John Wawrzynek and Nicholas Weaver. Lecture 13 EE141

Rui Wang, Assistant professor Dept. of Information and Communication Tongji University.

Computer Organization. Structure of a Computer. Registers. Register Transfer. Register Files. Memories

The Big Picture: Where are We Now? EEM 486: Computer Architecture. Lecture 3. Designing a Single Cycle Datapath

Processor. Han Wang CS3410, Spring 2012 Computer Science Cornell University. See P&H Chapter , 4.1 4

ece4750-tinyrv-isa.txt

Chapter 4. Instruction Execution. Introduction. CPU Overview. Multiplexers. Chapter 4 The Processor 1. The Processor.

Part 1 (70% of grade for homework 2): MIPS Programming: Simulating a simple computer

ANNA Guide. by Dr. Eric Larson Seattle University. Acknowledgments... 2

Lecture 12: Single-Cycle Control Unit. Spring 2018 Jason Tang

Review. N-bit adder-subtractor done using N 1- bit adders with XOR gates on input. Lecture #19 Designing a Single-Cycle CPU

CS61C : Machine Structures

Part II Instruction-Set Architecture. Jan Computer Architecture, Instruction-Set Architecture Slide 1

Anne Bracy CS 3410 Computer Science Cornell University. See P&H Chapter: , , Appendix B

Microprogrammed Control Approach

CSEN 601: Computer System Architecture Summer 2014

Instruction Set Architecture. "Speaking with the computer"

ECE260: Fundamentals of Computer Engineering

REGISTER TRANSFER LANGUAGE

Programmable Machines

Digital Logic Design: a rigorous approach c

Introduction to Assembler Language Programming

Math 230 Assembly Programming (AKA Computer Organization) Spring 2008

Programmable Machines

Chapter 2. Instructions: Language of the Computer. Adapted by Paulo Lopes

Transcription:

The RiSC-16 Instruction-Set Architecture ENEE 646: Digital Computer Design, Fall 2002 Prof. Bruce Jacob This paper describes a sequential implementation of the 16-bit Ridiculously Simple Computer (RiSC-16), a teaching ISA that is based on the Little Computer (LC-896) developed by Peter Chen at the University of Michigan. 1. RiSC-16 Instruction Set The RiSC-16 is an 8-register, 16-bit computer. All addresses are shortword-addresses (i.e. address 0 corresponds to the first two bytes of main memory, address 1 corresponds to the second two bytes of main memory, etc.). Like the MIPS instruction-set architecture, by hardware convention, register 0 will always contain the value 0. The machine enforces this: reads to register 0 always return 0, irrespective of what has been written there. The RiSC-16 is very simple, but it is general enough to solve complex problems. There are three machine-code instruction formats and a total of 8 instructions. The instruction-set is given in the following table. Assembly-Code Format Meaning add rega, regb, regc R[regA] <- R[regB] + R[regC] addi rega, regb, immed R[regA] <- R[regB] + immed nand rega, regb, regc R[regA] <- ~(R[regB] & R[regC]) lui rega, immed R[regA] <- immed & 0xffc0 sw rega, regb, immed R[regA] -> Mem[ R[regB] + immed ] lw rega, regb, immed R[regA] <- Mem[ R[regB] + immed ] bne rega, regb, immed if ( R[regA]!= R[regB] ) { PC <- PC + 1 + immed (if label, PC <- label) } jalr rega, regb PC <- R[regB], R[regA] <- PC + 1 PSEUDO-S: nop halt do nothing stop machine & print state lli rega, immed R[regA] <- R[regA] + (immed & 0x3f) movi rega, immed R[regA] <- immed.fill immed.space immed initialized data with value immed zero-filled data array of size immed The instruction-set is described in more detail (including machine-code formats) in The RiSC-16 Instruction-Set Architecture. 1

2. RiSC-16 Instruction Control and Dataflow The following figures illustrate the flow of information for each of the instruction types for a simple sequential implementation a scaled-down version of which has been done in discrete logic (i.e. 4-bit TTL parts). A final figure will put all of the instructions together into one framework. Shaded boxes represent registers. Thick lines represent 16-bit buses. : 000 ra rb 0000 rc This figure illustrates the flow-of-control for the instruction. All three ports of the register file are used, and the write-enable bit () is set for the register file. The ALU control signal is a simple function. 2

I I: 001 ra rb simm-7 Sign-Extend-7 This figure illustrates the flow-of-control for the IMMEDIATE instruction. Only two ports of the register file are used; the second source operand comes directly from the instruction word. The write-enable bit is set for the register file. The ALU control signal is a simple function. The Sign-Extend-7 logic extends the sign of the immediate value (as opposed to simply adding zeroes at the top) and in so doing produces a two s complement number. The logic looks like this: I: 001 reg A reg B simm-7 (-64 to 63) OPERAND: 3

NAND NAND: 010 ra rb 0000 rc NAND This figure illustrates the flow-of-control for the BITWISE NAND instruction. All three ports of the register file are used, and the write-enable bit is set for the register file. The ALU control signal is a BITWISE NAND function. 4

LUI LLI: 011 ra imm-10 Left-Shift-6 PASS1 This figure illustrates the flow-of-control for the LOAD UPPER IMMEDIATE instruction. This instruction replaces the top ten bits of an instruction with ten bits found in the instruction word and zeroes out the bottom six bits. Only one port of the register file is used the write port as all of the bits destined for the register file are zero or come directly from the instruction word. The write-enable bit is set for the register file. Compared to I, the immediate-manipulation logic for LUI is slightly different; the logic for Left-Shift-6 looks like this: LUI: 011 reg A imm-10 (0 to 1023) ZERO OPERAND: The second argument to the ALU () is ignored; this is accomplished by setting the ALU control to be PASS1, which sends through the first argument unchanged. This same ALU control will be used for the JALR instruction as well. One could alternatively zero-extend the immediate value and use a SHIFT input to the ALU while inputting the value 6 at the other ALU-input. However, the illustrated mechanism seems slightly less complicated. 5

SW SW: 100 ra rb simm-7 DATA Sign-Extend-7 DATA R =0 This figure illustrates the flow-of-control for the STORE DATA WORD instruction. Only two ports of the register file are used; the register file s write port () is not used. The output port does not feed the ALU (as it normally does), but rather the DATA input of data memory. This is the value to be written to memory. The second ALU input is an immediate value that comes directly from the instruction word. The write-enable bit is set for data memory but not for the register file. The ALU control signal is a simple function. The result of the ALU goes to the R port of data memory, which responds by latching the data word at the specified address. Note that the ra field of the instruction, which is normally tied to the register file s specifier, is instead tied to the specifier. The Sign-Extend-7 logic extends the sign of the immediate value (as opposed to simply adding zeroes at the top) and in so doing produces a two s complement number. The logic looks like this: SW: 101 reg A reg B simm-7 (-64 to 63) OPERAND: 6

LW LW: 101 ra rb simm-7 DATA Sign-Extend-7 R =0 This figure illustrates the flow-of-control for the LOAD DATA WORD instruction. Only two ports of the register file are used; the second source operand comes directly from the instruction word. The write-enable bit is set for the register file but not for data memory. The ALU control signal is a simple function. The result of the ALU does not go to the register file but rather to the R port of data memory, which responds by reading out the corresponding data word. This value is stored in the register file. As in SW, the Sign-Extend-7 logic extends the sign of the immediate value (as opposed to simply adding zeroes at the top) and in so doing produces a two s complement number. LW: 100 reg A reg B simm-7 (-64 to 63) OPERAND: 7

BNE Sign-Ext-7 BNE: 110 ra rb simm-7 =0 BR EQ? EQ! This figure illustrates the flow-of-control for the BRANCH-IF-NOT-EQUAL instruction. Like STORE DATA WORD instruction, it does not write a result to the register file. Two values are read from the register file and compared. The ALU control signal is a request for a test of equality (labeled EQ? in the diagram). If the ALU does not support an equality test, a SUBTRACT signal can be used, as most ALUs do have a 1-bit output signal that indicates a zero-value result: the two combined produce the same results as an EQ signal. The result of the comparison determines which of two values are to be placed into the program counter. If the two values in the register file are equal, the value to be latched in the program counter is the sum PC + 1 (which is the normal program counter update value). If the two values read from the register file are NOT equal, the value to be latched in the program counter is the sum PC + 1 + (sign-extended immediate value) (note that the sign extension is just like in LW and SW). We have shown a small portion of the module: that portion controlling the PC mux. The choice between PC and PC+IMM is represented by an AND of the negated EQ! output of the ALU and a signal that represents CONDITIONAL BRANCH (i.e. the 3-bit opcode is BNE:110). Thus, if the opcode is a conditional branch and the two values are not equal, choose PC+IMM, otherwise choose PC. Note that the ra field of the instruction, which is normally tied to the register file s specifier, is instead tied to the specifier. 8

JALR JALR: 111 ra rb 0000000 PASS1 This figure illustrates the flow-of-control for the JUMP-AND-LINK-THROUGH-REGISTER instruction. This function uses two of the register file s three ports. A value is read from the register file and placed directly into the program counter, and the sum PC + 1 (which is normally latched into the program counter) is written to a specified register in the register file. The ALU signal is a PASS signal for the operand the ALU is instructed to perform no function, only pass the operand directly through. This value is written into the program counter. 9

Putting it All Together Sign-Ext-7 MUX tgt OP ra rb rc DATA OUT DATA MUX rf DATA IN R rf Left-Shift-6 Sign-Extend-7 dmem MUX alu2 MUX alu1 MUX pc FUNC alu EQ! This diagram combines all of the previous data and control paths into one complete framework. To accommodate all control and data paths, there are a number of muxes that choose the direction of data flow. These muxes are operated by the module, which depends on only two inputs: 1. the 3-bit OPCODE of the instruction; and 2. the 1-bit EQ! signal from the ALU (which, for the BNE instruction, indicates that the two operands are equal for all other instructions this signal is ignored). The module is essentially a decoder. It takes these input signals in and sets a number of outgoing signals that control the ALU, a host of multiplexers, and the write functions of the register file and data memory. At the beginning of every cycle, a new program counter value is latched, which causes a new instruction word to be read out and a new opcode to be sent to the 10

module. The module simply sets the control lines as appropriate for the instruction, and all of the control and data paths are set up: after delays through the register file, the ALU, the data memory, and the corresponding muxes, all of the signals stabilize. At this point, the newly produced values are latched (in the register file, the data memory and/or the program counter), and the new program counter causes a new instruction to be read from the instruction memory. These are the signals that the module exports: FUNC alu MUX alu1 MUX alu2 MUX pc MUX rf MUX tgt rf dmem This signal instructs the ALU to perform a given function. This 1-bit signal controls the mux connected to the input of the ALU. The mux chooses between the output of the register file and the left-shifted immediate value (to be used for LUI instructions). This 1-bit signal controls the mux connected to the input of the ALU. The mux chooses between the output of the register file and sign-extended immediate value (to be used for I, LW, and SW instructions). This 2-bit signal controls the mux connected the program counter. The mux chooses between the output of the ALU, the output of the adder that produces the sum PC on every cycle This 1-bit signal controls the mux connected to the register file s operand specifier, a 3-bit signal that determines which of the registers will be read out onto the 16-bit data output port. The mux chooses between the ra and rc fields of the instruction word. This 2-bit signal controls the mux connected to the register file s 16-bit data input port, which carries the data to be written to the register file (provided the writeenable bit of the register file is set). The mux chooses between the output of the ALU, the output of the data memory, and the output of the adder tied to the program counter. This 1-bit signal enables or disables the write port of the register file. If the signal is high, the register file can write a result. If it is low, writing is blocked. This 1-bit signal enables or disables the write port of the data memory. If the signal is high, the data memory can write a result. If it is low, writing is blocked. 11