1 module MulDivDCM(input xtal, output clk);
7 BUFG CLKFX_BUFG_INST (.I(CLKFX_BUF),
9 DCM_SP DCM_SP_INST (.CLKFB(GND_BIT),
17 defparam DCM_SP_INST.CLK_FEEDBACK = "NONE";
18 defparam DCM_SP_INST.CLKDV_DIVIDE = 2.0;
19 defparam DCM_SP_INST.CLKFX_DIVIDE = div;
20 defparam DCM_SP_INST.CLKFX_MULTIPLY = mul;
21 defparam DCM_SP_INST.CLKIN_DIVIDE_BY_2 = "FALSE";
22 defparam DCM_SP_INST.CLKIN_PERIOD = 20.000;
23 defparam DCM_SP_INST.CLKOUT_PHASE_SHIFT = "NONE";
24 defparam DCM_SP_INST.DESKEW_ADJUST = "SYSTEM_SYNCHRONOUS";
25 defparam DCM_SP_INST.DFS_FREQUENCY_MODE = "LOW";
26 defparam DCM_SP_INST.DLL_FREQUENCY_MODE = "LOW";
27 defparam DCM_SP_INST.DUTY_CYCLE_CORRECTION = "TRUE";
28 defparam DCM_SP_INST.FACTORY_JF = 16'hC080;
29 defparam DCM_SP_INST.PHASE_SHIFT = 0;
30 defparam DCM_SP_INST.STARTUP_WAIT = "TRUE";
37 output reg [2:0] green,
46 MulDivDCM dcm25(xtal, clk25);
47 defparam dcm25.div = 4;
48 defparam dcm25.mul = 2;
50 SyncGen sync(clk25, vs, hs, x, y, border);
59 reg [11:0] vwaddr = 0;
63 CharSet cs(cschar, csrow, csdata);
64 VideoRAM vram(clk25, vraddr, vrdata, vwaddr, 8'h41, 1);
65 VDisplay dpy(clk25, x, y, vraddr, vrdata, cschar, csrow, csdata, odata);
67 always @(posedge clk25)
70 always @(posedge clk25) begin
71 red <= border ? 0 : {3{odata}};
72 green <= border ? 0 : {3{odata}};
73 blue <= border ? 0 : {2{odata}};
80 output reg [11:0] x, y,
84 parameter XFPORCH = 16;
86 parameter XBPORCH = 48;
89 parameter YFPORCH = 10;
91 parameter YBPORCH = 29;
93 always @(posedge pixclk)
95 if (x >= (XRES + XFPORCH + XSYNC + XBPORCH))
97 if (y >= (YRES + YFPORCH + YSYNC + YBPORCH))
104 hs <= (x >= (XRES + XFPORCH)) && (x < (XRES + XFPORCH + XSYNC));
105 vs <= (y >= (YRES + YFPORCH)) && (y < (YRES + YFPORCH + YSYNC));
106 border <= (x > XRES) || (y > YRES);
113 output wire [7:0] data);
115 reg [7:0] rom [(256 * 8 - 1):0];
118 $readmemb("ibmpc1.mem", rom);
120 assign data = rom[{char, row}];
126 output reg [7:0] rdata,
131 reg [7:0] ram [80*25-1 : 0];
133 always @(posedge pixclk)
136 always @(posedge pixclk)
145 output wire [11:0] raddr,
147 output wire [7:0] cschar,
148 output wire [2:0] csrow,
153 wire [7:0] col = x[11:3];
154 wire [5:0] row = y[9:3];
158 assign raddr = ({row,4'b0} + {row,6'b0} + {4'h0,col});
159 assign cschar = rchar;
160 assign csrow = y[2:0];
162 always @(posedge pixclk)
165 always @(posedge pixclk)
166 data = ((xdly < 80 * 8) && (y < 25 * 8)) ? csdata[7 - xdly[2:0]] : 0;