Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 39a40,41
- > ----------- optimization -----------
- > variable goPush: bit
- 50c52
- < insAddr <- pc;pc := ( pc + 1 as log numIns bits )||insQ -> ir--readIns();incPC()
- ---
- > readIns();incPC()
- 181c183
- < pc := 0 || sp:=0 || stopFlag := 0 || acc:=0 ||bcc:=0 ||
- ---
- > pc := 0 || sp:=0 || stopFlag := 0 || acc:=0 ||bcc:=0 ||goPush:=0 ||
- 194c196,197
- < push0()
- ---
- > acc:=0;
- > goPush:=1
- 197c200
- < push()
- ---
- > goPush:=1
- 200c203
- < push()
- ---
- > goPush:=1
- 202c205,207
- < push00()
- ---
- > acc:=0;
- > push();
- > goPush:=1
- 206c211,212
- < push0()
- ---
- > acc:=0;
- > goPush:=1
- 209c215
- < push()
- ---
- > goPush:=1
- 212c218
- < push()
- ---
- > goPush:=1
- 214c220,222
- < push00()
- ---
- > acc:=0;
- > push();
- > goPush:=1
- 220c228
- < push()
- ---
- > goPush:=1
- 224c232,290
- < push()
- ---
- > goPush:=1
- > | 0x59 then -- dup
- > pop(); -- pop value
- > push();
- > goPush:=1
- > | 0x5A then -- dup_x1 Before:..., word2, word1 After:..., word1, word2, word1
- > pop2(); -- bcc=word1, acc=word2
- > ccc:=acc; -- word2
- > acc:=bcc; -- word1
- > push(); -- word1
- > acc:=ccc; -- word2
- > push();
- > acc:=bcc;
- > goPush:=1
- > | 0x5F then -- swap Before:..., word2, word1 After:..., word1, word2
- > pop2();
- > ccc:=acc;
- > acc:=bcc;
- > push();
- > acc:=ccc;
- > goPush:=1
- > | 0x60 then -- IADD
- > pop2();
- > addAccBcc();
- > goPush:=1
- > | 0x61..0x63 then -- LADD/FADD/DADD
- > print "unimplemented instruction = ", ir
- > | 0x64 then -- ISUB
- > pop2();
- > subAccBcc();
- > goPush:=1
- > | 0x74 then -- INEG
- > pop();
- > bcc:=acc;
- > acc:=0;
- > subAccBcc();
- > goPush:=1
- > | 0x80 then -- IOR
- > pop2();
- > acc:=acc or bcc;
- > goPush:=1
- > | 0x81 then -- LOR
- > print "unimplemented instruction = ", ir
- > | 0x82 then -- IXOR
- > pop2();
- > acc:=acc xor bcc;
- > goPush:=1
- > | 0x91 then -- i2b
- > pop();
- > acc:=(#acc[0..7] as ENTRY_SIZE);
- > goPush:=1
- > | 0x92 then -- i2c (Zero extended)
- > pop();
- > acc:=(#acc[0..15] @ #0 as ENTRY_SIZE);
- > goPush:=1
- > | 0x93 then -- i2s (signed extended)
- > pop();
- > acc:=(#acc[0..15] as ENTRY_SIZE);
- > goPush:=1
- 310,322d375
- < | 0x59 then -- dup
- < pop(); -- pop value
- < push();
- < push()
- < | 0x5A then -- dup_x1 Before:..., word2, word1 After:..., word1, word2, word1
- < pop2(); -- bcc=word1, acc=word2
- < ccc:=acc; -- word2
- < acc:=bcc; -- word1
- < push(); -- word1
- < acc:=ccc; -- word2
- < push();
- < acc:=bcc;
- < push()
- 331,347d383
- < | 0x5F then -- swap Before:..., word2, word1 After:..., word1, word2
- < pop2();
- < ccc:=acc;
- < acc:=bcc;
- < push();
- < acc:=ccc;
- < push()
- < | 0x60 then -- IADD
- < pop2();
- < addAccBcc();
- < push()
- < | 0x61..0x63 then -- LADD/FADD/DADD
- < print "unimplemented instruction = ", ir
- < | 0x64 then -- ISUB
- < pop2();
- < subAccBcc();
- < push()
- 352,357d387
- < | 0x74 then -- INEG
- < pop();
- < bcc:=acc;
- < acc:=0;
- < subAccBcc();
- < push()
- 366,375d395
- < | 0x80 then -- IOR
- < pop2();
- < acc:=acc or bcc;
- < push()
- < | 0x81 then -- LOR
- < print "unimplemented instruction = ", ir
- < | 0x82 then -- IXOR
- < pop2();
- < acc:=acc xor bcc;
- < push()
- 386,397d405
- < | 0x91 then -- i2b
- < pop();
- < acc:=(#acc[0..7] as ENTRY_SIZE);
- < push()
- < | 0x92 then -- i2c (Zero extended)
- < pop();
- < acc:=(#acc[0..15] @ #0 as ENTRY_SIZE);
- < push()
- < | 0x93 then -- i2s (signed extended)
- < pop();
- < acc:=(#acc[0..15] as ENTRY_SIZE);
- < push()
- 501c509,512
- < pc_out <- pc || acc_out <-acc
- ---
- > case goPush of 0 then
- > push()
- > end
- > ; pc_out <- pc || acc_out <-acc
- 514c525
- < end
- \ 檔案末沒有 newline 字元
- ---
- > end
Advertisement
Add Comment
Please, Sign In to add comment