Computer Systems: A Programmer's Perspective (3rd Edition)
3rd Edition
ISBN: 9780134092669
Author: Bryant, Randal E. Bryant, David R. O'Hallaron, David R., Randal E.; O'Hallaron, Bryant/O'hallaron
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Chapter 4.3, Problem 4.17PP
Program Plan Intro
Processing stages:
- The processing of an instruction has number of operations.
- The operations are organized into particular sequence of stages.
- It attempts to follow a uniform sequence for all instructions.
- The description of stages are shown below:
- Fetch:
- It uses program counter “PC” as memory address to read instruction bytes from memory.
- The 4-bit portions “icode” and “ifun” of specifier byte is extracted from instruction.
- It fetches “valC” that denotes an 8-byte constant.
- It computes “valP” that denotes value of “PC” plus length of fetched instruction.
- Decode:
- The register file is been read with two operands.
- It gives values “valA” and “valB” for operands.
- It reads registers with instruction fields “rA” and “rB”.
- Execute:
- In this stage the ALU either performs required operation or increments and decrements stack pointer.
- The resulting value is termed as “valE”.
- The condition codes are evaluated and destination register is updated based on condition.
- It determines whether branch should be taken or not in a jump instruction.
- Memory:
- The data is been written to memory or read from memory in this stage.
- The value that is read is determined as “valM”.
- Write back:
- The results are been written to register file.
- It can write up to two results.
- PC update:
- The program counter “PC” denotes memory address to read bytes of instruction from memory.
- It is used to set next instruction’s address.
- Fetch:
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
I. (14 points) The CPU shown below, with the same registers as the Very Simple
CPU (as shown in the "CPU Design" lecture notes), has the following instruction
set and state diagram. Show the RTL code for the execute cycles for each
instruction. Assume that the RTL code for the fetch routine is the same as that of
the Very Simple CPU. This problem will test your skill in developing RTL
statements of a given CPU behavior.
FETCHI
FETCH2
FETCH3
IR-00
IR=01
IR=10
IR=11
JMP11
INC21
ADD11
SKIP1
JMP12
INC22
ADD12
Instruction
Instruction
Operation
Code
PC←
JMP1
00AAAAAA
AAAAAA+1
INC2
01XXXXXX AC AC +2
AC AC+
ADD1
10AAAAAA MAAAAAA] +
1
SKIP
11XXXXXX PC PC +1
2. [4pts] Use the following C-Code for the problems below.
int recFunc (int a, int b) {
if (b
= 0)
==
return a;
else
return 1+recFunc (a, b-1);
a. Give the flowchart for the C-Code
b. Convert to MIPS assembly and comment each assembly instruction to indicate
corresponding C-Code.
Laboratory #1 (part 1) of programming and
application of the Assembler instruction set.
Exercise 1:
Design a program that determines the area of a rhombus and the
perimeter of a prism.
Note: Explain step by step and put comments on each line of code explaining what
each one does. Remember to make the code in assembler and NOT IN C.
Chapter 4 Solutions
Computer Systems: A Programmer's Perspective (3rd Edition)
Ch. 4.1 - Prob. 4.1PPCh. 4.1 - Prob. 4.2PPCh. 4.1 - Prob. 4.3PPCh. 4.1 - Prob. 4.4PPCh. 4.1 - Prob. 4.5PPCh. 4.1 - Prob. 4.6PPCh. 4.1 - Prob. 4.7PPCh. 4.1 - Prob. 4.8PPCh. 4.2 - Practice Problem 4.9 (solution page 484) Write an...Ch. 4.2 - Prob. 4.10PP
Ch. 4.2 - Prob. 4.11PPCh. 4.2 - Prob. 4.12PPCh. 4.3 - Prob. 4.13PPCh. 4.3 - Prob. 4.14PPCh. 4.3 - Prob. 4.15PPCh. 4.3 - Prob. 4.16PPCh. 4.3 - Prob. 4.17PPCh. 4.3 - Prob. 4.18PPCh. 4.3 - Prob. 4.19PPCh. 4.3 - Prob. 4.20PPCh. 4.3 - Prob. 4.21PPCh. 4.3 - Prob. 4.22PPCh. 4.3 - Prob. 4.23PPCh. 4.3 - Prob. 4.24PPCh. 4.3 - Prob. 4.25PPCh. 4.3 - Prob. 4.26PPCh. 4.3 - Prob. 4.27PPCh. 4.4 - Prob. 4.28PPCh. 4.4 - Prob. 4.29PPCh. 4.5 - Prob. 4.30PPCh. 4.5 - Prob. 4.31PPCh. 4.5 - Prob. 4.32PPCh. 4.5 - Prob. 4.33PPCh. 4.5 - Prob. 4.34PPCh. 4.5 - Prob. 4.35PPCh. 4.5 - Prob. 4.36PPCh. 4.5 - Prob. 4.37PPCh. 4.5 - Prob. 4.38PPCh. 4.5 - Prob. 4.39PPCh. 4.5 - Prob. 4.40PPCh. 4.5 - Prob. 4.41PPCh. 4.5 - Prob. 4.42PPCh. 4.5 - Prob. 4.43PPCh. 4.5 - Prob. 4.44PPCh. 4 - Prob. 4.45HWCh. 4 - Prob. 4.46HWCh. 4 - Prob. 4.47HWCh. 4 - Prob. 4.48HWCh. 4 - Modify the code you wrote for Problem 4.47 to...Ch. 4 - In Section 3.6.8, we saw that a common way to...Ch. 4 - Prob. 4.51HWCh. 4 - The file seq-full.hcl contains the HCL description...Ch. 4 - Prob. 4.53HWCh. 4 - The file pie=full. hcl contains a copy of the PIPE...Ch. 4 - Prob. 4.55HWCh. 4 - Prob. 4.56HWCh. 4 - Prob. 4.57HWCh. 4 - Our pipelined design is a bit unrealistic in that...Ch. 4 - Prob. 4.59HW
Knowledge Booster
Similar questions
- [Note: You are allowed to use only instructions implemented by the actual MIPS hardware provided in attached photos below. Use assembly language format from the references or the book. Note, base ten numbers are listed as normal (e.g. 23), binary numbers are prefixed with 0b and hexadecimal numbers are prefixed with 0x.] What is the single MIPS instruction, or if not possible, the shortest sequence of MIPS instructions that performs: 1. Move content of register r11 into register r23. 2. Load register r15 with the value 265,140. 3. Store the value 55,259 into a word at memory location 40000. 4. The equation a = b + c,assuming a, b and c are integer variables at memory location 0b10000000, 0b1001000 and 0b100010011100, respectively. 5. The equation y[5] = y[10] + x, assuming x corresponds to register r2, and y[1] is an integer at the memory location 524,292 is the first element of vector y. 6. The statement: if (a <= b) goto lab1, assuming that variable a corresponds to the word at…arrow_forwardQ2. Refer to datapath design on slide no. 26 with added blocks for jump instructions as shown inslide 33 in Chapter 4 (part 1). Let’s assume a program has 500 instructions. These instructions aredistributed as follows:R-Type Immediatearithmetic(addi)Load Store Branch Jump25% 5% 20% 20% 10% 20%Answer the following questions (show calculations):a) How many instructions will use instruction memory?b) How many instructions will use data memory?c) How many instructions will use the sign extend block?d) In the clock cycles, where the sign extend block is not required, does it remain idle? If yes,how? If not, what happens to the output of the block in that cycle? chapter 4, slide 33 is added as an image needed to solve the questionarrow_forwardComputer Science Consider the following comparison instruction:TST R0, R1, ASR #1 ; R0 = 0x12345678 and R1 = 0xDB97530F(i) Appraise the value of the condition flags (N, Z, C, V) after the execution of the instruction. Use the values of R0 and R1 provided in the instruction comment.(ii) The conditional branches are BHS, BLO, BLT and BPL. From the condition flag bits appraised in Question 2(b)(i), determine which of the above conditional branches will be executed.arrow_forward
- a) b) Explain the following machine independent optimization techniques. Common sub expression and dead code elimination Copy propagation, constant folding. Instruction scheduling.arrow_forwardQ1) Consider a simple traffic light system to regulate safe pedestrian crossing on a busy lane. Consider the following system requirement:(SysReq:)The traffic lights shall allow pedestrians to safely cross the lane by stopping cars together with the following software requirements: (SofReq1:)The light switch for pedestrians will be set to 'green' within x seconds after the pedestrian button has been pressed. (SofReq2:)The light switch for cars will be set to 'red' at least y seconds before the light switch for pedestrians is set to 'green'. Find missing environment assumptions and domain properties that are necessary to build the following satisfaction argument: {SofReq1, SofReq2, assumptions?, domain properties?} =SysReq Are the missing domain properties adequate? Are the missing assumptions realistic?arrow_forwardc) Instruction j Label is stored at 0x00400030, and Label is at instruction address 0x00400050. Encode this instruction and express your answer in hexadecimal. The opcode for the jump instruction is 000010. Answer: 08100014 d) We would like to load into register $s1 the decimal value 131077 (Note that 131072 = - 21"). Write a sequence of MIPS instructions to do that. Answer: lui $s2, 2 ori Ss2, $s2, 5arrow_forward
- i need ans very very fast in 20 min and thank you | ᴅʏʙᴀʟᴀ ?✨ | microprocessor 8085؛arrow_forwardsubject : computer architectures and organization (computer science)arrow_forwardQuestion 3 Execute the following instruction by the following SS and show the execution of A- Inorder Issue & In Order Completion B- Inorder Issue & Out of Order Completion Div / ADD / Sw Mul F0 , F2 , F4 Add F9 , F10 , FO Div F9, F23 , F25 Sub F19 , F15 , F9 Div F44 , F25 , F90 Sw F0 , 5(R1) Sub F13, F15 , F16 ai a2 a3 f1 di Other f2 d2 S2 elarrow_forward
- [2] ( Explain for each line why you chose a certain suffix such as b,w,l or q For each of the following lines of assembly language, determine the appropriate instruction suffix based on the operands. (For example, mov can be rewritten as movb, movw, movl, or movq.) mov mov mov που mov που Zeax, (%rap) (%rax), %dx $0xFF, %bl (%rap,%rdx, 4), %d1 (%rdx), %rax %dx, (%rax)arrow_forwardDO any part if do able A Instruction Set Architecture A.1 Instruction set We present a list of instructions typical of a RISC (reduced instruction set computer) machine. In data-movement and control instructions, the addresses may be immediate #X, direct (memory) M, indirect (memory) [M], register r, or register indirect [r] addresses. Data-processing instructions use immediate or register addressing. PC is the programme counter and a <- b indicates that the value of b is placed in a. LOAD a, b a <- b STOR a, b a <- b ADD a, b, c a <- b + c ASH a, b, c a <- (b >>[s] c) LSH a, b, c a <- (b >>[u] c) BR a PC <- a SUB a, b, c a <- b - c BEQ a, b, c PC <- a if b = c MUL a, b, c a <- b * c BNE a, b, c PC <- a if not b = c DIV a, b, c a <-…arrow_forward(c) The following Sigma 16 program has been loaded into memory at address 0000: load R3,y[RO] load R4,x[RO] lea R5, 2[RO] sub R1,R4,R3 mul R2,R1,R5 store R2,w[RO] trap RO,RO,RO x data 10 y data 12 w data 0 Show the content of the memory writing hexadecimal representation and using a table with 3 columns: the memory address, the contents of that memory address, and an explanation of what "the content (of that memory address) means". As a reference, here are the opcodes for RRR instructions: add 0, sub 1, mul 2, trap c. And here the opcodes for RX instructions: lea 0, load 1, store 2. [7]arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education