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

Subversion Repositories eco32

[/] [eco32/] [tags/] [eco32-0.24/] [fpga/] [src/] [dsp/] [chrgen.v] - Blame information for rev 213

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

Line No. Rev Author Line
1 123 hellwig
//
2
// chrgen.v -- character generator
3
//
4
 
5
 
6 27 hellwig
module chrgen(clk, pixclk,
7
              chrcode, chrrow, chrcol,
8
              pixel,
9
              attcode_in, blank_in, hsync_in, vsync_in, blink_in,
10
              attcode_out, blank_out, hsync_out, vsync_out, blink_out);
11
    input clk;
12
    input pixclk;
13
    input [7:0] chrcode;
14
    input [3:0] chrrow;
15
    input [2:0] chrcol;
16
    output pixel;
17
    input [7:0] attcode_in;
18
    input blank_in;
19
    input hsync_in;
20
    input vsync_in;
21
    input blink_in;
22
    output reg [7:0] attcode_out;
23
    output reg blank_out;
24
    output reg hsync_out;
25
    output reg vsync_out;
26
    output reg blink_out;
27
 
28
  wire [13:0] addr;
29
  wire [0:0] pixel_lo;
30
  wire [0:0] pixel_hi;
31
 
32
  reg mux_ctrl;
33
 
34
  assign addr[13:7] = chrcode[6:0];
35
  assign addr[6:3] = chrrow[3:0];
36
  assign addr[2:0] = chrcol[2:0];
37
 
38
  assign pixel = (mux_ctrl == 0) ? pixel_lo[0] : pixel_hi[0];
39
 
40 123 hellwig
  // RAMB16_S1: Spartan-3 16kx1 Single-Port RAM
41 27 hellwig
 
42 123 hellwig
  RAMB16_S1 character_rom_lo (
43
    .DO(pixel_lo),  // 1-bit Data Output
44
    .ADDR(addr),    // 14-bit Address Input
45
    .CLK(clk),      // Clock
46
    .DI(1'b0),      // 1-bit Data Input
47
    .EN(pixclk),    // RAM Enable Input
48
    .SSR(1'b0),     // Synchronous Set/Reset Input
49
    .WE(1'b0)       // Write Enable Input
50
  );
51 27 hellwig
 
52 123 hellwig
  `include "chrgenlo.init"
53 27 hellwig
 
54 123 hellwig
  // RAMB16_S1: Spartan-3 16kx1 Single-Port RAM
55 27 hellwig
 
56 123 hellwig
  RAMB16_S1 character_rom_hi (
57
    .DO(pixel_hi),  // 1-bit Data Output
58
    .ADDR(addr),    // 14-bit Address Input
59
    .CLK(clk),      // Clock
60
    .DI(1'b0),      // 1-bit Data Input
61
    .EN(pixclk),    // RAM Enable Input
62
    .SSR(1'b0),     // Synchronous Set/Reset Input
63
    .WE(1'b0)       // Write Enable Input
64
  );
65 27 hellwig
 
66 123 hellwig
  `include "chrgenhi.init"
67 27 hellwig
 
68
  always @(posedge clk) begin
69
    if (pixclk == 1) begin
70
      attcode_out[7:0] <= attcode_in[7:0];
71
      blank_out <= blank_in;
72
      hsync_out <= hsync_in;
73
      vsync_out <= vsync_in;
74
      blink_out <= blink_in;
75
      mux_ctrl <= chrcode[7];
76
    end
77
  end
78
 
79
endmodule

powered by: WebSVN 2.1.0

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