comparison modules/bluespec/Pygar/lab4/ProcTrace.bsv @ 29:9830ff8fb0bd pygar svn.30

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