Chegg Run the Simulation Again What Is the Value of Tbaluresult for This Instruction?
You should upgrade or use an alternative browser.
- Forums
- Homework Assistance
- Engineering and Comp Sci Homework Aid
Program Trace [assembly]
- Thread starter twoski
- Start engagement
Homework Argument
This question is being done using MARIE.
Suppose initially AC = 1000, M[200] = FFFF, PC = 100. Trace the fetch execute (pedagogy) cycle of the post-obit sequence of MARIE instructions using Annals transfer annotation (like to Figure 4.14 of your text).
Load 200 //PC = 100 here
Add 200
Jns 300
The Attempt at a Solution
I am using the same notation as my volume.
The problem is, in the textbook programme the hex contents of retentivity is listed for 100,101,102... etc. In my program, i am only told that M[200] = FFFF. What happens when i endeavor to access M[101]? Is it simply zeroes? Am i right in bold that?
Answers and Replies
The problem is, in the textbook program the hex contents of memory is listed for 100,101,102... etc. In my program, i am merely told that K[200] = FFFF. What happens when i try to admission Yard[101]? Is information technology simply zeroes? Am i right in bold that?
If you don't know what is at that place yous cannot presume annihilation.
Simply I think you lot do know what is at that place. Where is your program stored?
So therefore, IR should exist 3200 since Add is three and we're adding 200. Right?
Ohhh... I totally forgot that PC is 100 at the kickoff instruction.Then therefore, IR should be 3200 since Add is 3 and nosotros're adding 200. Right?
Adding the contents of address 200 to the accumulator, yes.
You have the correct idea; the opcode for Add together is read from address 101. You'll have to trust yourself on the specifics since I don't know anything near Marie :)
Okay and then technically this programme is loading FFFF and so calculation FFFF to information technology. Since MARIE uses 2's complement, this is the same (i retrieve) equally calculation -1 to -i which results in FFFD.
lol
Okay then technically this program is loading FFFF then adding FFFF to it. Since MARIE uses 2's complement, this is the same (i call back) as calculation -1 to -1 which results in FFFD.
-2 is FFFE
+ii = ..0010
complement = ..1101
increase = ..1110 = Eastward
FFFF=-one
FFFE=-two
FFFD=-iii
...
Whether the numbers are interpretted every bit unsigned or signed (2's complement), the effect is the same. An unsigned addition FFFF+FFFF will also result in FFFE. Only the interpretation of the bits (by a man) will change.
Here's what i take.
Here's an extra question: After y'all've done the JNS 300, how could you use the JUMPI (jump indirect) instruction to "return" back to 103?
On a related note, i take to decipher this program. Specifically, determine how many times the instruction at South is executed, and what is contained in Data when the programme halts. I don't get how this can be determined since the input could alter how long it takes for the program to halt.
000 5000 | Southward INPUT 001 400A | SUBT Thirty 002 300B | ADD Data 003 | Store Data 004 100C | LOAD Round 005 400D | SUBT I 006 200C | Shop Round 007 | SKIPCOND 400 008 9000 | Leap Southward 009 7000 | HALT 00A 0030 | Thirty Dec 48 00B 0000 | Data December 0 00C | Circular DEC x 00D 0001 | Ane December ane JNS X
MBR <- PC
MAR <- Ten
M[MAR] <- MBR
MBR <- X
AC <- one
Air conditioning <- AC + MBR
PC <- Ac
The just place where PC is used is at the very start and very end :S
The skipcond education is merely affected by the last math operation, so the input does non outcome the number of times the loop is run.I accept to decipher this programme.
This seems to be right, but the fetch office of JNS is the same as it for all the other instructions. The fetch for JNS does not include MBR <- PC, that is part of the execute.Our textbook shows the transfer notation for Jns as such:JNS X
MBR <- PC
MAR <- X
K[MAR] <- MBR
MBR <- 10
Air-conditioning <- 1
Ac <- Air-conditioning + MBR
PC <- ACThe just place where PC is used is at the very showtime and very end
MBR, PC, and AC are registers, retentivity is non erased when you do operations with the registers. The fetch for JNS and all instructions volition exist the same for this processor. But the execute role will be different. Try writing the trace over again for the JNS using the aforementioned fetch and decode equally the other instructions, and then the execute equally shown from your book.I desire to be doing MBR <- PC before PC <- Air conditioning in order to store 103, right? considering otherwise 103 is erased.
On side note, later on doing the JNS 300, if the pedagogy at 301 was JUMPI 300, what would that do?
So SKIPCOND 400 uses 00 which means that if Air conditioning < 0 it skips the adjacent instruction. Which means that the pedagogy S volition exist executed twice since it'south comparing the Round label to 0.
I don't empathize what it's request me to say near the Information label when the program halts. Isn't Information dependent on the input?
Information technology seems your volume isn't explaining the instructions well. SKIPCOND uses the first 2 bits of the 12 flake operand, then 000 checks for AC < 0, 400 checks for Air conditioning == 0, and 800 checks for AC > 0.Okay so if i'1000 agreement SKIPCOND right, it uses the second 2 digits of the operand to do its thing.
Again, could you try redoing the trace again for the JNS using the aforementioned fetch and decode as the other instructions, and then the execute equally shown from your book. On side note, after doing the JNS 300, if the instruction at 301 was JUMPI 300, what would that do?
I discover the mixture of binary and hex more than messy than benign in this assignment. :/
I'm not certain i follow what yous want me to practise with the JNS, It's basically the same as all the other instructions except at the execute phase it does things differently with the PC. I marked in green the 2 lines that might demand to be moved around but the rest matches up with everything else.
It might be more messy, but you'll need to know how to code the SKIPCOND pedagogy using the conventional format, which uses hex, so if IR[11 10] = 00, and so IR = 000, IR[11 10] = 01, then IR = 400, and IR[11 ten] = 10, so IR = 800.I guess i'chiliad confused why it uses 000, 400 and 800 to determine the action that SKIPCOND uses. It explains in the book that if IR[xi-10] == 01 then it does an equality check, 00 is < and ten is >. IR[eleven-10] in this case is forty though, right? I idea nosotros were working with private bits and non hex... I find the mixture of binary and hex more than messy than benign in this assignment.
You should not move those 2 lines around. The lines for fetch and decode should be identical to the lines you have for the other instructions. There is no get operand footstep, since memory is not being read. Your textbook doesn't explain that MAR will hold the value for Ten. See if you can complete the trace for JNS 300 starting with this partial trace:I'm not certain i follow what you want me to do with the JNS, Information technology's basically the aforementioned as all the other instructions except at the execute stage information technology does things differently with the PC. I marked in green the 2 lines that might need to be moved effectually simply the rest matches up with everything else.
fetch MAR <- PC IR <- M[MAR] PC <- PC + 1 decode MAR <- IR[11 0] execute MBR <- PC ... In lodge to sympathize the purpose of the JNS 300, presume retentiveness location 301 has a JUMPI 300 and practice the trace for JUMPI 300.
You'd only utilise the indirect jump on 300 since 103 is stored at that location.
I have even so another question i can't solve.
Suppose we add a stack-duplicate (SDUP) didactics in MARIE where memory location FFF is reserved to store the stack pointer (address of the top of the stack).
When executed, SDUP duplicates the top of the stack by pushing some other copy of its value onto the stack. For example, if Yard[FFF] = F01 and Thou[F01] = 1234, upon execution, M[F00] = G[F01] = 1234, and M[FFF] = F00.(a) Represent the fetch-decode-execute cycle of this instruction in RTN.
(b) Can this SDUP instruction be simulated using the original set of MARIE instructions? If so, write the program fragment that does the simulation. If not, explain what difficulty arises?
I'm supposed to exist doing information technology using register transfer annotation, simply i don't know what value to apply for the instruction. If i'm calling SDUP F01 then what would i put into the IR?
This is messy and probably wrong just i dunno else what to practice. Should i even exist mentioning the AC in my solution?
If AC <- Air-conditioning + MAR is allowed in addition to Ac <- AC + MBR, then you wouldn't need to use MBR <- IR[11-0] once more, only I don't know what is allowed on the processor. What yous have now is right.
You lot'd be using SDUP FFF (instead of SDUP F01, M[FFF] contains the F01). You can make up whatever value yous want, opcodes 0 through C are already used, and then you lot could use opcode D, then the entire education for SDUP FFF could be hex DFFF. In this case, the fetch, decode, and go operand will exist the aforementioned every bit your other instructions, since you need to get the stack accost from memory at FFF. Try to create the trace using DFFF for the instruction word.If i'thousand calling SDUP F01 then what would i put into the IR?
None of the other instructions increase a location in memory or any annals except for PC <- PC + one. SDUP will start off the same as LOAD, then continue with more execution steps after Air conditioning <- MBR equally seen at the cease of LOAD.If i made the fetch in SDUP the same every bit the others and then i'd be incrementing FFF which would mess information technology up though, right?
How close was i?
Also, i've made progress with the question from the beginning page regarding the program i have to examine.
It basically loads user input into the AC, subtracts 0x30, adds "Data" to the AC, and stores the Air conditioning at "Information" ten times. The question asks what "Data" contains at the end, which confuses me because Data could contain anything depending on what you input for each iteration.
How close was i?[/QUOTE}This is what you want to practice logically, but I don't know if Thou[Air-conditioning] <- M[MBR] is allowed. If not, you'll demand to seperate this into multiple steps. Hint, use MBR to hold the data to exist duplicated, starting time execute with:MAR <- MBR
MBR <- M[MAR]Assuming that MAR <- MAR - i isn't allowed, you'll take to use Air conditioning to do the decrement instead.
What probably hasn't been explained to yous is that 0x30 is the value for ASCII '0'. If the user enters a character from '0' to 'ix', so subtracting 0x30 converts the ASCII character into a value 0 to 9.Also, i've fabricated progress with the question from the get-go page regarding the program i take to examine. It basically loads user input into the Ac, subtracts 0x30, adds "Data" to the AC, and stores the Air conditioning at "Data" 10 times. The question asks what "Data" contains at the end, which confuses me because Data could comprise anything depending on what you input for each iteration.You're only supposed to describe what Information contains based on the supposition that the user input '0' to 'ix', and did this 10 times.
Aye that would be sufficient. What if the user enters 0, i, 2, 3, 4, 5, 6, seven, 8 , 9?Well if the user enters aught 10 times, then data will contain 0. If they enter 9 each time then data will contain ninety, and and so on... So i guess i could just give an explanation as to what the plan does with user input and that would be sufficient?
Related Threads on Program Trace [assembly]
- Last Post
- Last Postal service
- Last Mail
- Last Post
- Final Mail
- Last Mail service
- Last Mail service
- Last Post
- Concluding Mail service
- Last Post
- Forums
- Homework Help
- Engineering and Comp Sci Homework Assist
hardawayliker1951.blogspot.com
Source: https://www.physicsforums.com/threads/program-trace-assembly.654472/
0 Response to "Chegg Run the Simulation Again What Is the Value of Tbaluresult for This Instruction?"
Post a Comment