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

Subversion Repositories versatile_library

[/] [versatile_library/] [trunk/] [bench/] [wbm.v] - Blame information for rev 150

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

Line No. Rev Author Line
1 99 unneback
`timescale 1ns/1ns
2
module wbm (
3
  output [31:0] adr_o,
4
  output [1:0] bte_o,
5
  output [2:0] cti_o,
6
  output [31:0] dat_o,
7
  output [3:0] sel_o,
8
  output we_o,
9
  output cyc_o,
10
  output stb_o,
11
  input wire [31:0] dat_i,
12
  input wire ack_i,
13
  input wire clk,
14
  input wire reset,
15
  output reg OK
16
);
17
 
18
        parameter testcase = "\nTest case 1\n";
19
        parameter [1:0] linear = 2'b00,
20
                        beat4  = 2'b01,
21
                        beat8  = 2'b10,
22
                        beat16 = 2'b11;
23
 
24
    parameter [2:0] classic = 3'b000,
25
                    inc     = 3'b010,
26
                    eob         = 3'b111;
27
 
28
        parameter instructions = 32;
29
 
30
        // {adr_o,bte_o,cti_o,dat_o,sel_o,we_o,cyc_o,stb_o}     
31
        parameter [32+2+3+32+4+1+1+1:1] inst_rom [0:instructions-1]= {
32
                {32'h0,linear,classic,32'h0,4'b1111,1'b0,1'b0,1'b0},
33
 
34
                {32'h100,linear,classic,32'h12345678,4'b1111,1'b1,1'b1,1'b1}, // write 0x12345678 @ 0x100
35
                {32'h100,linear,classic,32'h0,4'b1111,1'b0,1'b1,1'b1},        // read  @ 0x100
36
 
37
                {32'h0,linear,classic,32'h0,4'b1111,1'b0,1'b0,1'b0},
38
 
39
                {32'hA000,beat4,inc,32'h00010002,4'b1111,1'b1,1'b1,1'b1}, // write burst
40
                {32'hA004,beat4,inc,32'h00030004,4'b1111,1'b1,1'b1,1'b1},
41
                {32'hA008,beat4,inc,32'h00050006,4'b1111,1'b1,1'b1,1'b1},
42
                {32'hA00C,beat4,eob,32'h00070008,4'b1111,1'b1,1'b1,1'b1},
43
 
44
                {32'hA008,linear,classic,32'hA1FFFFFF,4'b1000,1'b1,1'b1,1'b1},// write byte
45
 
46
                {32'hA000,beat4,inc,32'h0,4'b1111,1'b0,1'b1,1'b1}, // read burst
47
                {32'hA004,beat4,inc,32'h0,4'b1111,1'b0,1'b1,1'b1},
48
                {32'hA008,beat4,inc,32'h0,4'b1111,1'b0,1'b1,1'b1},
49
                {32'hA00C,beat4,eob,32'h0,4'b1111,1'b0,1'b1,1'b1},
50
 
51
                {32'h1000,linear,inc,32'hdeaddead,4'b1111,1'b1,1'b1,1'b1}, // write
52
                {32'h1004,linear,eob,32'h55555555,4'b1111,1'b1,1'b1,1'b1}, //
53
 
54
                {32'h1000,linear,inc,32'h0,4'b1111,1'b0,1'b1,1'b1}, // read
55
                {32'h1004,linear,eob,32'h0,4'b1111,1'b0,1'b1,1'b1}, // read
56
 
57
                {32'hA008,beat4,inc,32'h0,4'b1111,1'b0,1'b1,1'b1}, // read burst
58
                {32'hA00C,beat4,inc,32'h0,4'b1111,1'b0,1'b1,1'b1},
59
                {32'hA000,beat4,inc,32'h0,4'b1111,1'b0,1'b1,1'b1},
60
                {32'hA004,beat4,eob,32'h0,4'b1111,1'b0,1'b1,1'b1},
61
 
62
                {32'h0,linear,classic,32'h0,4'b1111,1'b0,1'b0,1'b0},
63
                {32'h0,linear,classic,32'h0,4'b1111,1'b0,1'b0,1'b0},
64
                {32'h0,linear,classic,32'h0,4'b1111,1'b0,1'b0,1'b0},
65
                {32'h0,linear,classic,32'h0,4'b1111,1'b0,1'b0,1'b0},
66
                {32'h0,linear,classic,32'h0,4'b1111,1'b0,1'b0,1'b0},
67
                {32'h0,linear,classic,32'h0,4'b1111,1'b0,1'b0,1'b0},
68
                {32'h0,linear,classic,32'h0,4'b1111,1'b0,1'b0,1'b0},
69
                {32'h0,linear,classic,32'h0,4'b1111,1'b0,1'b0,1'b0},
70
                {32'h0,linear,classic,32'h0,4'b1111,1'b0,1'b0,1'b0},
71
                {32'h0,linear,classic,32'h0,4'b1111,1'b0,1'b0,1'b0}};
72
 
73
        parameter [31:0] dat [0:instructions-1] = {
74
                32'h0,
75
                32'h0,
76
                32'h12345678,
77
                32'h0,
78
                32'h12345678,
79
                32'h0,
80
                32'h0,
81
                32'h0,
82
                32'h0,
83
                32'h0,
84
                32'h00010002,
85
                32'h00030004,
86
                32'ha1050006,
87
                32'h00070008,
88
                32'h0,
89
                32'h0,
90
                32'hdeaddead,
91
                32'h55555555,
92
                32'ha1050006,
93
                32'h00070008,
94
                32'h00010002,
95
                32'h00030004,
96
                32'h0,
97
                32'h0,
98
                32'h0,
99
                32'h0,
100
                32'h0,
101
                32'h0,
102
                32'h0,
103
                32'h0,
104
                32'h0,
105
                32'h0,
106
                32'h0};
107
 
108
//      parameter idle   = 1'b0;
109
//      parameter active = 1'b1;
110
//      
111
//      reg state;
112
 
113
        integer i;
114
 
115
        initial
116
                $display("%s", testcase);
117
 
118
        assign {adr_o,bte_o,cti_o,dat_o,sel_o,we_o,cyc_o,stb_o} = inst_rom[i];
119
 
120
        always @ (posedge clk or posedge reset)
121
        if (reset)
122
                i = 0;
123
        else
124
                if ((!stb_o | ack_i) & i < instructions - 1)
125
                //if ((ack_i) & i < instructions - 1)
126
                        i = i + 1;
127
 
128
        always @ (posedge clk or posedge reset)
129
        if (reset)
130
                OK <= 1'b1;
131
        else
132
                if (ack_i & !we_o & (dat_i != dat[i])) begin
133
                        OK <= 1'b0;
134
                        $display ("wrong read value %h @ %h at %t !!!", dat_i, adr_o, $time);
135
                end else if (ack_i & !we_o & (dat_i == dat[i]))
136
                        $display ("read value  %h      @ %h at %t", dat_i, adr_o, $time);
137
                else if (ack_i)
138
                        $display ("write value %h %b @ %h at %t", dat_o, sel_o, adr_o, $time);
139
 
140
//      always @ (posedge clk or posedge reset)
141
//      if (reset)
142
//              state <= idle;
143
//      else
144
//              if (state==idle & cyc_o)
145
//                      state <= active;
146
//              else if ((cti_o==3'b000 | cti_o==3'b111) & cyc_o & stb_o & ack_i)
147
//                      state <= idle;
148
 
149
endmodule

powered by: WebSVN 2.1.0

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