Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---Assembly---
- ###TEXT###
- ???input.txt???
- lw 0 1 five load reg1 with 5 (uses symbolic address)
- lw 1 2 3 load reg2 with -1 (uses numeric address)
- start add 1 2 1 decrement reg1
- beq 0 1 2 goto end of program when reg1==0
- beq 0 0 start go back to the beginning of the loop
- noop
- done halt end of program
- five .fill 5
- neg1 .fill -1
- stAddr .fill start will contain the address of start (2)
- ???mult.txt???
- lw 0 2 mcand //load mcand to register2
- lw 0 3 mplier //load mpiler to register3
- lw 0 5 Chk //load Chk to register5
- Start nand 5 3 6 //do Chk && mpiler from nand(1)
- nand 6 6 6 //do Chk && mpiler from nand(2)
- beq 6 0 Skip //if value in register6 = 0 jump to Skip
- add 1 2 1 //do ans = ans + mcand when register6 != 0
- Skip add 2 2 2 //do shift right mcand
- add 5 5 5 //do shift right Chk
- beq 5 0 Done //if Chk = 0 jump to Done
- beq 0 0 Start //go back to the beginning of the loop
- Done halt //end of program
- mcand .fill 32766
- mplier .fill 10383
- Chk .fill 1
- ???comb2.txt???
- lw 0 1 nInput
- lw 0 2 rInput
- lw 0 4 pos1
- lw 0 7 finish
- comb beq 1 2 37
- beq 0 2 36
- sw 5 7 stack
- add 5 4 5
- sw 5 1 stack
- add 5 4 5
- sw 5 2 stack
- add 5 4 5
- lw 0 6 neg1
- add 6 1 1
- lw 0 6 comAd
- jalr 6 7
- lw 0 6 neg1
- add 5 6 5
- lw 5 2 stack
- add 5 6 5
- lw 5 1 stack
- add 5 6 5
- lw 5 7 stack
- add 6 1 1
- add 6 2 2
- sw 5 7 stack
- add 5 4 5
- sw 5 1 stack
- add 5 4 5
- sw 5 2 stack
- add 5 4 5
- lw 0 6 comAd
- jalr 6 7
- lw 0 6 neg1
- add 5 6 5
- lw 5 2 stack
- add 5 6 5
- lw 5 1 stack
- add 5 6 5
- lw 5 7 stack
- jalr 7 6
- L1 noop
- add 4 3 3
- jalr 7 6
- end halt
- pos1 .fill 1
- neg1 .fill -1
- nInput .fill 7
- rInput .fill 5
- finish .fill end
- comAd .fill comb
- stack .fill 0
- ???sum.txt???
- lw 0 1 n
- lw 0 4 pos1
- lw 0 7 finish
- sum sw 5 7 stack
- add 5 4 5
- sw 5 1 stack
- add 5 4 5
- beq 1 0 l1
- lw 0 6 neg1
- add 1 6 1
- lw 0 6 comAd
- jalr 6 7
- lw 0 6 neg1
- add 5 6 5
- lw 5 1 stack
- add 5 6 5
- lw 5 7 stack
- add 3 1 3
- jalr 7 6
- l1 lw 0 6 neg1
- add 3 0 3
- jalr 7 6
- end halt
- pos1 .fill 1
- neg1 .fill -1
- n .fill 10
- finish .fill end
- comAd .fill sum
- stack .fill 0
- ??????
- ######
- ------
- ---MachineCode---
- ###Input###
- ???input.txt???
- 8454151
- 9043971
- 655361
- 16842754
- 16842749
- 29360128
- 25165824
- 5
- -1
- 2
- ???inputMulti.txt???
- 8519692
- 8585229
- 8716302
- 7012358
- 7733254
- 19922945
- 655361
- 1179650
- 2949125
- 19398657
- 16842744
- 25165824
- 32766
- 10383
- 1
- ???inputComb???
- 8454191
- 8519728
- 8650797
- 8847409
- 17432613
- 16908324
- 15663155
- 2883589
- 15269939
- 2883589
- 15335475
- 2883589
- 8781870
- 3211265
- 8781874
- 24576000
- 8781870
- 3014661
- 11141171
- 3014661
- 11075635
- 3014661
- 11468851
- 3211265
- 3276802
- 15663155
- 2883589
- 15269939
- 2883589
- 15335475
- 2883589
- 8781874
- 24576000
- 8781870
- 3014661
- 11141171
- 3014661
- 11075635
- 3014661
- 11468851
- 25034752
- 29360128
- 2293763
- 25034752
- 25165824
- 1
- -1
- 7
- 5
- 44
- 4
- 0
- ???inputSum???
- 8454169
- 8650775
- 8847386
- 15663132
- 2883589
- 15269916
- 2883589
- 17301515
- 8781848
- 917505
- 8781851
- 24576000
- 8781848
- 3014661
- 11075612
- 3014661
- 11468828
- 1638403
- 25034752
- 8781848
- 1572867
- 25034752
- 25165824
- 1
- -1
- 10
- 22
- 3
- 0
- ??????
- ######
- ------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement