We are here with you hands in hands to facilitate your learning & don't appreciate the idea of copying or replicating solutions. Read More>>
CS501 Assignment No 01 Solution & Discussion Due Date: 09-11-2017
Questions No 01 Marks (12)
Write the code/instructions to implement the expression A = (B – C) + 15(D - 45) on 3, 2, 1, and 0-address machines.
Questions No 02 Marks (08)
Compute the total memory traffic in bytes for both instruction fetch and instruction execution for the code that implements the expression evaluation for the four machines in question # 1.
Assume opcodes occupy one byte, addresses occupy three bytes, and data values also occupy three bytes. Don’t mix it with code size of instruction.
Share This With Friends......
any one have idea about it?
i just viewed the assignment let me study it.
can you have the reference book for this subject. not handouts
no i have only handouts i am also studying.if you complete it first then please share
Well Handouts page no. 36 study karo :-D
Please Discuss here about this assignment.Thanks
Our main purpose here discussion not just Solution
We are here with you hands in hands to facilitate your learning and do not appreciate the idea of copying or replicating solutions. Read More>>
For Important Helping Material related to this subject (Solved MCQs, Short Notes, Solved past Papers, E-Books, FAQ,Short Questions Answers & more). You must view all the featured Discussion in this subject group.
For how you can view all the Featured discussions click on the Back to Subject Name Discussions link below the title of this Discussion & then under featured Discussion corner click on the view all link.
Or visit this link
Please Click on the below link to see…
P.S: Please always try to add the discussion in proper format title like “CS101 Assignment / GDB No 01 Solution & Discussion Due Date: ___________”
Dear Admin can you provide ebook for this subject not handouts
Assume that you have addition (ADD), subtraction (SUB), multiplication (MPY), and data movement (MOV, LOAD, STORE, PUSH, and POP) instructions available to you in each of the relevant types of machines. Recall that an n-address machine will specify n operand addresses in the instruction. So, a 3-address machine has instructions like ADD X, Y, Z. This instruction will perform M[X] ← M[Y] + M[Z]. In words, this takes the content of the memory location specified by the address Y, adds it to the content of the memory location specified by the address Z, and places the result in the memory location specified by the address X. Also, keep in mind that 1-address machines use an accumulator to hold one source operand and the destination operand, and 0- address machines use a stack to store both source operands and destination operands. Finally, you may assume that a memory location can be both a source and a destination.
The table below shows the four programs that are needed to answer this question.
3-Address Machine 2-Address Machine 1-Address Machine 0-Address
Add A,x,r Load x,b
Sta a Push d
QUESTION NO 2
Make sure that you understand that all instructions are in memory and must be fetched from memory. Also, make sure that you understand that all data values are in memory and must be fetched from memory. So, an instruction like SUB A, B, C requires 1 byte for the opcode, 3 bytes for address A, 3 bytes for address B, and 3 bytes for address C for a total of 10 bytes just to represent the instruction. These 10 bytes must be fetched from memory in order to bring the instruction into the processor for decoding and execution. The data at each address (A, B, and C) in memory is 3 bytes each. So, fetching the SUB A, B, C instruction requires reading 10 bytes from memory. During execution you must read 3 bytes for B, read 3 bytes for C, and then write 3 bytes for A. So, you have a total of 19 bytes that must go to or from memory to fetch and execute this one instruction. The same thought process applied to the other instructions as well.
Load x, b, b requires 7 bytes to represent the instruction (1 byte for the opcode, 3 bytes for address x, and 3 bytes for address b). Fetching and executing requires reading 7 bytes of instruction, reading 3 bytes for B, and then writing 3 bytes for into x. The total traffic is 11 bytes. The LOAD B instruction requires 1 byte for opcode and 3 bytes for address B. Fetching and executing LOAD B requires 7 bytes of memory traffic. An instruction like SUB only requires 1 bytes of memory traffic because all data operations are performed internal to the computer using the internal stack. So,
the total memory traffic is:
3-Address Machine: ( )bytes
2-Address Machine: () bytes
1-Address Machine: () bytes
0-Address Machine: () bytes
CS501 Assignment#01 Solution
See the attached file
CS501 Assignment#01 Solution
See the attached file
thanks M.Tariq Bhai.
kia is m explanation bh dyni zaror hy ya phr direct code bh dy skty hn?
2nd q smajh nahi aa raha please explain