OpenCores
URL https://opencores.org/ocsvn/ssbcc/ssbcc/trunk

Subversion Repositories ssbcc

[/] [ssbcc/] [trunk/] [core/] [9x8/] [display_trace.v] - Blame information for rev 11

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 sinclairrf
// Display micro controller PC, opcode, and stacks.
2
localparam L__TRACE_SIZE        = C_PC_WIDTH            // pc width
3
                                + 9                     // opcode width
4
                                + C_DATA_PTR_WIDTH      // data stack pointer width
5
                                + 1                     // s_N_valid
6
                                + 8                     // s_N
7
                                + 1                     // s_T_valid
8
                                + 8                     // s_T
9
                                + 1                     // s_R_valid
10
                                + C_RETURN_WIDTH        // s_R
11
                                + C_RETURN_PTR_WIDTH    // return stack pointer width
12
                                ;
13
task display_trace;
14
  input                     [L__TRACE_SIZE-1:0] s_raw;
15
  reg                  [C_PC_WIDTH-1:0] s_PC;
16
  reg                             [8:0] s_opcode;
17
  reg            [C_DATA_PTR_WIDTH-1:0] s_Np_stack_ptr;
18
  reg                                   s_N_valid;
19
  reg                             [7:0] s_N;
20
  reg                                   s_T_valid;
21
  reg                             [7:0] s_T;
22
  reg                                   s_R_valid;
23
  reg              [C_RETURN_WIDTH-1:0] s_R;
24
  reg          [C_RETURN_PTR_WIDTH-1:0] s_Rw_ptr;
25
  reg                         [7*8-1:0] s_opcode_name;
26
  begin
27
    { s_PC, s_opcode, s_Np_stack_ptr, s_N_valid, s_N, s_T_valid, s_T, s_R_valid, s_R, s_Rw_ptr } = s_raw;
28
    casez (s_opcode)
29
      9'b00_0000_000 : s_opcode_name = "nop    ";
30
      9'b00_0000_001 : s_opcode_name = "<<0    ";
31
      9'b00_0000_010 : s_opcode_name = "<<1    ";
32
      9'b00_0000_011 : s_opcode_name = "<<msb  ";
33
      9'b00_0000_100 : s_opcode_name = "0>>    ";
34
      9'b00_0000_101 : s_opcode_name = "1>>    ";
35
      9'b00_0000_110 : s_opcode_name = "msb>>  ";
36
      9'b00_0000_111 : s_opcode_name = "lsb>>  ";
37
      9'b00_0001_000 : s_opcode_name = "dup    ";
38
      9'b00_0001_001 : s_opcode_name = "r@     ";
39
      9'b00_0001_010 : s_opcode_name = "over   ";
40 7 sinclairrf
      9'b00_0001_011 : s_opcode_name = "+c     ";
41
      9'b00_0001_111 : s_opcode_name = "-c     ";
42 2 sinclairrf
      9'b00_0010_010 : s_opcode_name = "swap   ";
43
      9'b00_0011_000 : s_opcode_name = "+      ";
44
      9'b00_0011_100 : s_opcode_name = "-      ";
45
      9'b00_0100_000 : s_opcode_name = "0=     ";
46
      9'b00_0100_001 : s_opcode_name = "0<>    ";
47
      9'b00_0100_010 : s_opcode_name = "-1=    ";
48
      9'b00_0100_011 : s_opcode_name = "-1<>   ";
49
      9'b00_0101_000 : s_opcode_name = "return ";
50
      9'b00_0110_000 : s_opcode_name = "inport ";
51
      9'b00_0111_000 : s_opcode_name = "outport";
52
      9'b00_1000_000 : s_opcode_name = ">r     ";
53
      9'b00_1001_001 : s_opcode_name = "r>     ";
54
      9'b00_1010_000 : s_opcode_name = "&      ";
55
      9'b00_1010_001 : s_opcode_name = "or     ";
56
      9'b00_1010_010 : s_opcode_name = "^      ";
57
      9'b00_1010_011 : s_opcode_name = "nip    ";
58
      9'b00_1010_100 : s_opcode_name = "drop   ";
59
      9'b00_1011_000 : s_opcode_name = "1+     ";
60
      9'b00_1011_100 : s_opcode_name = "1-     ";
61
      9'b00_1100_000 : s_opcode_name = "store0 ";
62
      9'b00_1100_001 : s_opcode_name = "store1 ";
63
      9'b00_1100_010 : s_opcode_name = "store2 ";
64
      9'b00_1100_011 : s_opcode_name = "store3 ";
65
      9'b00_1101_000 : s_opcode_name = "fetch0 ";
66
      9'b00_1101_001 : s_opcode_name = "fetch1 ";
67
      9'b00_1101_010 : s_opcode_name = "fetch2 ";
68
      9'b00_1101_011 : s_opcode_name = "fetch3 ";
69
      9'b00_1110_000 : s_opcode_name = "store0+";
70
      9'b00_1110_001 : s_opcode_name = "store1+";
71
      9'b00_1110_010 : s_opcode_name = "store2+";
72
      9'b00_1110_011 : s_opcode_name = "store3+";
73
      9'b00_1110_100 : s_opcode_name = "store0-";
74
      9'b00_1110_101 : s_opcode_name = "store1-";
75
      9'b00_1110_110 : s_opcode_name = "store2-";
76
      9'b00_1110_111 : s_opcode_name = "store3-";
77
      9'b00_1111_000 : s_opcode_name = "fetch0+";
78
      9'b00_1111_001 : s_opcode_name = "fetch1+";
79
      9'b00_1111_010 : s_opcode_name = "fetch2+";
80
      9'b00_1111_011 : s_opcode_name = "fetch3+";
81
      9'b00_1111_100 : s_opcode_name = "fetch0-";
82
      9'b00_1111_101 : s_opcode_name = "fetch1-";
83
      9'b00_1111_110 : s_opcode_name = "fetch2-";
84
      9'b00_1111_111 : s_opcode_name = "fetch3-";
85
      9'b0_100_????? : s_opcode_name = "jump   ";
86
      9'b0_110_????? : s_opcode_name = "call   ";
87
      9'b0_101_????? : s_opcode_name = "jumpc  ";
88
      9'b0_111_????? : s_opcode_name = "callc  ";
89
      9'b1_????_???? : s_opcode_name = "push   ";
90
             default : s_opcode_name = "INVALID";
91
    endcase
92
    $write("%X %X %s : %X", s_PC, s_opcode, s_opcode_name, s_Np_stack_ptr);
93
    if (s_N_valid) $write(" %x",s_N); else $write(" XX");
94
    if (s_T_valid) $write(" %x",s_T); else $write(" XX");
95
    if (s_R_valid) $write(" : %x",s_R); else $write(" : %s",{((C_RETURN_WIDTH+3)/4){8'h58}});
96
    $write(" %X\n",s_Rw_ptr);
97
  end
98
endtask

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.