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

Subversion Repositories eco32

[/] [eco32/] [tags/] [eco32-0.23/] [fpga/] [src/] [dsp/] [dspmem.v] - Blame information for rev 157

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 123 hellwig
//
2
// dspmem.v -- display memory
3
//
4
 
5
 
6 27 hellwig
module dspmem(rdwr_row, rdwr_col, wr_data, rd_data, en, wr,
7
              clk, pixclk,
8
              txtrow, txtcol, attcode, chrcode,
9
              chrrow_in, chrcol_in, blank_in,
10
              hsync_in, vsync_in, blink_in,
11
              chrrow_out, chrcol_out, blank_out,
12
              hsync_out, vsync_out, blink_out);
13
    input [4:0] rdwr_row;
14
    input [6:0] rdwr_col;
15
    input [15:0] wr_data;
16
    output [15:0] rd_data;
17
    input en;
18
    input wr;
19
    input clk;
20
    input pixclk;
21
    input [4:0] txtrow;
22
    input [6:0] txtcol;
23
    output [7:0] attcode;
24
    output [7:0] chrcode;
25
    input [3:0] chrrow_in;
26
    input [2:0] chrcol_in;
27
    input blank_in;
28
    input hsync_in;
29
    input vsync_in;
30
    input blink_in;
31
    output reg [3:0] chrrow_out;
32
    output reg [2:0] chrcol_out;
33
    output reg blank_out;
34
    output reg hsync_out;
35
    output reg vsync_out;
36
    output reg blink_out;
37
 
38
  wire [11:0] rdwr_addr;
39
  wire [3:0] rdwr_din_n3;
40
  wire [3:0] rdwr_din_n2;
41
  wire [3:0] rdwr_din_n1;
42
  wire [3:0] rdwr_din_n0;
43
  wire [3:0] rdwr_dout_n3;
44
  wire [3:0] rdwr_dout_n2;
45
  wire [3:0] rdwr_dout_n1;
46
  wire [3:0] rdwr_dout_n0;
47
 
48
  wire [11:0] rfsh_addr;
49
  wire [3:0] rfsh_din_n3;
50
  wire [3:0] rfsh_din_n2;
51
  wire [3:0] rfsh_din_n1;
52
  wire [3:0] rfsh_din_n0;
53
  wire [3:0] rfsh_dout_n3;
54
  wire [3:0] rfsh_dout_n2;
55
  wire [3:0] rfsh_dout_n1;
56
  wire [3:0] rfsh_dout_n0;
57
 
58
  assign rdwr_addr[11:7] = rdwr_row[4:0];
59
  assign rdwr_addr[6:0] = rdwr_col[6:0];
60
  assign rdwr_din_n3 = wr_data[15:12];
61
  assign rdwr_din_n2 = wr_data[11: 8];
62
  assign rdwr_din_n1 = wr_data[ 7: 4];
63
  assign rdwr_din_n0 = wr_data[ 3: 0];
64
  assign rd_data[15:12] = rdwr_dout_n3;
65
  assign rd_data[11: 8] = rdwr_dout_n2;
66
  assign rd_data[ 7: 4] = rdwr_dout_n1;
67
  assign rd_data[ 3: 0] = rdwr_dout_n0;
68
 
69
  assign rfsh_addr[11:7] = txtrow[4:0];
70
  assign rfsh_addr[6:0] = txtcol[6:0];
71
  assign rfsh_din_n3 = 4'b0000;
72
  assign rfsh_din_n2 = 4'b0000;
73
  assign rfsh_din_n1 = 4'b0000;
74
  assign rfsh_din_n0 = 4'b0000;
75
  assign attcode[7:4] = rfsh_dout_n3;
76
  assign attcode[3:0] = rfsh_dout_n2;
77
  assign chrcode[7:4] = rfsh_dout_n1;
78
  assign chrcode[3:0] = rfsh_dout_n0;
79
 
80 123 hellwig
  // RAMB16_S4_S4: Spartan-3 4k x 4 Dual-Port RAM
81 27 hellwig
 
82 123 hellwig
  RAMB16_S4_S4 display_att_hi (
83
    .DOA(rdwr_dout_n3),  // Port A 4-bit Data Output
84
    .DOB(rfsh_dout_n3),  // Port B 4-bit Data Output
85
    .ADDRA(rdwr_addr),   // Port A 12-bit Address Input
86
    .ADDRB(rfsh_addr),   // Port B 12-bit Address Input
87
    .CLKA(clk),          // Port A Clock
88
    .CLKB(clk),          // Port B Clock
89
    .DIA(rdwr_din_n3),   // Port A 4-bit Data Input
90
    .DIB(rfsh_din_n3),   // Port B 4-bit Data Input
91
    .ENA(en),            // Port A RAM Enable Input
92
    .ENB(pixclk),        // Port B RAM Enable Input
93
    .SSRA(1'b0),         // Port A Synchronous Set/Reset Input
94
    .SSRB(1'b0),         // Port B Synchronous Set/Reset Input
95
    .WEA(wr),            // Port A Write Enable Input
96
    .WEB(1'b0)           // Port B Write Enable Input
97
  );
98 27 hellwig
 
99 123 hellwig
  `include "dspatthi.init"
100 27 hellwig
 
101 123 hellwig
  // RAMB16_S4_S4: Spartan-3 4k x 4 Dual-Port RAM
102 27 hellwig
 
103 123 hellwig
  RAMB16_S4_S4 display_att_lo (
104
    .DOA(rdwr_dout_n2),  // Port A 4-bit Data Output
105
    .DOB(rfsh_dout_n2),  // Port B 4-bit Data Output
106
    .ADDRA(rdwr_addr),   // Port A 12-bit Address Input
107
    .ADDRB(rfsh_addr),   // Port B 12-bit Address Input
108
    .CLKA(clk),          // Port A Clock
109
    .CLKB(clk),          // Port B Clock
110
    .DIA(rdwr_din_n2),   // Port A 4-bit Data Input
111
    .DIB(rfsh_din_n2),   // Port B 4-bit Data Input
112
    .ENA(en),            // Port A RAM Enable Input
113
    .ENB(pixclk),        // Port B RAM Enable Input
114
    .SSRA(1'b0),         // Port A Synchronous Set/Reset Input
115
    .SSRB(1'b0),         // Port B Synchronous Set/Reset Input
116
    .WEA(wr),            // Port A Write Enable Input
117
    .WEB(1'b0)           // Port B Write Enable Input
118
  );
119 27 hellwig
 
120 123 hellwig
  `include "dspattlo.init"
121 27 hellwig
 
122 123 hellwig
  // RAMB16_S4_S4: Spartan-3 4k x 4 Dual-Port RAM
123 27 hellwig
 
124 123 hellwig
  RAMB16_S4_S4 display_chr_hi (
125
    .DOA(rdwr_dout_n1),  // Port A 4-bit Data Output
126
    .DOB(rfsh_dout_n1),  // Port B 4-bit Data Output
127
    .ADDRA(rdwr_addr),   // Port A 12-bit Address Input
128
    .ADDRB(rfsh_addr),   // Port B 12-bit Address Input
129
    .CLKA(clk),          // Port A Clock
130
    .CLKB(clk),          // Port B Clock
131
    .DIA(rdwr_din_n1),   // Port A 4-bit Data Input
132
    .DIB(rfsh_din_n1),   // Port B 4-bit Data Input
133
    .ENA(en),            // Port A RAM Enable Input
134
    .ENB(pixclk),        // Port B RAM Enable Input
135
    .SSRA(1'b0),         // Port A Synchronous Set/Reset Input
136
    .SSRB(1'b0),         // Port B Synchronous Set/Reset Input
137
    .WEA(wr),            // Port A Write Enable Input
138
    .WEB(1'b0)           // Port B Write Enable Input
139
  );
140 27 hellwig
 
141 123 hellwig
  `include "dspchrhi.init"
142 27 hellwig
 
143 123 hellwig
  // RAMB16_S4_S4: Spartan-3 4k x 4 Dual-Port RAM
144 27 hellwig
 
145 123 hellwig
  RAMB16_S4_S4 display_chr_lo (
146
    .DOA(rdwr_dout_n0),  // Port A 4-bit Data Output
147
    .DOB(rfsh_dout_n0),  // Port B 4-bit Data Output
148
    .ADDRA(rdwr_addr),   // Port A 12-bit Address Input
149
    .ADDRB(rfsh_addr),   // Port B 12-bit Address Input
150
    .CLKA(clk),          // Port A Clock
151
    .CLKB(clk),          // Port B Clock
152
    .DIA(rdwr_din_n0),   // Port A 4-bit Data Input
153
    .DIB(rfsh_din_n0),   // Port B 4-bit Data Input
154
    .ENA(en),            // Port A RAM Enable Input
155
    .ENB(pixclk),        // Port B RAM Enable Input
156
    .SSRA(1'b0),         // Port A Synchronous Set/Reset Input
157
    .SSRB(1'b0),         // Port B Synchronous Set/Reset Input
158
    .WEA(wr),            // Port A Write Enable Input
159
    .WEB(1'b0)           // Port B Write Enable Input
160
  );
161 27 hellwig
 
162 123 hellwig
  `include "dspchrlo.init"
163 27 hellwig
 
164
  always @(posedge clk) begin
165
    if (pixclk == 1) begin
166
      chrrow_out <= chrrow_in;
167
      chrcol_out <= chrcol_in;
168
      blank_out <= blank_in;
169
      hsync_out <= hsync_in;
170
      vsync_out <= vsync_in;
171
      blink_out <= blink_in;
172
    end
173
  end
174
 
175
endmodule

powered by: WebSVN 2.1.0

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