



















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Memory, SRC example program, Memory Address, Memory Contents, Hex codes, SRC instructions, Source program with directives are the topics professor discussed in class.
Typology: Slides
1 / 27
This page cannot be seen from the preview
Don't miss anything!
Another solution … Note: If we assume a mul instruction in the instruction set of the SRC, the shl will be replaced by the mul instruction as shown below:
mul R7, R3, 4 : R7 contains 16(c+58)
mul R8, R6, 2 ; R8 contains 4(a+b)
Source program with directives
Solution:
Label Address Value a 200 unknown b 204 unknown c 208 unknown z 212 unknown
200 unknown 204 unknown 208 unknown 212 unknown … ,,, 400 ld R1, c 404 addi R3, R1, 58 408 shl R7, R3, 4 412 ld R4, a 416 ld R5, b 420 add R6, R4, R 424 shl R8, R6, 2 428 sub R9, R7, R 432 st R9, z
Regist er Code Regist er Code Regist er Code Regist er Code R0 00000 R8 01000 R16 10000 R24 11000 R1 00001 R9 01001 R17 10001 R25 11001 R2 00010 R10 01010 R18 10010 R26 11010 R3 00011 R11 01011 R19 10011 R27 11011 R4 00100 R12 01100 R20 10100 R28 11100 R5 00101 R13 01101 R21 10101 R29 11101 R6 00110 R14 01110 R22 10110 R30 11110 R7 00111 R15 01111 R23 10111 R31 11111
la 0 0 1 0 1 lar 0 0 1 1 0 ld 0 0 0 0 1 ldr 0 0 0 1 0 neg 0 1 1 1 1 nop 0 0 0 0 0 not 1 1 0 0 0 or 1 0 1 1 0 ori 1 0 1 1 1 shc 1 1 1 0 1 shc 1 1 1 0 1 shl 1 1 1 0 0 shl 1 1 1 0 0 shr 1 1 0 1 0 shr 1 1 0 1 0 shra 1 1 0 1 1 shra 1 1 0 1 1 st 0 0 0 1 1 stop 1 1 1 1 1 str 0 0 1 0 0 sub 0 1 1 1 0
Regist er Code Regist er Code Regist er Code Regist er Code R0 00000 R8 01000 R16 10000 R24 11000 R1 00001 R9 01001 R17 10001 R25 11001 R2 00010 R10 01010 R18 10010 R26 11010 R3 00011 R11 01011 R19 10011 R27 11011 R4 00100 R12 01100 R20 10100 R28 11100 R5 00101 R13 01101 R21 10101 R29 11101 R6 00110 R14 01110 R22 10110 R30 11110 R7 00111 R15 01111 R23 10111 R31 11111
la 0 0 1 0 1 lar 0 0 1 1 0 ld 0 0 0 0 1 ldr 0 0 0 1 0 neg 0 1 1 1 1 nop 0 0 0 0 0 not 1 1 0 0 0 or 1 0 1 1 0 ori 1 0 1 1 1 shc 1 1 1 0 1 shc 1 1 1 0 1 shl 1 1 1 0 0 shl 1 1 1 0 0 shr 1 1 0 1 0 shr 1 1 0 1 0 shra 1 1 0 1 1 shra 1 1 0 1 1 st 0 0 0 1 1 stop 1 1 1 1 1 str 0 0 1 0 0 sub 0 1 1 1 0
Regist er Code Regist er Code Regist er Code Regist er Code R0 00000 R8 01000 R16 10000 R24 11000 R1 00001 R9 01001 R17 10001 R25 11001 R2 00010 R10 01010 R18 10010 R26 11010 R3 00011 R11 01011 R19 10011 R27 11011 R4 00100 R12 01100 R20 10100 R28 11100 R5 00101 R13 01101 R21 10101 R29 11101 R6 00110 R14 01110 R22 10110 R30 11110 R7 00111 R15 01111 R23 10111 R31 11111
la 0 0 1 0 1 lar 0 0 1 1 0 ld 0 0 0 0 1 ldr 0 0 0 1 0 neg 0 1 1 1 1 nop 0 0 0 0 0 not 1 1 0 0 0 or 1 0 1 1 0 ori 1 0 1 1 1 shc 1 1 1 0 1 shc 1 1 1 0 1 shl 1 1 1 0 0 shl 1 1 1 0 0 shr 1 1 0 1 0 shr 1 1 0 1 0 shra 1 1 0 1 1 shra 1 1 0 1 1 st 0 0 0 1 1 stop 1 1 1 1 1 str 0 0 1 0 0 sub 0 1 1 1 0
4.The value of the label c is provided by the assembler, and should be converted to 17 bits Label Address Value a 200 unknown b 204 unknown c 208 unknown z 212 unknown
Regist er Code Regist er Code Regist er Code Regist er Code R0 00000 R8 01000 R16 10000 R24 11000 R1 00001 R9 01001 R17 10001 R25 11001 R2 00010 R10 01010 R18 10010 R26 11010 R3 00011 R11 01011 R19 10011 R27 11011 R4 00100 R12 01100 R20 10100 R28 11100 R5 00101 R13 01101 R21 10101 R29 11101 R6 00110 R14 01110 R22 10110 R30 11110 R7 00111 R15 01111 R23 10111 R31 11111
la 0 0 1 0 1 lar 0 0 1 1 0 ld 0 0 0 0 1 ldr 0 0 0 1 0 neg 0 1 1 1 1 nop 0 0 0 0 0 not 1 1 0 0 0 or 1 0 1 1 0 ori 1 0 1 1 1 shc 1 1 1 0 1 shc 1 1 1 0 1 shl 1 1 1 0 0 shl 1 1 1 0 0 shr 1 1 0 1 0 shr 1 1 0 1 0 shra 1 1 0 1 1 shra 1 1 0 1 1 st 0 0 0 1 1 stop 1 1 1 1 1 str 0 0 1 0 0 sub 0 1 1 1 0
corresponding to addi from SRC table
- la - lar - ld - ldr - neg - nop - not - or - ori - shc - shc - shl
Regist er Code Regist er Code Regist er Code Regist er Code R0 00000 R8 01000 R16 10000 R24 11000 R1 00001 R9 01001 R17 10001 R25 11001 R2 00010 R10 01010 R18 10010 R26 11010 R3 00011 R11 01011 R19 10011 R27 11011 R4 00100 R12 01100 R20 10100 R28 11100 R5 00101 R13 01101 R21 10101 R29 11101 R6 00110 R14 01110 R22 10110 R30 11110 R7 00111 R15 01111 R23 10111 R31 11111
Regist er Code Regist er Code Regist er Code Regist er Code R0 00000 R8 01000 R16 10000 R24 11000 R1 00001 R9 01001 R17 10001 R25 11001 R2 00010 R10 01010 R18 10010 R26 11010 R3 00011 R11 01011 R19 10011 R27 11011 R4 00100 R12 01100 R20 10100 R28 11100 R5 00101 R13 01101 R21 10101 R29 11101 R6 00110 R14 01110 R22 10110 R30 11110 R7 00111 R15 01111 R23 10111 R31 11111
la 0 0 1 0 1 lar 0 0 1 1 0 ld 0 0 0 0 1 ldr 0 0 0 1 0 neg 0 1 1 1 1 nop 0 0 0 0 0 not 1 1 0 0 0 or 1 0 1 1 0 ori 1 0 1 1 1 shc 1 1 1 0 1 shc 1 1 1 0 1 shl 1 1 1 0 0 shl 1 1 1 0 0 shr 1 1 0 1 0 shr 1 1 0 1 0 shra 1 1 0 1 1 shra 1 1 0 1 1 addi 0 1 1 0 1 stop 1 1 1 1 1 str 0 0 1 0 0 sub 0 1 1 1 0