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

Subversion Repositories eco32

[/] [eco32/] [trunk/] [fpga/] [mc/] [src/] [dsp/] [common/] [dspmem.v] - Blame information for rev 290

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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