mask AuxMask aluOp[5:0] dispatch[6:6] to-page-zero[7:7] mtyp[9:8] use_aluOp_h[10:10] alusource[13:11]; endmask mask MainMask addro[31:27] datsource[26:22] datdest[21:17] cdspsource[16:14] cdspdest[13:11] pcbsource[10:8] readmem[7:7] writemem[6:6] next_mic[3:0]; endmask values alusource 0 datamem default 1 regA 2 regB 3 val_8 4 val_12 5 val_16 6 val_3 endvalues values use_aluOp_h default 0 no 1 yes endvalues values aluOp 0 plus 1 minus 2 lte 3 gte 4 lt 5 gt 6 eq 16 tag-and 17 tag-ior 18 tag-xor 19 tag-eq 20 get-tag 24 addr-eq 25 addr-eqi 26 addr-and 27 addr-ior 28 get-addr 32 palign3 33 calculateLenVect 34 setVectTag 35 plusAddr 36 compAddr 37 pConstr 38 pAdd 39 pShiftl 40 pShiftr default 63 opB endvalues values mtyp default 0 full 1 half 3 byte endvalues 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_plus_d 14 litbase-addr 15 dsp_plus_dm1 16 tos 17 regA_8 18 tp_4 29 val_32'h40 30 niladdr default 31 val_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 regE 11 pc_4 12 val_d 13 datamem2 14 regA2 16 val_8 17 val_12 18 val_16 19 val_3 20 vec_header_tag 21 clos_header_tag 23 zero 24 testpat default 31 val_32'bz endvalues values datdest 1 ir 3 tos 4 regA 5 regB 6 regC 7 regD 8 litbase 9 template 10 regA_inc_4 11 regE 12 inc_tos 13 dec_tos default 31 dummy 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 default 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 default 4 pc 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 = yes, next_mic = +; datdest = ir, datsource = datamem, dispatch = yes, next_mic = 0; /* 1. Kontrolltransfer ================ 1.1. Sprungbefehle ============= JNIL d Wenn <(DSP++)> = NIL then PC := PC + d else PC := PC + 4 */ :JNIL:11: pcbsource = pc-jnil, addro = dsp, readmem = yes, cdspsource = dsp_4, cdspdest = dsp_set_cdspbus, next_mic = +; datsource = datamem, datdest = tos, 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) */ :CALLCLOS:16: /* cdspsource = dsp_m_4, cdspdest = dsp_set_cdspbus, next_mic = +; addro = dsp, datsource = tos, writemem = yes, next_mic = +; */ addro = dsp_m_4, cdspsource = dsp_m_4, cdspdest = dsp_set_cdspbus, datsource = tos, writemem = yes, next_mic = +; addro = dsp_plus_dm1, readmem = yes, next_mic = +; datsource = datamem, datdest = regA, next_mic = +; /* datsource = val_d, datdest = tos, next_mic = +; addro = regA_8, readmem = yes, next_mic = +; */ addro = regA_8, datsource = val_d, datdest = tos, readmem = yes, next_mic = +; datsource = datamem, datdest = regB, cdspsource = csp_m_4, cdspdest = csp_set_cdspbus, next_mic = +; addro = csp, datsource = template, cdspsource = csp_m_4, cdspdest = csp_set_cdspbus, writemem = yes, next_mic = +; addro = csp, datsource = pc_4, writemem = yes, next_mic = +; datsource = regB, datdest = template, next_mic = +; datsource = litbase-addr, datdest = litbase, next_mic = +; addro = tp_4, readmem = yes, next_mic = +; to-page-zero = yes, pcbsource = datbus, datsource = datamem, next_mic = 0; /* CALLCLOSV (Anzahl Parameter liegt auf (DSP)) 1.3 Returns ======= RET */ :RET:18: addro = csp, readmem = yes, cdspsource = csp_4, cdspdest = csp_set_cdspbus, next_mic = +; addro = csp, readmem = yes, datsource = datamem, pcbsource = datbus, cdspsource=csp_4, cdspdest = csp_set_cdspbus, next_mic = +; datsource = datamem, datdest = template, next_mic = +; datsource = litbase-addr, datdest = litbase, to-page-zero = yes, next_mic = 0; /* 1.4. Halts und Interrupts ==================== HALT */ :HALT:30: next_mic = 0; /* EXCEPT d 2. Datentransfers ============== 2.1. Innerhalb des Datenstacks ========================= LOD d -> <--DSP> */ :LOD:1: addro = dsp_m_4, datsource = tos, writemem = yes, cdspsource = dsp_m_4, cdspdest = dsp_set_cdspbus, next_mic = +; addro = dsp_plus_d, readmem = yes, next_mic = +; datsource = datamem, datdest = tos, to-page-zero = yes, pcbsource = pc+4, next_mic = 0; /* STO d -> <(++DSP)[d-1]> */ :STO:3: addro = dsp_plus_dm1, datsource = tos, writemem = yes, next_mic = +; addro = dsp, readmem = yes, cdspsource = dsp_4, cdspdest = dsp_set_cdspbus, next_mic = +; datsource = datamem, datdest = tos, to-page-zero = yes, pcbsource = pc+4, next_mic = 0; /* LODNIL NIL -> <(++DSP)> */ :LODNIL:2: addro = dsp_m_4, datsource = tos, writemem = yes, cdspsource = dsp_m_4, cdspdest = dsp_set_cdspbus, next_mic = +; datsource = regC, datdest = tos, to-page-zero = yes, pcbsource = pc+4, next_mic = 0; /* 2.2. Zwischen Daten- und Kontrollstack ================================= LODCS d -> <--DSP> STOCS d -> PUSHCS d -> <--CSP> 2.3. Vom aktuellen Template ====================== LITIDX d <--DSP> := */ :LITIDX:4: addro = dsp_m_4, datsource = tos, writemem = yes, cdspsource = dsp_m_4, cdspdest = dsp_set_cdspbus, next_mic = +; addro = litbase_plus_d, readmem = yes, next_mic = +; datsource = datamem, datdest = tos, to-page-zero = yes, pcbsource = pc+4, next_mic = 0; /* 3. Änderungen der Stapelzeiger =========================== INCSP d DSP := DSP + d DECSP d DSP := DSP - d INCCSP d CSP := CSP + d */ :INCSP:5: cdspsource = dsp_m_4, cdspdest = dsp_set_cdspbus, next_mic = +; addro = dsp, datsource = tos, writemem = yes, next_mic = +; cdspsource = dsp_plus_d, cdspdest = dsp_set_cdspbus, next_mic = +; addro = dsp, readmem = yes, cdspsource = dsp_4, cdspdest = dsp_set_cdspbus, next_mic = +; datsource = datamem, datdest = tos, pcbsource = pc+4, to-page-zero = yes, next_mic = 0; :DECSP:6: cdspsource = dsp_m_4, cdspdest = dsp_set_cdspbus, next_mic = +; addro = dsp, datsource = tos, writemem = yes, next_mic = +; cdspsource = dsp_minus_d, cdspdest = dsp_set_cdspbus, next_mic = +; addro = dsp, readmem = yes, cdspsource = dsp_4, cdspdest = dsp_set_cdspbus, next_mic = +; datsource = datamem, datdest = tos, pcbsource = pc+4, to-page-zero = yes, next_mic = 0; :INCCSP:10: cdspsource = csp_plus_d, cdspdest = csp_set_cdspbus, pcbsource = pc+4, to-page-zero = yes, next_mic = 0; /* Sonderbefehle ============= %print */ :PRINT:60: addro = val_32'h40, datsource = tos, writemem = yes, next_mic = +; to-page-zero = yes, pcbsource = pc+4, next_mic = 0; /* %svref %set-svref %closure-ref %symbol-function %set-symbol-function */ :symbol-function:36: datsource = val_12, aluOp = plusAddr, use_aluOp_h = yes, next_mic = +; addro = aluOut, readmem = yes, next_mic = +; datsource = datamem, datdest = tos, to-page-zero = yes, pcbsource = pc+4, next_mic = 0; :set-symbol-function:37: datsource = tos, datdest = regA, next_mic = +; addro = dsp, cdspsource = dsp_4, cdspdest = dsp_set_cdspbus, readmem = yes, next_mic = +; datsource = datamem, datdest = tos, next_mic = +; datsource = val_12, aluOp = plusAddr, use_aluOp_h = yes, next_mic = +; addro = aluOut, datsource = regA, writemem = yes, next_mic = +; datsource = regA, datdest = tos, to-page-zero = yes, pcbsource = pc+4, next_mic = 0; /* %symbol-value %set-symbol-value %eq %car %cdr %cons %consp %make-closure */ :make-closure:41: datsource = tos, datdest = regA, next_mic = +; addro = dsp, readmem = yes, cdspsource = dsp_4, cdspdest = dsp_set_cdspbus, next_mic = +; datsource = datamem, datdest = regB, next_mic = +; datsource = regD, datdest = tos, next_mic = +; datsource = val_16, aluOp = plus, use_aluOp_h = yes, next_mic = +; datsource = aluOut, datdest = regD, next_mic = +; addro = tos, datsource = clos_header_tag, writemem = yes, next_mic = +; datsource = val_8, aluOp = plus, use_aluOp_h = yes, next_mic = +; addro = aluOut, datsource = regB, writemem = yes, next_mic = +; datsource = val_12, aluOp = plus, use_aluOp_h = yes, next_mic = +; addro = aluOut, datsource = regA, writemem = yes, next_mic = +; aluOp = setVectTag, use_aluOp_h = yes, next_mic = +; datsource = aluOut, datdest = tos, to-page-zero = yes, pcbsource = pc+4, next_mic = 0; /* %make-vector */ :make-vector:40: datsource = tos, datdest = regE, next_mic = +; aluOp = calculateLenVect, use_aluOp_h = yes, next_mic = +; datsource = aluOut, datdest = tos, next_mic = +; aluOp = palign3, datsource = val_3, use_aluOp_h = yes, next_mic = +; datsource = aluOut, datdest = regB, next_mic = +; datsource = regD, datdest = tos, next_mic = +; datsource = regB, aluOp = plus, use_aluOp_h = yes, next_mic = +; datsource = aluOut, datdest = regD, next_mic = +; addro = tos, datsource = vec_header_tag, writemem = yes, next_mic = +; datdest = inc_tos, next_mic = +; addro = tos, datsource = regE, writemem = yes, next_mic = +; datdest = dec_tos, next_mic = +; aluOp = setVectTag, use_aluOp_h = yes, next_mic = +; datsource = aluOut, datdest = tos, to-page-zero = yes, pcbsource = pc+4, next_mic = 0; /* Später zu implementierende Basisbefehle ======================================= Elementare gets =============== (defun get-byte (paddr offset) */ :get-byte:48: addro = dsp, readmem = yes, cdspsource = dsp_4, cdspdest = dsp_set_cdspbus, next_mic = +; datsource = datamem, aluOp = compAddr, use_aluOp_h = yes, next_mic = +; addro = aluOut, readmem = yes, mtyp = byte, next_mic = +; datsource = datamem2, datdest = tos, to-page-zero = yes, pcbsource = pc+4, next_mic = 0; /* (defun get-hword (paddr offset) (defun get-word (paddr offset) */ :get-word:50: addro = dsp, readmem = yes, cdspsource = dsp_4, cdspdest = dsp_set_cdspbus, next_mic = +; datsource = datamem, aluOp = compAddr, use_aluOp_h = yes, next_mic = +; addro = aluOut, readmem = yes, next_mic = +; datsource = datamem, datdest = tos, to-page-zero = yes, pcbsource = pc+4, next_mic = 0; /* Elementare sets =============== (defun set-byte (paddr offset i) (defun set-hword (paddr offset i) (defun set-word (paddr offset pval) */ :set-byte:49: datsource = tos, datdest = regA, addro = dsp, readmem = yes, next_mic = +; datsource = datamem, datdest = tos, cdspsource = dsp_4, cdspdest = dsp_set_cdspbus, next_mic = +; addro = dsp, readmem = yes, cdspsource = dsp_4, cdspdest = dsp_set_cdspbus, next_mic = +; datsource = datamem, aluOp = compAddr, use_aluOp_h = yes, next_mic = +; addro = aluOut, datsource = regA2, writemem = yes, mtyp = byte, next_mic = +; datsource = regA, datdest = tos, to-page-zero = yes, pcbsource = pc+4, next_mic = 0; :set-word:51: datsource = tos, datdest = regA, addro = dsp, readmem = yes, next_mic = +; datsource = datamem, datdest = tos, cdspsource = dsp_4, cdspdest = dsp_set_cdspbus, next_mic = +; addro = dsp, readmem = yes, cdspsource = dsp_4, cdspdest = dsp_set_cdspbus, next_mic = +; datsource = datamem, aluOp = compAddr, use_aluOp_h = yes, next_mic = +; addro = aluOut, datsource = regA, writemem = yes, next_mic = +; datsource = regA, datdest = tos, to-page-zero = yes, pcbsource = pc+4, next_mic = 0; /* 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) */ :ALUOPS:32: addro = dsp, readmem = yes, cdspsource = dsp_4, cdspdest = dsp_set_cdspbus, next_mic = +; datsource = datamem, next_mic = +; datsource = aluOut, datdest = tos, to-page-zero = yes, pcbsource = pc+4, next_mic = 0; :ALUOPS1:33: next_mic = +; datsource = aluOut, datdest = tos, to-page-zero = yes, pcbsource = pc+4, next_mic = 0; :INITCPU:63: datsource = zero, datdest = regA, next_mic = +; addro = regA, readmem = yes, datdest = regA_inc_4, next_mic = +; datsource = datamem, datdest = regC, next_mic = +; addro = regA, readmem = yes, datdest = regA_inc_4, next_mic = +; datsource = datamem, datdest = template, next_mic = +; datsource = litbase-addr, datdest = litbase, next_mic = +; addro = tp_4, readmem = yes, next_mic = +; datsource = datamem, pcbsource = datbus, next_mic = +; addro = regA, readmem = yes, next_mic = +; datsource = datamem, datdest = regD, next_mic = +; datsource = regC, datdest = tos, to-page-zero = yes, next_mic = 0; end