OpenCores
URL https://opencores.org/ocsvn/bluespec-h264/bluespec-h264/trunk

Subversion Repositories bluespec-h264

[/] [bluespec-h264/] [trunk/] [src_fpga/] [top.v] - Blame information for rev 73

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

Line No. Rev Author Line
1 73 jamey.hick
//`include "mkTestBench.v"
2
//`include "SRAM.v"
3
 
4
module top;
5
 
6
reg [31 : 0]    arr[0:262144];
7
reg [17:0]      addr_p;
8
reg [17:0]      addr_pp;
9
reg             we_p;
10
reg             we_pp;
11
reg             clk;
12
reg             rst;
13
wire [31:0]     data_in;
14
wire [31:0]     data_out;
15
wire [17:0]     addr;
16
wire            we;
17
integer         x;
18
 
19
reg [31 : 0]    arr2[0:262144];
20
reg [17:0]      addr_p2;
21
reg [17:0]      addr_pp2;
22
reg             we_p2;
23
reg             we_pp2;
24
wire [31:0]     data_in2;
25
wire [31:0]     data_out2;
26
wire [17:0]     addr2;
27
wire            we2;
28
 
29
mkTestBench tb(.CLK(clk),
30
                   .RST_N(rst),
31
 
32
                   .sram_controller1_address_out(addr),
33
                   .RDY_sram_controller1_address_out(),
34
 
35
                   .sram_controller1_data_O(data_out),
36
                   .RDY_sram_controller1_data_O(),
37
 
38
                   .sram_controller1_data_I_data(data_in),
39
                   .EN_sram_controller1_data_I(1),
40
                   .RDY_sram_controller1_data_I(),
41
 
42
                   .sram_controller1_data_T(),
43
                   .RDY_sram_controller1_data_T(),
44
 
45
                   .sram_controller1_we_bytes_out(),
46
                   .RDY_sram_controller1_we_bytes_out(),
47
 
48
                   .sram_controller1_we_out(we),
49
                   .RDY_sram_controller1_we_out(),
50
 
51
                   .sram_controller1_ce_out(),
52
                   .RDY_sram_controller1_ce_out(),
53
 
54
                   .sram_controller1_oe_out(),
55
                   .RDY_sram_controller1_oe_out(),
56
 
57
                   .sram_controller1_cen_out(),
58
                   .RDY_sram_controller1_cen_out(),
59
 
60
                   .sram_controller1_adv_ld_out(),
61
                   .RDY_sram_controller1_adv_ld_out(),
62
 
63
                   .sram_controller2_address_out(addr2),
64
                   .RDY_sram_controller2_address_out(),
65
 
66
                   .sram_controller2_data_O(data_out2),
67
                   .RDY_sram_controller2_data_O(),
68
 
69
                   .sram_controller2_data_I_data(data_in2),
70
                   .EN_sram_controller2_data_I(1),
71
                   .RDY_sram_controller2_data_I(),
72
 
73
                   .sram_controller2_data_T(),
74
                   .RDY_sram_controller2_data_T(),
75
 
76
                   .sram_controller2_we_bytes_out(),
77
                   .RDY_sram_controller2_we_bytes_out(),
78
 
79
                   .sram_controller2_we_out(we2),
80
                   .RDY_sram_controller2_we_out(),
81
 
82
                   .sram_controller2_ce_out(),
83
                   .RDY_sram_controller2_ce_out(),
84
 
85
                   .sram_controller2_oe_out(),
86
                   .RDY_sram_controller2_oe_out(),
87
 
88
                   .sram_controller2_cen_out(),
89
                   .RDY_sram_controller2_cen_out(),
90
 
91
                   .sram_controller2_adv_ld_out(),
92
                   .RDY_sram_controller2_adv_ld_out());
93
 
94
 
95
assign data_in = arr[addr_pp];
96
assign data_in2 = arr2[addr_pp2];
97
 
98
always@(*)
99
  begin
100
    #5 clk <= ~clk;
101
  end
102
 
103
 
104
 
105
always@(posedge clk)
106
  begin
107
    if(~rst)
108
      begin
109
        for (x = 0; x < 262144; x = x + 1)
110
           begin
111
             arr[x] <= 0;
112
             arr2[x] <= 0;
113
           end
114
        addr_p <= 0;
115
        addr_pp <= 0;
116
        we_p <= 1;
117
        we_pp <= 1;
118
        addr_p2 <= 0;
119
        addr_pp2 <= 0;
120
        we_p2 <= 1;
121
        we_pp2 <= 1;
122
      end
123
    else
124
      begin
125
        addr_p <= addr;
126
        addr_pp <= addr_p;
127
        we_p <= we;
128
        we_pp <= we_p;
129
        addr_p2 <= addr2;
130
        addr_pp2 <= addr_p2;
131
        we_p2 <= we2;
132
        we_pp2 <= we_p2;
133
 
134
        if(we_pp2)
135
         begin
136
           $display("SRAM2 top.v: index %d reading %d", addr_pp2, arr2[addr_pp2]);
137
         end
138
        else
139
         begin
140
           $display("SRAM2 top.v: index %d writing %d", addr_pp2, data_out2);
141
           arr2[addr_pp2] <= data_out2;
142
         end
143
 
144
        if(we_pp)
145
         begin
146
           $display("SRAM1 top.v: index %d reading %d", addr_pp, arr[addr_pp]);
147
         end
148
        else
149
         begin
150
           $display("SRAM1 top.v: index %d writing %d", addr_pp, data_out);
151
           arr[addr_pp] <= data_out;
152
         end
153
      end
154
  end
155
 
156
initial
157
  begin
158
    clk = 0;
159
    rst = 0;
160
    @(posedge clk);
161
    @(posedge clk);
162
    rst = 1;
163
    #100000;
164
  end
165
 
166
 
167
endmodule
168
 

powered by: WebSVN 2.1.0

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