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

Subversion Repositories eco32

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

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

powered by: WebSVN 2.1.0

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