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, Problem 4.55HW
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:
Combinational circuits and HCL expressions:
- The computational blocks are been constructed by accumulating several logic gates into network.
- The restrictions are been shown below:
- Each of input for logic gate should be connected to any one shown below:
- One of system inputs, that is recognized as primary inputs.
- Output connection for some element in memory.
- Output of some logic gate.
- Outputs obtained from more than two logic gates could not be linked together.
- The wire would be driven to different voltages.
- It can cause malfunction in circuit.
- The network should not have cycles.
- The loops in circuit can cause ambiguity in function
computed by network.
- The loops in circuit can cause ambiguity in function
- Each of input for logic gate should be connected to any one shown below:
- The “HCL” denotes a hardware control language that is used for describing control logic of different processor designs.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Th is exercise is intended to help you understand the relationship between forwarding, hazard detection, and ISA design. Problems in this exercise refer to the following sequence of instructions, and assume that it is executed on a 5-stage pipelined datapath:add r5,r2,r1lw r3,4(r5)lw r2,0(r2)or r3,r5,r3sw r3,0(r5)> If there is no forwarding or hazard detection, insert nops to ensure correct execution.> Repeat above step, but now use nops only when a hazard cannot be avoided by changing or rearranging these instructions. You can assume register R7 can be used to hold temporary values in your modifi ed code.> If the processor has forwarding, but we forgot to implement the hazard detection unit, what happens when this code executes?
By changing the return address for the call to echo, we can force the echo function to return to any instruction to continue execution. Below are the instructions of totally_hidden function. If we'd like the echo function to return to the beginning of the totally_hidden function, what value should we change the return address into?
assembly code for function totally_hidden:
0x4005fe <+0>: push %rbp
0x4005ff <+1>: mov %rsp,%rbp
0x400602 <+4>: mov $0x4006c8,%edi
0x400607 <+9>: callq 0x4004d0 <puts@plt>
0x40060c <+14>: pop %rbp
0x40060d <+15>: retq
For our simple 2-stage pipeline, we run a particular benchmark program and find that it has 19% conditional branches. An additional 4% are unconditional branches. What is the maximum number of the conditional branches that could be taken if we want to keep the CPI to 1.10 or less? what is the minimum percentage of branch delay slots that need to be filled with useful instructions in order to keep the CPI to 1.0135?
I know other students have posted similar questions and they are answered, but those answers do not seem correct, so please do not copy from them
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
- What happens if VA page 30 is written even if an instruction was not accepted? An instance of a software-managed TLB would outperform a hardware-managed TLB in the following cases: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_forwardIn this exercise we compare the performance of 1-issue and 2-issue processors, taking into account program transformations that can be made to optimize for 2-issue execution. Problems in this exercise refer to the following loop(written in C):for(i=0;i!=j;i+=2)b[i]=a[i]–a[i+1];When writing MIPS code, assume that variables are kept in registers as follows, and that all registers except those indicated as Free are used to keep various variables, so they cannot be used for anything else. i j a b c Free R5 R6 R1 R2 R3 R10,R11,R12 Translate this C code into MIPS instructions. Your translation should be direct, without rearranging instructions to achieve better performance.arrow_forward
- can you please fix the code to resolve the error:Oh no! You've got an error in your assembly code and meet the requirements: at line 5: expected GETC instruction to have exactly 0 operands, but found 2 .ORIG x3000 ; Define constantsBLANK .FILL x0020 ; Blank characterGETC .FILL x20B0 ; GETC trap codePUTS .FILL x22A0 ; PUTS trap codeHALT .FILL x25C0 ; HALT trap code ; Define variablesARRAY .BLKW #20 ; Array to store user inputsN .FILL #0 ; Size of the arrayCOUNT .FILL #0 ; Loop counterINPUT .FILL #0 ; User input ; Prompt messagePROMPT .STRINGZ "Enter a number (0 to 9): " ; Start of program LD R0, N ; Load the size of the array into R0 ADD R0, R0, #-1 ; Subtract 1 from the size to use as a loop counter ADD R0, R0, R0 ; Multiply the loop counter by 2 (each entry is 2 bytes) LOOP LEA R1, PROMPT ; Load the address of the prompt message into R1 PUTS ; Display the…arrow_forwardFor our simple 4-stage RISC pipeline, we run a particular benchmark program and find that it has 19% conditional branches. An additional 4% are unconditional branches. What is the maximum number of the conditional branches that could be taken if we want to keep the CPI to 1.10 or less? what is the minimum percentage of branch delay slots that need to be filled with useful instructions in order to keep the CPI to 1.0135? Assume that f2n= 0.25 ×f1n. In other words, whatever percentage of instructions need justa single NOP, there is another 25% of that requiring two NOPs.arrow_forwardDescribe the implementation of the TestandSet instruction. Show how the followingalgorithm using TestandSet does not satisfy the bounded wait requirement?Shared data: boolean lock = false;Process Pi:do {while (TestAndSet(lock)) ;critical sectionlock = false;remainder section}arrow_forward
- We have a program of 10^6 instructions in the format of “lw,add,lw,add,…”. The add instruction depends only on the lw instruction right before it. The lw instruction also depends only on the add instruction right before it. If this program is executed on the 5-stage MIPS pipeline: a) Without forwarding, what would be the actual CPI? b) With forwarding, what would be the actual CPIarrow_forwardWhen we execute a program that contains a lot of if-statements or for/while-loops, the pipelineof Teletraan-2 faces a problem. The instruction fetch stage does not know which branch of theif-statement shall be fetched, until the write back stage writes the True/False value of the ifcondition to a flag register. What should we do to alleviate the problem?A. Don't wait. Let the CPU predict which branch will probably be executed, and fetch theinstruction(s) of that branch. If it is later revealed the prediction is wrong, undo theinstruction(s).B. Don't wait. Fetch-decode-execute the instructions of all branches of the if-statement.C. Nothing. We can only let the instruction fetch stage wait for the write back stage to finishwriting the value of the if-condition.D. Eliminate all if-statements during the assembly process.arrow_forwardConsider a HW ISA program P1 with the following Instruction Memory IM: Jamie wants to translate program P1 (except for the final HALT instruction) into a sequence of statements in a version of C with a 16-bit int type. Using the IM Fill in the rest of her program with assignments to variables named R2, R3, and R4 that represent the registers with these names in P1 and a while loop. int R0 = 0; int R1 = 1; int R2 = R0 + R0; // ...arrow_forward
- Can you plese fic this error and and other errors in the code using the LC3 simulator Oh no! You've got an error in your assembly code: at line 5: expected GETC instruction to have exactly 0 operands, but found 2 .ORIG x3000 ; Define constantsBLANK .FILL x0020 ; Blank characterGETC .FILL x20B0 ; GETC trap codePUTS .FILL x22A0 ; PUTS trap codeHALT .FILL x25C0 ; HALT trap code ; Define variablesARRAY .BLKW #20 ; Array to store user inputsN .FILL #0 ; Size of the arrayCOUNT .FILL #0 ; Loop counterINPUT .FILL #0 ; User input ; Prompt messagePROMPT .STRINGZ "Enter a number (0 to 9): " ; Start of program LD R0, N ; Load the size of the array into R0 ADD R0, R0, #-1 ; Subtract 1 from the size to use as a loop counter ADD R0, R0, R0 ; Multiply the loop counter by 2 (each entry is 2 bytes) LOOP LEA R1, PROMPT ; Load the address of the prompt message into R1 PUTS ; Display the prompt…arrow_forwardFor the problems in this exercise, assume that there are no pipeline stalls and that the breakdown of executed instructions is as follows: add addi not beq lw sw 20% 20% 0% 25% 25% 10% In what fraction of all cycles is the data memory used?In what fraction of all cycles is the input of the sign-extend circuit needed? What is this circuit doing in cycles in which its input is not needed?arrow_forwardWhat happens if VA page 30 is written if an instruction is not accepted? To summarize, a software-managed TLB would outperform a hardware-managed TLB in the following cases: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