
EBK COMPUTER SYSTEMS
3rd Edition
ISBN: 8220101459107
Author: O'HALLARON
Publisher: YUZU
expand_more
expand_more
format_list_bulleted
Question
Chapter 4, Problem 4.45HW
A.
Program Plan Intro
Given Assembly code:
subq $8, %rsp
movq REG, (%rsp)
Data movement instructions:
- The different instructions are been grouped as “instruction classes”.
- The instructions in a class performs same operation but with different sizes of operand.
- The “Mov” class denotes data movement instructions that copy data from a source location to a destination.
- The class has 4 instructions that includes:
- movb:
- It copies data from a source location to a destination.
- It denotes an instruction that operates on 1 byte data size.
- movw:
- It copies data from a source location to a destination.
- It denotes an instruction that operates on 2 bytes data size.
- movl:
- It copies data from a source location to a destination.
- It denotes an instruction that operates on 4 bytes data size.
- movq:
- It copies data from a source location to a destination.
- It denotes an instruction that operates on 8 bytes data size.
- movb:
Unary and Binary Operations:
- The details of unary operations includes:
- The single operand functions as both source as well as destination.
- It can either be a memory location or a register.
- The instruction “incq” causes 8 byte element on stack top to be incremented.
- The instruction “decq” causes 8 byte element on stack top to be decremented.
- The details of binary operations includes:
- The first operand denotes the source.
- The second operand works as both source as well as destination.
- The first operand can either be an immediate value, memory location or register.
- The second operand can either be a register or a memory location.
Jump Instruction:
- The “jump” instruction causes execution to switch to an entirely new position in program.
- The “label” indicates jump destinations in assembly code.
- The “je” instruction denotes “jump if equal” or “jump if zero”.
- The comparison operation is performed.
- If result of comparison is either equal or zero, then jump operation takes place.
- The “ja” instruction denotes “jump if above”.
- The comparison operation is performed.
- If result of comparison is greater, then jump operation takes place.
- The “pop” instruction resumes execution of jump instruction.
- The “jmpq” instruction jumps to given address. It denotes a direct jump.
A.
Expert Solution

Explanation of Solution
Behavior of instruction pushq:
- No, the given code sequence is not correctly describes the behavior of given instruction.
- The instruction “subq $8, %rsp” subtracts 8 from value of “%rsp”.
- If “REG” denotes “%rsp” then it computes “%rsp-8”.
- The instruction “movq REG, (%rsp)” moves value of “REG” into location of “(%rsp)”.
- The value “%rsp-8” is been pushed into stack instead of “%rsp”.
- Hence, it does not describe behavior of instruction “pushq %rsp”.
B.
Program Plan Intro
Given Assembly code:
subq $8, %rsp
movq REG, (%rsp)
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:
B.
Expert Solution

Explanation of Solution
Modified code:
movq REG, -8(%rsp)
subq $8, %rsp
Explanation:
- The instruction “movq REG, -8(%rsp)” moves value of “REG” into location of “(%rsp)-8”.
- The instruction “subq $8, %rsp” subtracts 8 from value of “%rsp”.
- If “REG” denotes “%rsp” then it computes “%rsp”.
- The value “%rsp” is now been pushed into stack.
- Hence, it describes behavior of instruction “pushq %rsp”.
Want to see more full solutions like this?
Subscribe now to access step-by-step solutions to millions of textbook problems written by subject matter experts!
Students have asked these similar questions
Solve this
Solve this please and fast
Please original work
Background information: Imagine you are a consultant for a fictional company, FutureTech Innovations, which specializes in advanced technology products. The company is interested in improving its decision-making processes by leveraging Business Analytics (BA) and Management Support Systems (MSS).
Talk about how Online Analytical Processing (OLAP) could be used to analyze data from multiple perspectives at FutureTech. What dimensions (e.g., time, product, region) would be important, and how would OLAP enhance decision-making?
Talk about the role of data visualization in helping FutureTech understand business performance. What types of visualizations (e.g., dashboards, charts) would be useful, and how would they assist in interpreting data?
Please cite in text references and add weblinks
Chapter 4 Solutions
EBK COMPUTER SYSTEMS
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
- Design a synchronous Up/Down counter to produce the following sequence (4 9 2,0,7,6,3,1,5) using T flip-flop. The counter should count up when Up/Down =1, and down when Up/Down = 0.arrow_forwardAn active-HIGH pulse (HIGH level when asse rted, LOW level when not) is required on an i nverter input.(a) Draw the appropriate logic symbol, using t he distinctive shape and the negation indicat or, for the inverter in this application.(b) Describe the output when a positive-goin g pulse is applied to the input of an inverter.arrow_forwardConvert this question to Subroutines ORG 100 LDA A1 STA T1 LDA B1 STA T2 LDA T1 I STA A1 I ISZ B1 ISZ A1 ISZ ENC BUN L2 //COMPUTER HLT L1, INC A1, HEX 5000 STA T2 1 B1, HEX 6000 ISZ T1 T1, HEX O ISZ T2 T2, HEX 0 ISZ DCD DCD, DEC -8 BUN L1 // DPNQVUFS ENC, DEC -8 LDA B1 I DEC, HEX FF L2, ADD DEC ENDarrow_forward
- Convert this question to Subroutines > F = [(A. B) + (A'. B')]” = [(A. B)'. (A'. B')']' ORG 100 LDA A // Load A operand to AC HLT // END Program AND B CMA STA T1 LDA A CMA STA T2 LDA B CMA AND T2 CMA // Store AC result in T1 // Load A operand to AC // Complement result in AC // Store AC [A'] result in T2 // Load B operand to AC // Complement result in AC // AND B' with T2[A'] operand // Complement result in AC AND T1 // AND [(A'.B')'] with T1[(A.B)'] CMA // Complement result in AC STA F // Store AC result in F // AND A operand with B operand B, HEX 01 // Complement result in AC A, HEX 01 T1, HEX O T2, HEX 0 F, HEX 0 ENDarrow_forwardConvert this question to Subroutines L1, L2, ORG 100 SKI BUN L1 INP OUT STA CTR CLA // Check input operation ready // Loop back to L1 location // Enter counter (-10) to AC // display counter operand // Store counter in CTR // Clear AC STA LOCI // Clear content of location LOC ISZ LOC ISZ CTR BUN L2 // Go to next Address // Check loop duration // Loop back to L2 location // End program HLT CTR, HEX 0 LOC, HEX 0150 ENDarrow_forwardDesign the following Digital circuit in Verilog. IN1 IN2 MUX A Hint: a typical Demultiplexer is defined by a truth table like the following B DEMUX 1t04 demux_1t04 Sel W X Y Z "00" A 000 "01" 0 A 00 Sel sel demux_sel[1:0] "11" "10" 0 0 AO 000Aarrow_forward
- I need help with this problem and an step by step explanation of the solution from the image described below. (Introduction to Signals and Systems)arrow_forwardImplement the code in MATLAB and send a picture of the implementation from within the program MATLAB code to analyze material shape % image = grayImage == using computer vision imread('material_image.jpg'); % Read the image rgb2gray(image); % Convert the image to grayscale BW = imbinarize(grayImage); % Convert the image to binary (black and white) Extract geometric properties (e.g., area % and bounding box) stats = regionprops (BW, 'Area', ; 'BoundingBox') Classify material based on shape % if stats. Area > 500 ; 'material = 'Plastic ; 'material = 'Wood else end ; disp(['The material is: ', material])arrow_forwardImplement the code In MATLAB and send a picture of the Implementation from within the program Simulate data from magnetic sensor % magnetic FieldStrength = 0.5; % Magnetic field strength in Tesla Classify materials based on magnetic % field strength if magnetic FieldStrength > 0.3 material = 'Metal'; % Detect metal (e.g., iron) else material = 'Non-metal'; % Non-metal materials end ; disp(['Detected material: ', material])arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY

Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON

Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education

Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY