punk@29
|
1
|
punk@29
|
2 import Trace::*;
|
punk@29
|
3
|
punk@29
|
4 //----------------------------------------------------------------------
|
punk@29
|
5 // Trace
|
punk@29
|
6 //----------------------------------------------------------------------
|
punk@29
|
7
|
punk@29
|
8 instance Traceable#(Instr);
|
punk@29
|
9
|
punk@29
|
10 function Action traceTiny( String loc, String ttag, Instr inst );
|
punk@29
|
11 case ( inst ) matches
|
punk@29
|
12
|
punk@29
|
13 tagged LW .it : $fdisplay(stderr, " => %s:%s lw", loc, ttag );
|
punk@29
|
14 tagged SW .it : $fdisplay(stderr, " => %s:%s sw", loc, ttag );
|
punk@29
|
15
|
punk@29
|
16 tagged ADDIU .it : $fdisplay(stderr, " => %s:%s addi", loc, ttag );
|
punk@29
|
17 tagged SLTI .it : $fdisplay(stderr, " => %s:%s sli", loc, ttag );
|
punk@29
|
18 tagged SLTIU .it : $fdisplay(stderr, " => %s:%s sliu", loc, ttag );
|
punk@29
|
19 tagged ANDI .it : $fdisplay(stderr, " => %s:%s andi", loc, ttag );
|
punk@29
|
20 tagged ORI .it : $fdisplay(stderr, " => %s:%s ori", loc, ttag );
|
punk@29
|
21 tagged XORI .it : $fdisplay(stderr, " => %s:%s xori", loc, ttag );
|
punk@29
|
22 tagged LUI .it : $fdisplay(stderr, " => %s:%s lui", loc, ttag );
|
punk@29
|
23
|
punk@29
|
24 tagged SLL .it : $fdisplay(stderr, " => %s:%s sll", loc, ttag );
|
punk@29
|
25 tagged SRL .it : $fdisplay(stderr, " => %s:%s srl", loc, ttag );
|
punk@29
|
26 tagged SRA .it : $fdisplay(stderr, " => %s:%s sra", loc, ttag );
|
punk@29
|
27 tagged SLLV .it : $fdisplay(stderr, " => %s:%s sllv", loc, ttag );
|
punk@29
|
28 tagged SRLV .it : $fdisplay(stderr, " => %s:%s srlv", loc, ttag );
|
punk@29
|
29 tagged SRAV .it : $fdisplay(stderr, " => %s:%s srav", loc, ttag );
|
punk@29
|
30
|
punk@29
|
31 tagged ADDU .it : $fdisplay(stderr, " => %s:%s addu", loc, ttag );
|
punk@29
|
32 tagged SUBU .it : $fdisplay(stderr, " => %s:%s subu", loc, ttag );
|
punk@29
|
33 tagged AND .it : $fdisplay(stderr, " => %s:%s and", loc, ttag );
|
punk@29
|
34 tagged OR .it : $fdisplay(stderr, " => %s:%s or", loc, ttag );
|
punk@29
|
35 tagged XOR .it : $fdisplay(stderr, " => %s:%s xor", loc, ttag );
|
punk@29
|
36 tagged NOR .it : $fdisplay(stderr, " => %s:%s nor", loc, ttag );
|
punk@29
|
37 tagged SLT .it : $fdisplay(stderr, " => %s:%s slt", loc, ttag );
|
punk@29
|
38 tagged SLTU .it : $fdisplay(stderr, " => %s:%s sltu", loc, ttag );
|
punk@29
|
39
|
punk@29
|
40 tagged J .it : $fdisplay(stderr, " => %s:%s j", loc, ttag );
|
punk@29
|
41 tagged JAL .it : $fdisplay(stderr, " => %s:%s jal", loc, ttag );
|
punk@29
|
42 tagged JR .it : $fdisplay(stderr, " => %s:%s jr", loc, ttag );
|
punk@29
|
43 tagged JALR .it : $fdisplay(stderr, " => %s:%s jalr", loc, ttag );
|
punk@29
|
44 tagged BEQ .it : $fdisplay(stderr, " => %s:%s beq", loc, ttag );
|
punk@29
|
45 tagged BNE .it : $fdisplay(stderr, " => %s:%s bne", loc, ttag );
|
punk@29
|
46 tagged BLEZ .it : $fdisplay(stderr, " => %s:%s blez", loc, ttag );
|
punk@29
|
47 tagged BGTZ .it : $fdisplay(stderr, " => %s:%s bgtz", loc, ttag );
|
punk@29
|
48 tagged BLTZ .it : $fdisplay(stderr, " => %s:%s bltz", loc, ttag );
|
punk@29
|
49 tagged BGEZ .it : $fdisplay(stderr, " => %s:%s bgez", loc, ttag );
|
punk@29
|
50
|
punk@29
|
51 tagged MFC0 .it : $fdisplay(stderr, " => %s:%s mfc0", loc, ttag );
|
punk@29
|
52 tagged MTC0 .it : $fdisplay(stderr, " => %s:%s mtc0", loc, ttag );
|
punk@29
|
53
|
punk@29
|
54 tagged ILLEGAL : $fdisplay(stderr, " => %s:%s ill", loc, ttag );
|
punk@29
|
55
|
punk@29
|
56 endcase
|
punk@29
|
57 endfunction
|
punk@29
|
58
|
punk@29
|
59 function Action traceFull( String loc, String ttag, Instr inst );
|
punk@29
|
60 case ( inst ) matches
|
punk@29
|
61
|
punk@29
|
62 tagged LW .it : $fdisplay(stderr, " => %s:%s lw r%0d, 0x%x(r%0d)", loc, ttag, it.rdst, it.offset, it.rbase );
|
punk@29
|
63 tagged SW .it : $fdisplay(stderr, " => %s:%s sw r%0d, 0x%x(r%0d)", loc, ttag, it.rsrc, it.offset, it.rbase );
|
punk@29
|
64
|
punk@29
|
65 tagged ADDIU .it : $fdisplay(stderr, " => %s:%s addiu r%0d, r%0d, 0x%x", loc, ttag, it.rdst, it.rsrc, it.imm );
|
punk@29
|
66 tagged SLTI .it : $fdisplay(stderr, " => %s:%s slti r%0d, r%0d, 0x%x", loc, ttag, it.rdst, it.rsrc, it.imm );
|
punk@29
|
67 tagged SLTIU .it : $fdisplay(stderr, " => %s:%s sltiu r%0d, r%0d, 0x%x", loc, ttag, it.rdst, it.rsrc, it.imm );
|
punk@29
|
68 tagged ANDI .it : $fdisplay(stderr, " => %s:%s andi r%0d, r%0d, 0x%x", loc, ttag, it.rdst, it.rsrc, it.imm );
|
punk@29
|
69 tagged ORI .it : $fdisplay(stderr, " => %s:%s ori r%0d, r%0d, 0x%x", loc, ttag, it.rdst, it.rsrc, it.imm );
|
punk@29
|
70 tagged XORI .it : $fdisplay(stderr, " => %s:%s xori r%0d, r%0d, 0x%x", loc, ttag, it.rdst, it.rsrc, it.imm );
|
punk@29
|
71 tagged LUI .it : $fdisplay(stderr, " => %s:%s lui r%0d, 0x%x", loc, ttag, it.rdst, it.imm );
|
punk@29
|
72
|
punk@29
|
73 tagged SLL .it : $fdisplay(stderr, " => %s:%s sll r%0d, r%0d, %0d", loc, ttag, it.rdst, it.rsrc, it.shamt );
|
punk@29
|
74 tagged SRL .it : $fdisplay(stderr, " => %s:%s srl r%0d, r%0d, %0d", loc, ttag, it.rdst, it.rsrc, it.shamt );
|
punk@29
|
75 tagged SRA .it : $fdisplay(stderr, " => %s:%s sra r%0d, r%0d, %0d", loc, ttag, it.rdst, it.rsrc, it.shamt );
|
punk@29
|
76 tagged SLLV .it : $fdisplay(stderr, " => %s:%s sllv r%0d, r%0d, r%0d", loc, ttag, it.rdst, it.rsrc, it.rshamt );
|
punk@29
|
77 tagged SRLV .it : $fdisplay(stderr, " => %s:%s srlv r%0d, r%0d, r%0d", loc, ttag, it.rdst, it.rsrc, it.rshamt );
|
punk@29
|
78 tagged SRAV .it : $fdisplay(stderr, " => %s:%s srav r%0d, r%0d, r%0d", loc, ttag, it.rdst, it.rsrc, it.rshamt );
|
punk@29
|
79
|
punk@29
|
80 tagged ADDU .it : $fdisplay(stderr, " => %s:%s addu r%0d, r%0d, r%0d", loc, ttag, it.rdst, it.rsrc1, it.rsrc2 );
|
punk@29
|
81 tagged SUBU .it : $fdisplay(stderr, " => %s:%s subu r%0d, r%0d, r%0d", loc, ttag, it.rdst, it.rsrc1, it.rsrc2 );
|
punk@29
|
82 tagged AND .it : $fdisplay(stderr, " => %s:%s and r%0d, r%0d, r%0d", loc, ttag, it.rdst, it.rsrc1, it.rsrc2 );
|
punk@29
|
83 tagged OR .it : $fdisplay(stderr, " => %s:%s or r%0d, r%0d, r%0d", loc, ttag, it.rdst, it.rsrc1, it.rsrc2 );
|
punk@29
|
84 tagged XOR .it : $fdisplay(stderr, " => %s:%s xor r%0d, r%0d, r%0d", loc, ttag, it.rdst, it.rsrc1, it.rsrc2 );
|
punk@29
|
85 tagged NOR .it : $fdisplay(stderr, " => %s:%s nor r%0d, r%0d, r%0d", loc, ttag, it.rdst, it.rsrc1, it.rsrc2 );
|
punk@29
|
86 tagged SLT .it : $fdisplay(stderr, " => %s:%s slt r%0d, r%0d, r%0d", loc, ttag, it.rdst, it.rsrc1, it.rsrc2 );
|
punk@29
|
87 tagged SLTU .it : $fdisplay(stderr, " => %s:%s sltu r%0d, r%0d, r%0d", loc, ttag, it.rdst, it.rsrc1, it.rsrc2 );
|
punk@29
|
88
|
punk@29
|
89 tagged J .it : $fdisplay(stderr, " => %s:%s j 0x%x", loc, ttag, it.target );
|
punk@29
|
90 tagged JAL .it : $fdisplay(stderr, " => %s:%s jal 0x%x", loc, ttag, it.target );
|
punk@29
|
91 tagged JR .it : $fdisplay(stderr, " => %s:%s jr r%0d", loc, ttag, it.rsrc );
|
punk@29
|
92 tagged JALR .it : $fdisplay(stderr, " => %s:%s jalr r%0d", loc, ttag, it.rsrc );
|
punk@29
|
93 tagged BEQ .it : $fdisplay(stderr, " => %s:%s beq r%0d, r%0d, 0x%x", loc, ttag, it.rsrc1, it.rsrc2, it.offset );
|
punk@29
|
94 tagged BNE .it : $fdisplay(stderr, " => %s:%s bne r%0d, r%0d, 0x%x", loc, ttag, it.rsrc1, it.rsrc2, it.offset );
|
punk@29
|
95 tagged BLEZ .it : $fdisplay(stderr, " => %s:%s blez r%0d, 0x%x", loc, ttag, it.rsrc, it.offset );
|
punk@29
|
96 tagged BGTZ .it : $fdisplay(stderr, " => %s:%s bgtz r%0d, 0x%x", loc, ttag, it.rsrc, it.offset );
|
punk@29
|
97 tagged BLTZ .it : $fdisplay(stderr, " => %s:%s bltz r%0d, 0x%x", loc, ttag, it.rsrc, it.offset );
|
punk@29
|
98 tagged BGEZ .it : $fdisplay(stderr, " => %s:%s bgez r%0d, 0x%x", loc, ttag, it.rsrc, it.offset );
|
punk@29
|
99
|
punk@29
|
100 tagged MFC0 .it : $fdisplay(stderr, " => %s:%s mfc0 r%0d, cpr%0d", loc, ttag, it.rdst, it.cop0src );
|
punk@29
|
101 tagged MTC0 .it : $fdisplay(stderr, " => %s:%s mtc0 r%0d, cpr%0d", loc, ttag, it.rsrc, it.cop0dst );
|
punk@29
|
102
|
punk@29
|
103 tagged ILLEGAL : $fdisplay(stderr, " => %s:%s illegal instruction", loc, ttag );
|
punk@29
|
104
|
punk@29
|
105 endcase
|
punk@29
|
106 endfunction
|
punk@29
|
107
|
punk@29
|
108 endinstance
|
punk@29
|
109
|