punk@29: punk@29: import Trace::*; punk@29: punk@29: //---------------------------------------------------------------------- punk@29: // Trace punk@29: //---------------------------------------------------------------------- punk@29: punk@29: instance Traceable#(Instr); punk@29: punk@29: function Action traceTiny( String loc, String ttag, Instr inst ); punk@29: case ( inst ) matches punk@29: punk@29: tagged LW .it : $fdisplay(stderr, " => %s:%s lw", loc, ttag ); punk@29: tagged SW .it : $fdisplay(stderr, " => %s:%s sw", loc, ttag ); punk@29: punk@29: tagged ADDIU .it : $fdisplay(stderr, " => %s:%s addi", loc, ttag ); punk@29: tagged SLTI .it : $fdisplay(stderr, " => %s:%s sli", loc, ttag ); punk@29: tagged SLTIU .it : $fdisplay(stderr, " => %s:%s sliu", loc, ttag ); punk@29: tagged ANDI .it : $fdisplay(stderr, " => %s:%s andi", loc, ttag ); punk@29: tagged ORI .it : $fdisplay(stderr, " => %s:%s ori", loc, ttag ); punk@29: tagged XORI .it : $fdisplay(stderr, " => %s:%s xori", loc, ttag ); punk@29: tagged LUI .it : $fdisplay(stderr, " => %s:%s lui", loc, ttag ); punk@29: punk@29: tagged SLL .it : $fdisplay(stderr, " => %s:%s sll", loc, ttag ); punk@29: tagged SRL .it : $fdisplay(stderr, " => %s:%s srl", loc, ttag ); punk@29: tagged SRA .it : $fdisplay(stderr, " => %s:%s sra", loc, ttag ); punk@29: tagged SLLV .it : $fdisplay(stderr, " => %s:%s sllv", loc, ttag ); punk@29: tagged SRLV .it : $fdisplay(stderr, " => %s:%s srlv", loc, ttag ); punk@29: tagged SRAV .it : $fdisplay(stderr, " => %s:%s srav", loc, ttag ); punk@29: punk@29: tagged ADDU .it : $fdisplay(stderr, " => %s:%s addu", loc, ttag ); punk@29: tagged SUBU .it : $fdisplay(stderr, " => %s:%s subu", loc, ttag ); punk@29: tagged AND .it : $fdisplay(stderr, " => %s:%s and", loc, ttag ); punk@29: tagged OR .it : $fdisplay(stderr, " => %s:%s or", loc, ttag ); punk@29: tagged XOR .it : $fdisplay(stderr, " => %s:%s xor", loc, ttag ); punk@29: tagged NOR .it : $fdisplay(stderr, " => %s:%s nor", loc, ttag ); punk@29: tagged SLT .it : $fdisplay(stderr, " => %s:%s slt", loc, ttag ); punk@29: tagged SLTU .it : $fdisplay(stderr, " => %s:%s sltu", loc, ttag ); punk@29: punk@29: tagged J .it : $fdisplay(stderr, " => %s:%s j", loc, ttag ); punk@29: tagged JAL .it : $fdisplay(stderr, " => %s:%s jal", loc, ttag ); punk@29: tagged JR .it : $fdisplay(stderr, " => %s:%s jr", loc, ttag ); punk@29: tagged JALR .it : $fdisplay(stderr, " => %s:%s jalr", loc, ttag ); punk@29: tagged BEQ .it : $fdisplay(stderr, " => %s:%s beq", loc, ttag ); punk@29: tagged BNE .it : $fdisplay(stderr, " => %s:%s bne", loc, ttag ); punk@29: tagged BLEZ .it : $fdisplay(stderr, " => %s:%s blez", loc, ttag ); punk@29: tagged BGTZ .it : $fdisplay(stderr, " => %s:%s bgtz", loc, ttag ); punk@29: tagged BLTZ .it : $fdisplay(stderr, " => %s:%s bltz", loc, ttag ); punk@29: tagged BGEZ .it : $fdisplay(stderr, " => %s:%s bgez", loc, ttag ); punk@29: punk@29: tagged MFC0 .it : $fdisplay(stderr, " => %s:%s mfc0", loc, ttag ); punk@29: tagged MTC0 .it : $fdisplay(stderr, " => %s:%s mtc0", loc, ttag ); punk@29: punk@29: tagged ILLEGAL : $fdisplay(stderr, " => %s:%s ill", loc, ttag ); punk@29: punk@29: endcase punk@29: endfunction punk@29: punk@29: function Action traceFull( String loc, String ttag, Instr inst ); punk@29: case ( inst ) matches punk@29: punk@29: tagged LW .it : $fdisplay(stderr, " => %s:%s lw r%0d, 0x%x(r%0d)", loc, ttag, it.rdst, it.offset, it.rbase ); punk@29: tagged SW .it : $fdisplay(stderr, " => %s:%s sw r%0d, 0x%x(r%0d)", loc, ttag, it.rsrc, it.offset, it.rbase ); punk@29: punk@29: tagged ADDIU .it : $fdisplay(stderr, " => %s:%s addiu r%0d, r%0d, 0x%x", loc, ttag, it.rdst, it.rsrc, it.imm ); punk@29: tagged SLTI .it : $fdisplay(stderr, " => %s:%s slti r%0d, r%0d, 0x%x", loc, ttag, it.rdst, it.rsrc, it.imm ); punk@29: tagged SLTIU .it : $fdisplay(stderr, " => %s:%s sltiu r%0d, r%0d, 0x%x", loc, ttag, it.rdst, it.rsrc, it.imm ); punk@29: tagged ANDI .it : $fdisplay(stderr, " => %s:%s andi r%0d, r%0d, 0x%x", loc, ttag, it.rdst, it.rsrc, it.imm ); punk@29: tagged ORI .it : $fdisplay(stderr, " => %s:%s ori r%0d, r%0d, 0x%x", loc, ttag, it.rdst, it.rsrc, it.imm ); punk@29: tagged XORI .it : $fdisplay(stderr, " => %s:%s xori r%0d, r%0d, 0x%x", loc, ttag, it.rdst, it.rsrc, it.imm ); punk@29: tagged LUI .it : $fdisplay(stderr, " => %s:%s lui r%0d, 0x%x", loc, ttag, it.rdst, it.imm ); punk@29: punk@29: tagged SLL .it : $fdisplay(stderr, " => %s:%s sll r%0d, r%0d, %0d", loc, ttag, it.rdst, it.rsrc, it.shamt ); punk@29: tagged SRL .it : $fdisplay(stderr, " => %s:%s srl r%0d, r%0d, %0d", loc, ttag, it.rdst, it.rsrc, it.shamt ); punk@29: tagged SRA .it : $fdisplay(stderr, " => %s:%s sra r%0d, r%0d, %0d", loc, ttag, it.rdst, it.rsrc, it.shamt ); punk@29: tagged SLLV .it : $fdisplay(stderr, " => %s:%s sllv r%0d, r%0d, r%0d", loc, ttag, it.rdst, it.rsrc, it.rshamt ); punk@29: tagged SRLV .it : $fdisplay(stderr, " => %s:%s srlv r%0d, r%0d, r%0d", loc, ttag, it.rdst, it.rsrc, it.rshamt ); punk@29: tagged SRAV .it : $fdisplay(stderr, " => %s:%s srav r%0d, r%0d, r%0d", loc, ttag, it.rdst, it.rsrc, it.rshamt ); punk@29: punk@29: tagged ADDU .it : $fdisplay(stderr, " => %s:%s addu r%0d, r%0d, r%0d", loc, ttag, it.rdst, it.rsrc1, it.rsrc2 ); punk@29: tagged SUBU .it : $fdisplay(stderr, " => %s:%s subu r%0d, r%0d, r%0d", loc, ttag, it.rdst, it.rsrc1, it.rsrc2 ); punk@29: tagged AND .it : $fdisplay(stderr, " => %s:%s and r%0d, r%0d, r%0d", loc, ttag, it.rdst, it.rsrc1, it.rsrc2 ); punk@29: tagged OR .it : $fdisplay(stderr, " => %s:%s or r%0d, r%0d, r%0d", loc, ttag, it.rdst, it.rsrc1, it.rsrc2 ); punk@29: tagged XOR .it : $fdisplay(stderr, " => %s:%s xor r%0d, r%0d, r%0d", loc, ttag, it.rdst, it.rsrc1, it.rsrc2 ); punk@29: tagged NOR .it : $fdisplay(stderr, " => %s:%s nor r%0d, r%0d, r%0d", loc, ttag, it.rdst, it.rsrc1, it.rsrc2 ); punk@29: tagged SLT .it : $fdisplay(stderr, " => %s:%s slt r%0d, r%0d, r%0d", loc, ttag, it.rdst, it.rsrc1, it.rsrc2 ); punk@29: tagged SLTU .it : $fdisplay(stderr, " => %s:%s sltu r%0d, r%0d, r%0d", loc, ttag, it.rdst, it.rsrc1, it.rsrc2 ); punk@29: punk@29: tagged J .it : $fdisplay(stderr, " => %s:%s j 0x%x", loc, ttag, it.target ); punk@29: tagged JAL .it : $fdisplay(stderr, " => %s:%s jal 0x%x", loc, ttag, it.target ); punk@29: tagged JR .it : $fdisplay(stderr, " => %s:%s jr r%0d", loc, ttag, it.rsrc ); punk@29: tagged JALR .it : $fdisplay(stderr, " => %s:%s jalr r%0d", loc, ttag, it.rsrc ); punk@29: tagged BEQ .it : $fdisplay(stderr, " => %s:%s beq r%0d, r%0d, 0x%x", loc, ttag, it.rsrc1, it.rsrc2, it.offset ); punk@29: tagged BNE .it : $fdisplay(stderr, " => %s:%s bne r%0d, r%0d, 0x%x", loc, ttag, it.rsrc1, it.rsrc2, it.offset ); punk@29: tagged BLEZ .it : $fdisplay(stderr, " => %s:%s blez r%0d, 0x%x", loc, ttag, it.rsrc, it.offset ); punk@29: tagged BGTZ .it : $fdisplay(stderr, " => %s:%s bgtz r%0d, 0x%x", loc, ttag, it.rsrc, it.offset ); punk@29: tagged BLTZ .it : $fdisplay(stderr, " => %s:%s bltz r%0d, 0x%x", loc, ttag, it.rsrc, it.offset ); punk@29: tagged BGEZ .it : $fdisplay(stderr, " => %s:%s bgez r%0d, 0x%x", loc, ttag, it.rsrc, it.offset ); punk@29: punk@29: tagged MFC0 .it : $fdisplay(stderr, " => %s:%s mfc0 r%0d, cpr%0d", loc, ttag, it.rdst, it.cop0src ); punk@29: tagged MTC0 .it : $fdisplay(stderr, " => %s:%s mtc0 r%0d, cpr%0d", loc, ttag, it.rsrc, it.cop0dst ); punk@29: punk@29: tagged ILLEGAL : $fdisplay(stderr, " => %s:%s illegal instruction", loc, ttag ); punk@29: punk@29: endcase punk@29: endfunction punk@29: punk@29: endinstance punk@29: