diff 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
line wrap: on
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/modules/bluespec/Pygar/lab4/ProcTrace.bsv	Fri Apr 30 09:13:38 2010 -0400
     1.3 @@ -0,0 +1,109 @@
     1.4 +
     1.5 +import Trace::*;
     1.6 +
     1.7 +//----------------------------------------------------------------------
     1.8 +// Trace
     1.9 +//----------------------------------------------------------------------
    1.10 +
    1.11 +instance Traceable#(Instr);
    1.12 +
    1.13 +  function Action traceTiny( String loc, String ttag, Instr inst );
    1.14 +    case ( inst ) matches
    1.15 +
    1.16 +      tagged LW    .it : $fdisplay(stderr,  " => %s:%s lw", loc,   ttag );
    1.17 +      tagged SW    .it : $fdisplay(stderr,  " => %s:%s sw", loc,   ttag );
    1.18 +
    1.19 +      tagged ADDIU .it : $fdisplay(stderr,  " => %s:%s addi", loc, ttag );
    1.20 +      tagged SLTI  .it : $fdisplay(stderr,  " => %s:%s sli", loc,  ttag );
    1.21 +      tagged SLTIU .it : $fdisplay(stderr,  " => %s:%s sliu", loc, ttag );
    1.22 +      tagged ANDI  .it : $fdisplay(stderr,  " => %s:%s andi", loc, ttag );
    1.23 +      tagged ORI   .it : $fdisplay(stderr,  " => %s:%s ori", loc,  ttag );
    1.24 +      tagged XORI  .it : $fdisplay(stderr,  " => %s:%s xori", loc, ttag );
    1.25 +      tagged LUI   .it : $fdisplay(stderr,  " => %s:%s lui", loc,  ttag );
    1.26 +                                          
    1.27 +      tagged SLL   .it : $fdisplay(stderr,  " => %s:%s sll", loc,  ttag );
    1.28 +      tagged SRL   .it : $fdisplay(stderr,  " => %s:%s srl", loc,  ttag );
    1.29 +      tagged SRA   .it : $fdisplay(stderr,  " => %s:%s sra", loc,  ttag );
    1.30 +      tagged SLLV  .it : $fdisplay(stderr,  " => %s:%s sllv", loc, ttag );
    1.31 +      tagged SRLV  .it : $fdisplay(stderr,  " => %s:%s srlv", loc, ttag );
    1.32 +      tagged SRAV  .it : $fdisplay(stderr,  " => %s:%s srav", loc, ttag );
    1.33 +                                          
    1.34 +      tagged ADDU  .it : $fdisplay(stderr,  " => %s:%s addu", loc, ttag );
    1.35 +      tagged SUBU  .it : $fdisplay(stderr,  " => %s:%s subu", loc, ttag );
    1.36 +      tagged AND   .it : $fdisplay(stderr,  " => %s:%s and", loc,  ttag );
    1.37 +      tagged OR    .it : $fdisplay(stderr,  " => %s:%s or", loc,   ttag );
    1.38 +      tagged XOR   .it : $fdisplay(stderr,  " => %s:%s xor", loc,  ttag );
    1.39 +      tagged NOR   .it : $fdisplay(stderr,  " => %s:%s nor", loc,  ttag );
    1.40 +      tagged SLT   .it : $fdisplay(stderr,  " => %s:%s slt", loc,  ttag );
    1.41 +      tagged SLTU  .it : $fdisplay(stderr,  " => %s:%s sltu", loc, ttag );
    1.42 +                                          
    1.43 +      tagged J     .it : $fdisplay(stderr,  " => %s:%s j", loc,    ttag );
    1.44 +      tagged JAL   .it : $fdisplay(stderr,  " => %s:%s jal", loc,  ttag );
    1.45 +      tagged JR    .it : $fdisplay(stderr,  " => %s:%s jr", loc,   ttag );
    1.46 +      tagged JALR  .it : $fdisplay(stderr,  " => %s:%s jalr", loc, ttag );
    1.47 +      tagged BEQ   .it : $fdisplay(stderr,  " => %s:%s beq", loc,  ttag );
    1.48 +      tagged BNE   .it : $fdisplay(stderr,  " => %s:%s bne", loc,  ttag );
    1.49 +      tagged BLEZ  .it : $fdisplay(stderr,  " => %s:%s blez", loc, ttag );
    1.50 +      tagged BGTZ  .it : $fdisplay(stderr,  " => %s:%s bgtz", loc, ttag );
    1.51 +      tagged BLTZ  .it : $fdisplay(stderr,  " => %s:%s bltz", loc, ttag );
    1.52 +      tagged BGEZ  .it : $fdisplay(stderr,  " => %s:%s bgez", loc, ttag );
    1.53 +                                           
    1.54 +      tagged MFC0  .it : $fdisplay(stderr,  " => %s:%s mfc0", loc, ttag );
    1.55 +      tagged MTC0  .it : $fdisplay(stderr,  " => %s:%s mtc0", loc, ttag );
    1.56 +
    1.57 +      tagged ILLEGAL   : $fdisplay(stderr,  " => %s:%s ill", loc,  ttag );
    1.58 +
    1.59 +    endcase
    1.60 +  endfunction
    1.61 +
    1.62 +  function Action traceFull( String loc, String ttag, Instr inst );
    1.63 +    case ( inst ) matches
    1.64 +
    1.65 +      tagged LW    .it : $fdisplay(stderr,  " => %s:%s lw r%0d, 0x%x(r%0d)", loc, ttag, it.rdst, it.offset, it.rbase );
    1.66 +      tagged SW    .it : $fdisplay(stderr,  " => %s:%s sw r%0d, 0x%x(r%0d)", loc, ttag, it.rsrc, it.offset, it.rbase );
    1.67 +
    1.68 +      tagged ADDIU .it : $fdisplay(stderr,  " => %s:%s addiu r%0d, r%0d, 0x%x", loc, ttag, it.rdst, it.rsrc, it.imm );
    1.69 +      tagged SLTI  .it : $fdisplay(stderr,  " => %s:%s slti r%0d, r%0d, 0x%x", loc,  ttag, it.rdst, it.rsrc, it.imm );
    1.70 +      tagged SLTIU .it : $fdisplay(stderr,  " => %s:%s sltiu r%0d, r%0d, 0x%x", loc, ttag, it.rdst, it.rsrc, it.imm );
    1.71 +      tagged ANDI  .it : $fdisplay(stderr,  " => %s:%s andi r%0d, r%0d, 0x%x", loc,  ttag, it.rdst, it.rsrc, it.imm );
    1.72 +      tagged ORI   .it : $fdisplay(stderr,  " => %s:%s ori r%0d, r%0d, 0x%x", loc,   ttag, it.rdst, it.rsrc, it.imm );
    1.73 +      tagged XORI  .it : $fdisplay(stderr,  " => %s:%s xori r%0d, r%0d, 0x%x", loc,  ttag, it.rdst, it.rsrc, it.imm );
    1.74 +      tagged LUI   .it : $fdisplay(stderr,  " => %s:%s lui r%0d, 0x%x", loc,         ttag, it.rdst, it.imm );
    1.75 +                                      
    1.76 +      tagged SLL   .it : $fdisplay(stderr,  " => %s:%s sll r%0d, r%0d, %0d", loc,   ttag, it.rdst, it.rsrc, it.shamt );
    1.77 +      tagged SRL   .it : $fdisplay(stderr,  " => %s:%s srl r%0d, r%0d, %0d", loc,   ttag, it.rdst, it.rsrc, it.shamt );
    1.78 +      tagged SRA   .it : $fdisplay(stderr,  " => %s:%s sra r%0d, r%0d, %0d", loc,   ttag, it.rdst, it.rsrc, it.shamt );
    1.79 +      tagged SLLV  .it : $fdisplay(stderr,  " => %s:%s sllv r%0d, r%0d, r%0d", loc, ttag, it.rdst, it.rsrc, it.rshamt );
    1.80 +      tagged SRLV  .it : $fdisplay(stderr,  " => %s:%s srlv r%0d, r%0d, r%0d", loc, ttag, it.rdst, it.rsrc, it.rshamt );
    1.81 +      tagged SRAV  .it : $fdisplay(stderr,  " => %s:%s srav r%0d, r%0d, r%0d", loc, ttag, it.rdst, it.rsrc, it.rshamt );
    1.82 +                                      
    1.83 +      tagged ADDU  .it : $fdisplay(stderr,  " => %s:%s addu r%0d, r%0d, r%0d", loc, ttag, it.rdst, it.rsrc1, it.rsrc2 );
    1.84 +      tagged SUBU  .it : $fdisplay(stderr,  " => %s:%s subu r%0d, r%0d, r%0d", loc, ttag, it.rdst, it.rsrc1, it.rsrc2 );
    1.85 +      tagged AND   .it : $fdisplay(stderr,  " => %s:%s and r%0d, r%0d, r%0d", loc,  ttag, it.rdst, it.rsrc1, it.rsrc2 );
    1.86 +      tagged OR    .it : $fdisplay(stderr,  " => %s:%s or r%0d, r%0d, r%0d", loc,   ttag, it.rdst, it.rsrc1, it.rsrc2 );
    1.87 +      tagged XOR   .it : $fdisplay(stderr,  " => %s:%s xor r%0d, r%0d, r%0d", loc,  ttag, it.rdst, it.rsrc1, it.rsrc2 );
    1.88 +      tagged NOR   .it : $fdisplay(stderr,  " => %s:%s nor r%0d, r%0d, r%0d", loc,  ttag, it.rdst, it.rsrc1, it.rsrc2 );
    1.89 +      tagged SLT   .it : $fdisplay(stderr,  " => %s:%s slt r%0d, r%0d, r%0d", loc,  ttag, it.rdst, it.rsrc1, it.rsrc2 );
    1.90 +      tagged SLTU  .it : $fdisplay(stderr,  " => %s:%s sltu r%0d, r%0d, r%0d", loc, ttag, it.rdst, it.rsrc1, it.rsrc2 );
    1.91 +                                      
    1.92 +      tagged J     .it : $fdisplay(stderr,  " => %s:%s j 0x%x", loc,    ttag, it.target );
    1.93 +      tagged JAL   .it : $fdisplay(stderr,  " => %s:%s jal 0x%x", loc,  ttag, it.target );
    1.94 +      tagged JR    .it : $fdisplay(stderr,  " => %s:%s jr r%0d", loc,   ttag, it.rsrc );
    1.95 +      tagged JALR  .it : $fdisplay(stderr,  " => %s:%s jalr r%0d", loc, ttag, it.rsrc );
    1.96 +      tagged BEQ   .it : $fdisplay(stderr,  " => %s:%s beq r%0d, r%0d, 0x%x", loc, ttag, it.rsrc1, it.rsrc2, it.offset );
    1.97 +      tagged BNE   .it : $fdisplay(stderr,  " => %s:%s bne r%0d, r%0d, 0x%x", loc, ttag, it.rsrc1, it.rsrc2, it.offset );
    1.98 +      tagged BLEZ  .it : $fdisplay(stderr,  " => %s:%s blez r%0d, 0x%x", loc, ttag, it.rsrc, it.offset );
    1.99 +      tagged BGTZ  .it : $fdisplay(stderr,  " => %s:%s bgtz r%0d, 0x%x", loc, ttag, it.rsrc, it.offset );
   1.100 +      tagged BLTZ  .it : $fdisplay(stderr,  " => %s:%s bltz r%0d, 0x%x", loc, ttag, it.rsrc, it.offset );
   1.101 +      tagged BGEZ  .it : $fdisplay(stderr,  " => %s:%s bgez r%0d, 0x%x", loc, ttag, it.rsrc, it.offset );
   1.102 +                                      
   1.103 +      tagged MFC0  .it : $fdisplay(stderr,  " => %s:%s mfc0 r%0d, cpr%0d", loc, ttag, it.rdst, it.cop0src );
   1.104 +      tagged MTC0  .it : $fdisplay(stderr,  " => %s:%s mtc0 r%0d, cpr%0d", loc, ttag, it.rsrc, it.cop0dst );
   1.105 +
   1.106 +      tagged ILLEGAL   : $fdisplay(stderr,  " => %s:%s illegal instruction", loc, ttag );
   1.107 +
   1.108 +    endcase
   1.109 +  endfunction
   1.110 +
   1.111 +endinstance
   1.112 +