mask MainMask addro[31:27] datsource[26:22] datdest[21:17] cdspsource[16:14] cdspdest[13:11] pcbsource[10:9] readmem[7:7] writemem[6:6] dispatch[5:5] to-page-zero[4:4] next_mic[3:0]; endmask values addro 0 dsp 1 dsp_4 2 dsp_m_4 3 dsp_plus_d 4 csp 5 csp_4 6 csp_m_4 7 csp_plus_d 8 pc 9 aluOut 10 regA 11 regB 12 regD 13 litbase+d 30 val_32'h5e 31 val_32'h5c default 29_val_29_32'bz endvalues values datsource 0 datamem 1 aluOut 2 regA 3 regB 4 regC 5 regD 6 litbase 7 tos 8 litbase-addr 9 template 10 val_32'h01020304 default 31 aluOut endvalues values datdest 1 ir 3 tos 4 regA 5 regB 6 regC 7 regD 8 litbase 9 template 10 regD_set_regD+1 default 31 regD endvalues values cdspsource 0 csp_plus_d 1 dsp_plus_d 2 csp_minus_d 3 dsp_minus_d 4 csp_4 5 dsp_4 6 csp_m_4 7 dsp_m_4 endvalues values cdspdest 0 csp_set_cdspbus 1 dsp_set_cdspbus 2 csp_set_datbus 3 dsp_set_datbus default 4 cdsp-noset endvalues values pcbsource 0 pc+4 1 pc+d 2 datbus 3 pc-jnil endvalues values readmem default 0 no 1 yes endvalues values writemem default 0 no 1 yes endvalues values dispatch default 0 no 1 yes endvalues values to-page-zero default 0 no 1 yes endvalues /* Der Anfang des Microcodes: Instruction fetch: */ :START:0: addro = pc, readmem = read, next_mic = +; datdest = ir, dispatch = yes; /* 1. Kontrolltransfer ================ 1.1. Sprungbefehle ============= JNIL d Wenn <(DSP++)> = NIL then PC := PC + d else PC := PC + 4 */ :JNIL:11: pcbsource = pc-jnil, cdspsource = dsp_4, cdspdest = dsp_set_cdspbus, to-page-zero = yes, next_mic = 0; /* JMP d PC := PC + d */ :JMP:12: pcbsource = pc+d, to-page-zero = yes, next_mic = 0; /* 1.2. Closure-Calls ============= CALLCLOS d (d = Anzahl der Parameter) CALLCLOSV (Anzahl Parameter liegt auf (DSP)) 1.3 Returns ======= RET */ :RET:18: addro = csp, readmem = read, cdspsource = csp_4, cdspdest = csp_set_cdspbus, next_mic = +; addro = csp, readmem = read, datsource = datamem, pcbsource = datbus, cdspsource=csp_4, cdspdest = csp_set_cdspbus, next_mic = +; datsource = datamem, datdest = template, next_mic = +; datsource = litbase-addr, datadest = litbase, to-page-zero = yes, pcbsource = pc+4, next_mic = 0; /* 1.4. Halts und Interrupts ==================== HALT EXCEPT d 2. Datentransfers ============== 2.1. Innerhalb des Datenstacks ========================= LOD d -> <--DSP> STO d -> <(++DSP)[d-1]> 2.2. Zwischen Daten- und Kontrollstack ================================= LODCS d -> <--DSP> STOCS d -> PUSHCS d -> <--CSP> 2.3. Vom aktuellen Template ====================== LITIDX d <--DSP> := 3. Änderungen der Stapelzeiger =========================== INCSP d DSP := DSP + d DECSP d DSP := DSP - d INCCSP d CSP := CSP + d Sonderbefehle ============= %print %svref %set-svref %closure-ref %symbol-function %set-symbol-function %symbol-value %set-symbol-value %eq %car %cdr %cons %consp %make-closure %make-vector Später zu implementierende Basisbefehle ======================================= Elementare gets =============== (defun get-byte (paddr offset) (defun get-hword (paddr offset) (defun get-word (paddr offset) Elementare sets =============== (defun set-byte (paddr offset i) (defun set-hword (paddr offset i) (defun set-word (paddr offset pval) Unsichere Funktionen ==================== (defun p-constr (v-high v-low) (defun p-add (p i) (defun p-shiftl (p i) (defun p-shiftr (n i) (defun p-align (x i) Tag-Funktionen ============== (defun tag-and (p tag-code) (defun tag-andc1 (p tag-code) (defun tag-ior (p tag-code) (defun tag-xor (p tag-code) (defun tag-not (p) (defun tag-eq (p tag-code) (defun get-tag (p) (defun tag-set (p tag-code) Addr-Funktionen =============== (defun addr-eq (p1 p2) * (defun addr-eqi (p1 i) * (defun addr-and (p i) * (defun addr-andc1 (p i) * (defun addr-ior (p i) * (defun get-addr (p) * Vergleich von Pointern ====================== (defun eq (x y) * Arithmetische Funktionen ======================== (defun %+ (x y) (defun %- (x y) (defun %* (x y) (defun %div (x y) (defun %/= (x y) (defun %= (x y) (defun %> (x y) (defun %< (x y) (defun %<= (x y) (defun %>= (x y) */ end