13.07.2015 Views

The PowerPC 604 RISC Microprocessor - eisber.net

The PowerPC 604 RISC Microprocessor - eisber.net

The PowerPC 604 RISC Microprocessor - eisber.net

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Assembler/Interprete• ListingI (*Aasembler and interpreter of Paecel code*)2 ("K. Jenson, N. Wirth, Ch. Jacobi, ETH May 76")34 program pcode(input s output,prd,prO156 (" Note for the implementation.7I This interpreter ie written for the caee where all the fundamental types9 take one storage unit.10 In an actual implementation, the handling of the ep pointer has to take11 into account the fact that the types may have lengths different from one'12 in push and pop operations the sp has to be increased and decreaeud not13 by 1, but by a number depending on the typo concerned;14 However, where the number of unite of storage has been computed by the15 compiler, the value must not be corrected, since the lengths of the types16 involved have already been taken into account.17A)1819202122 label 1;23 co<strong>net</strong> codemax • 8650;24 pereax • 17500;25 maxstk . 13650; (* site of variable store A)26 overt • 13655; (A size of integer constant table • 5 A)27 ovorr • 13660; (A size of real constant table • 5 A) •28 overs - 13730; (A site of set constant table • 70 A)29 overb - 13820;30 OVeral • 10000;31 maxatr, • 18001;32 largoint . 26144;33 begincod• - 3;34 inputadr • 5;35 oitputadr • 6;36 prdadr • 7137 prradr • 8;38 duminst . 6213940 typo bit4 .-0..15141 'bit6 • 0..127;42 bit20 . - 26143..26143143 datatypo - (undo(' int,reol,boolopettoidr,mark,car);44 address ■ -1:.maxatr;45 beta46.. packed orrey11..231 of char; (*error meeaoge 0 )47 var code s orray(0..codemax) of (A the program '948 packed record opl tbit6;49DI tbit4,50 ql tbit20151' opt !bite;52 p2 tbit4;3354 end'q2 1bit2055 pc 1 0..pcmAx; (Aprogram address register*)36 op 1, bit6, p t bit4, q 1 bit20; (Ainatruers,,,, ,......, • .6782 Pascal Implementation: Compiler and Assembler/Interpreter953 end;r:54955 46 ("1110)1 begin sp 1. sp-1;stere(•p).vs 1. •tore(sp).vs A •tore(op+11.vs956957 end;958959 47 ("uni")1 begin ep :. sp-1;960etore(spl.ve 1• store(sp).vs + store(sp+11.vs961 end;962963 48 ("inn")t begin964 sp t. op - 1; i t- store(spkvi;storelepl.vb 1- i in store(sp+11.vs;965966 end;9u7968 49 ("mod")1 begin ep :. op-1,storelepl.vi :. etore(spl•vi mod etore(sp+1).vi969970 und;971972 50 (*odd"): storelep).vb ► • odd(stors(sp).vi);97)974 51 ("mpi")t begin sp i. sp-1;etoreispl.vi :. •tore(sp).vi * storelsp+11.vi915976 end;977978 52 ("mpr")1 begin •p I» sp-1;979 store(•pl.vr 1... store(sp).vr * otore(ep+1).vr900 end;981902 53 ("dvi*): begin ep :- sp-I,storelsp).vi t• storelspkvi div store(sp+1).vi983984 end;98598o 54 ( 0dvr$91 begin sp :.. sp-1;atore(sp).vr c. store(sp).vr / otore(sp+11.vr987988 end;989993 55 (*mov*)1 begin it :. store(sp-1).va;991 ' 12 i• etorelspl.va; sp :. sp-2;for I :. 0 to q-1 do storelil+il :- store(12+i)992993 ( 5 q is a number of storage units A)994 end;995996 56 ("lca 0 )t begin ep I. •p+1;997 •torelsp).va t. q;998 end;9991000 100,101,102,103,104,1001 57 (*dec")1 store(ep).vi t. store(spl.vi - q;10021003 58 (*stp")t interpreting z ■ false;10041005 59 (*ord 0 )s ("only used to change the tagfield")1006begin1007 end;10001009 60 ("chr")s begin1010end;101 ►1012 61 (Auje 0 )t erred(' case error ');1013 and1014 end; ("while interpreting")10151016 I i,,,,

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!