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

Subversion Repositories or1200_soc

[/] [or1200_soc/] [trunk/] [boards/] [de1_board/] [sim/] [src/] [tb_top.v] - Blame information for rev 21

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 21 qaztronic
// --------------------------------------------------------------------
2
//
3
// --------------------------------------------------------------------
4
 
5
 
6
`include "timescale.v"
7
 
8
 
9
module tb_top();
10
 
11
  parameter CLK_PERIOD = 100;
12
  parameter LOG_LEVEL = 3;
13
 
14
  reg tb_clk, tb_rst;
15
 
16
  initial
17
    begin
18
      tb_clk <= 1'b1;
19
      tb_rst <= 1'b1;
20
 
21
      #(CLK_PERIOD); #(CLK_PERIOD/3);
22
      tb_rst = 1'b0;
23
 
24
    end
25
 
26
  always
27
    #(CLK_PERIOD/2) tb_clk = ~tb_clk;
28
 
29
 
30
// --------------------------------------------------------------------
31
// tb_dut
32
  tb_dut i_tb_dut( tb_clk, tb_rst );
33
 
34
 
35
// --------------------------------------------------------------------
36
// debug wires
37
  wire  [31:0] r0 = tb_top.i_tb_dut.i_top.i_or1200_soc_top.i_or1200_top.or1200_cpu.or1200_rf.rf_a.mem[32*0+31:32*0];
38
  wire  [31:0] r1 = tb_top.i_tb_dut.i_top.i_or1200_soc_top.i_or1200_top.or1200_cpu.or1200_rf.rf_a.mem[32*1+31:32*1];
39
  wire  [31:0] r2 = tb_top.i_tb_dut.i_top.i_or1200_soc_top.i_or1200_top.or1200_cpu.or1200_rf.rf_a.mem[32*2+31:32*2];
40
  wire  [31:0] r3 = tb_top.i_tb_dut.i_top.i_or1200_soc_top.i_or1200_top.or1200_cpu.or1200_rf.rf_a.mem[32*3+31:32*3];
41
  wire  [31:0] r4 = tb_top.i_tb_dut.i_top.i_or1200_soc_top.i_or1200_top.or1200_cpu.or1200_rf.rf_a.mem[32*4+31:32*4];
42
  wire  [31:0] r5 = tb_top.i_tb_dut.i_top.i_or1200_soc_top.i_or1200_top.or1200_cpu.or1200_rf.rf_a.mem[32*5+31:32*5];
43
  wire  [31:0] r6 = tb_top.i_tb_dut.i_top.i_or1200_soc_top.i_or1200_top.or1200_cpu.or1200_rf.rf_a.mem[32*6+31:32*6];
44
  wire  [31:0] r7 = tb_top.i_tb_dut.i_top.i_or1200_soc_top.i_or1200_top.or1200_cpu.or1200_rf.rf_a.mem[32*7+31:32*7];
45
  wire  [31:0] r8 = tb_top.i_tb_dut.i_top.i_or1200_soc_top.i_or1200_top.or1200_cpu.or1200_rf.rf_a.mem[32*8+31:32*8];
46
  wire  [31:0] r9 = tb_top.i_tb_dut.i_top.i_or1200_soc_top.i_or1200_top.or1200_cpu.or1200_rf.rf_a.mem[32*9+31:32*9];
47
  wire  [31:0] r10 = tb_top.i_tb_dut.i_top.i_or1200_soc_top.i_or1200_top.or1200_cpu.or1200_rf.rf_a.mem[32*10+31:32*10];
48
  wire  [31:0] r11 = tb_top.i_tb_dut.i_top.i_or1200_soc_top.i_or1200_top.or1200_cpu.or1200_rf.rf_a.mem[32*11+31:32*11];
49
  wire  [31:0] r12 = tb_top.i_tb_dut.i_top.i_or1200_soc_top.i_or1200_top.or1200_cpu.or1200_rf.rf_a.mem[32*12+31:32*12];
50
  wire  [31:0] r13 = tb_top.i_tb_dut.i_top.i_or1200_soc_top.i_or1200_top.or1200_cpu.or1200_rf.rf_a.mem[32*13+31:32*13];
51
  wire  [31:0] r14 = tb_top.i_tb_dut.i_top.i_or1200_soc_top.i_or1200_top.or1200_cpu.or1200_rf.rf_a.mem[32*14+31:32*14];
52
  wire  [31:0] r15 = tb_top.i_tb_dut.i_top.i_or1200_soc_top.i_or1200_top.or1200_cpu.or1200_rf.rf_a.mem[32*15+31:32*15];
53
  wire  [31:0] r16 = tb_top.i_tb_dut.i_top.i_or1200_soc_top.i_or1200_top.or1200_cpu.or1200_rf.rf_a.mem[32*16+31:32*16];
54
  wire  [31:0] r17 = tb_top.i_tb_dut.i_top.i_or1200_soc_top.i_or1200_top.or1200_cpu.or1200_rf.rf_a.mem[32*17+31:32*17];
55
  wire  [31:0] r18 = tb_top.i_tb_dut.i_top.i_or1200_soc_top.i_or1200_top.or1200_cpu.or1200_rf.rf_a.mem[32*18+31:32*18];
56
  wire  [31:0] r19 = tb_top.i_tb_dut.i_top.i_or1200_soc_top.i_or1200_top.or1200_cpu.or1200_rf.rf_a.mem[32*19+31:32*19];
57
  wire  [31:0] r20 = tb_top.i_tb_dut.i_top.i_or1200_soc_top.i_or1200_top.or1200_cpu.or1200_rf.rf_a.mem[32*20+31:32*20];
58
  wire  [31:0] r21 = tb_top.i_tb_dut.i_top.i_or1200_soc_top.i_or1200_top.or1200_cpu.or1200_rf.rf_a.mem[32*21+31:32*21];
59
  wire  [31:0] r22 = tb_top.i_tb_dut.i_top.i_or1200_soc_top.i_or1200_top.or1200_cpu.or1200_rf.rf_a.mem[32*22+31:32*22];
60
  wire  [31:0] r23 = tb_top.i_tb_dut.i_top.i_or1200_soc_top.i_or1200_top.or1200_cpu.or1200_rf.rf_a.mem[32*23+31:32*23];
61
  wire  [31:0] r24 = tb_top.i_tb_dut.i_top.i_or1200_soc_top.i_or1200_top.or1200_cpu.or1200_rf.rf_a.mem[32*24+31:32*24];
62
  wire  [31:0] r25 = tb_top.i_tb_dut.i_top.i_or1200_soc_top.i_or1200_top.or1200_cpu.or1200_rf.rf_a.mem[32*25+31:32*25];
63
  wire  [31:0] r26 = tb_top.i_tb_dut.i_top.i_or1200_soc_top.i_or1200_top.or1200_cpu.or1200_rf.rf_a.mem[32*26+31:32*26];
64
  wire  [31:0] r27 = tb_top.i_tb_dut.i_top.i_or1200_soc_top.i_or1200_top.or1200_cpu.or1200_rf.rf_a.mem[32*27+31:32*27];
65
  wire  [31:0] r28 = tb_top.i_tb_dut.i_top.i_or1200_soc_top.i_or1200_top.or1200_cpu.or1200_rf.rf_a.mem[32*28+31:32*28];
66
  wire  [31:0] r29 = tb_top.i_tb_dut.i_top.i_or1200_soc_top.i_or1200_top.or1200_cpu.or1200_rf.rf_a.mem[32*29+31:32*29];
67
  wire  [31:0] r30 = tb_top.i_tb_dut.i_top.i_or1200_soc_top.i_or1200_top.or1200_cpu.or1200_rf.rf_a.mem[32*30+31:32*30];
68
  wire  [31:0] r31 = tb_top.i_tb_dut.i_top.i_or1200_soc_top.i_or1200_top.or1200_cpu.or1200_rf.rf_a.mem[32*31+31:32*31];
69
 
70
 
71
// --------------------------------------------------------------------
72
// logging stuff
73
 
74
  wire iwb_clk_i = tb_top.i_tb_dut.i_top.i_or1200_soc_top.iwb_clk_i;
75
  wire iwb_ack_i = tb_top.i_tb_dut.i_top.i_or1200_soc_top.iwb_ack_i;
76
  wire iwb_we_o = tb_top.i_tb_dut.i_top.i_or1200_soc_top.iwb_we_o;
77
 
78
  wire [31:0] iwb_adr_o = tb_top.i_tb_dut.i_top.i_or1200_soc_top.iwb_adr_o;
79
  wire [31:0] iwb_dat_i = tb_top.i_tb_dut.i_top.i_or1200_soc_top.iwb_dat_i;
80
  wire [31:0] iwb_dat_o = tb_top.i_tb_dut.i_top.i_or1200_soc_top.iwb_dat_o;
81
 
82
  always @( posedge iwb_clk_i )
83
    if( iwb_ack_i & (LOG_LEVEL > 3) )
84
      if( iwb_we_o )
85
        $display( "###- iwb write: 0x%h @ 0x%h at time %t. ", iwb_dat_o, iwb_adr_o, $time );
86
      else
87
        $display( "###- iwb read: 0x%h @ 0x%h at time %t. ", iwb_dat_i, iwb_adr_o, $time );
88
 
89
 
90
  wire dwb_clk_i = tb_top.i_tb_dut.i_top.i_or1200_soc_top.dwb_clk_i;
91
  wire dwb_ack_i = tb_top.i_tb_dut.i_top.i_or1200_soc_top.dwb_ack_i;
92
  wire dwb_we_o = tb_top.i_tb_dut.i_top.i_or1200_soc_top.dwb_we_o;
93
 
94
  wire [31:0] dwb_adr_o = tb_top.i_tb_dut.i_top.i_or1200_soc_top.dwb_adr_o;
95
  wire [31:0] dwb_dat_i = tb_top.i_tb_dut.i_top.i_or1200_soc_top.dwb_dat_i;
96
  wire [31:0] dwb_dat_o = tb_top.i_tb_dut.i_top.i_or1200_soc_top.dwb_dat_o;
97
 
98
  always @( posedge dwb_clk_i )
99
    if( dwb_ack_i & (LOG_LEVEL > 2) )
100
      if( dwb_we_o )
101
        $display( "###- dwb write: 0x%h @ 0x%h at time %t. ", dwb_dat_o, dwb_adr_o, $time );
102
      else
103
        $display( "###- dwb read: 0x%h @ 0x%h at time %t. ", dwb_dat_i, dwb_adr_o, $time );
104
 
105
  wire [31:0] pc = tb_top.i_tb_dut.i_top.i_or1200_soc_top.i_or1200_top.or1200_cpu.or1200_genpc.pc;
106
 
107
  always @(pc)
108
    if( LOG_LEVEL > 3 )
109
      $display( "###- PC: 0x%h at time %t. ", pc, $time );
110
 
111
  reg [31:0] pc_1, pc_2, pc_3, pc_at_wb;
112
 
113
  always @(pc)
114
    begin
115
      pc_1 <= pc;
116
      pc_2 <= pc_1;
117
      pc_3 <= pc_2;
118
      pc_at_wb <= pc_3;
119
    end
120
 
121
 
122
 
123
// --------------------------------------------------------------------
124
// break point
125
 
126
  always @( posedge dwb_clk_i )
127
    if( dwb_ack_i & dwb_we_o & (dwb_dat_o == 32'hcea5e_0ff) & (dwb_adr_o == 32'h5fff_fffc) )
128
      $stop;
129
 
130
 
131
endmodule
132
 
133
 

powered by: WebSVN 2.1.0

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