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

Subversion Repositories versatile_mem_ctrl

[/] [versatile_mem_ctrl/] [trunk/] [bench/] [wbm.v] - Blame information for rev 106

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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