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
Implement a new unary instruction in place of N0P0 called ASL2 that does two left shifts on the accumulator. V should remain unchanged, but N and Z should correlate with the new value in the accumulator, and C should be the carry from the second shift. Write a program that tests all the features of the new instruction.
Write HCL code for the signal D_stall in the PIPE implementation.Pipeline register D must be set to bubble for a mispredicted branch ora ret instruction. As the analysis in the preceding section shows,however, it should not inject a bubble when there is a load/use hazardin combination with a ret instruction:bool D_bubble =# Mispredicted branch (E_icode == IJXX && !e_Cnd) ||# Stalling at fetch while ret passes through pipeline# but not condition for a load/use hazard!(E_icode in { IMRMOVQ, IPOPQ } && E_dstM in { d_srcA,d_srcB }) && IRET in { D_icode, E_icode, M_icode };
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…
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
- 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_forwardOur second task is to check the sign bit of a number. There are many ways to do this, but I want the least expensive method in terms of the number of instructions. This generally means avoiding the use of instructions that has immediate operands. To get to the instruction that we need to use, we first need to examine the ALU itself. Which flag (the corresponding ALU tunnel name in parentheses) in the ALU reflects the sign bit of the result of a computation regardless of the computation, with the exception of the instructions dec and inc? S (Sout) only add and subtract instructions affect S (Sout) O (Oout) C (Cout) B (Bout)arrow_forwardFor 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 themarrow_forward
- Write an ARM assembly program to check whether an N x N matrix is a magic square. A magic square is an N x N matrix in which the sums of all rows, columns, and the two diagonals add up to N(N + 1)/2. All matrix entries are unique numbers from 1 to N. If the matrix is a magic square, register RO will be set (i.e. all ones) upon completion; otherwise it will be cleared. Test the following matrix 16 5 9 4 3 10 6 15 2 11 7 14 13 8 12 1 Store the matrix element numbers in memory starting at location 0x20004000. Assume all numbers are Bytesarrow_forwardBy 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>: retqarrow_forwardDescription: Implement a transistor-level schematic of a computational unit/ALU that can perform the following operations. XOR ● XNOR Multiplication Addition Subtraction ● Rotate Shift Right Magnitude Comparator ● Equality Comparator The computational unit/ALU has a decoder to decode an instruction and a multiplexer to select outputs of different operations. Data inputs are 4-bit wide. Make sure you test your design for all the operations listed above.arrow_forward
- 5. Below is a depiction of a loop in instruction memory address Охо TOP: instruction 1 Ox4 instruction 2 Ox8 instruction 3 OxC instruction 4 Ох10 conditional branch to TOP Assume that the branch target buffer is initially empty, and the prediction bits are set to Strongly Taken (ST). Fill in the blanks On the first pass through the loop we take the branch. The branch target bits are now We suffer stalls. On the second pass through the loop we don't take the branch. The branch target bits are now We suffer stalls. On the third pass through the loop we don't take the branch. The branch target bits are now We suffer stalls. On the fourth pass through the loop we don't take the branch. The branch target bits are now We suffer stalls.arrow_forwardplease i need help with this question Rewrite the following C code in RISC-V assuming a, b, c and d are all 4-byte ints stored in memory locations 1000, 1004, 1008, 1012 respectively. Note: we do not have jgt (>) as a conditional branch so you will have to figure out how to test a > 0 in some other way. while(a>=b) { if(c<d) c --; else if(a>0) b++; a--; }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 the following C function compiled to RISC-V RV321. The following assembly sequence is equivalent to the C code snippet, but an assembly instruction is missing. what should be XXXX to have an equivalent code? int fun(char a) { fcall(); return a ^ 0x50; } fun: sp, sp,-16 ra,12(sp) s2,8(sp) s2, a0 addi SW SW mv call XXX fcall ra,12(sp) 52,8(sp) lw lw addi sp,sp, 16 jr ra O xori x10,s2,51 xori a0,s2,51 O Another instruction xori a0,s0,80 xori x10,s2,80arrow_forward. • How to use the RMW instruction CAS (compare-and-swap) to implement the API pair enter_cs() and leave_cs(). • Please explain your implementation.arrow_forwardWe wish to execute a single LC-3 instruction that will subtract the decimal number 33 from R1 and put the result in R2. Can we do it? a. No, because the smallest number that fits 5 bits is -32b. No, because we don't have SUB instruction to subtractc. No, because the smallest number that fits 5 bits is -16d. Yes, we can do it with a single instruction.e. none of the above.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