User`s manual

299 //
300 // A shift register primitive is used to generate an active-high reset
301 // signal that remains high for 16 clock cycles after configuration finishes
302 // and the FPGA’s internal clocks begin toggling.
303 //
304 ////////////////////////////////////////////////////////////////////////////
305 wire reset;
306 SRL16 reset_sr(.D(1’b0), .CLK(clock_27mhz), .Q(reset),
307 .A0(1’b1), .A1(1’b1), .A2(1’b1), .A3(1’b1));
308 defparam reset_sr.INIT = 16’hFFFF;
309
310 ///////////////////////////////////////////////////////////////////////////////////////////////////
311 // create clocks
312 // use FPGA’s digital clock manager to produce a 50 MHz clock
313 // this clock is our system clock
314 // to drive VGA at 640x480 (60 Hz), we need a 25 MHz vga clock
315 // credits to Jose for computing the required clock values
316 // and use of ramclock module
317 ///////////////////////////////////////////////////////////////////////////////////////////////////
318 wire sys_clk_unbuf, sys_clk, vga_clk, vga_clk_unbuf;
319 wire slow_clk;
320 wire clk_locked;
321 DCM vclk1(.CLKIN(clock_27mhz),.CLKFX(sys_clk_unbuf));
322 // synthesis attribute CLKFX_DIVIDE of vclk1 is 15
323 // synthesis attribute CLKFX_MULTIPLY of vclk1 is 28
324 // synthesis attribute CLK_FEEDBACK of vclk1 is NONE
325 // synthesis attribute CLKIN_PERIOD of vclk1 is 37
326 BUFG vclk2(.O(sys_clk),.I(sys_clk_unbuf));
327 DCM int_dcm(.CLKIN(sys_clk), .CLKFX(vga_clk_unbuf), .LOCKED(clk_locked));
328 // synthesis attribute CLKFX_DIVIDE of int_dcm is 4
329 // synthesis attribute CLKFX_MULTIPLY of int_dcm is 2
330 // synthesis attribute CLK_FEEDBACK of int_dcm is NONE
331 // synthesis attribute CLKIN_PERIOD of int_dcm is 20
332 BUFG int_dcm2(.O(vga_clk), .I(vga_clk_unbuf));
333 // assign led[7] = ~clk_locked;
334 // assign led[5:1] = {6{1’b1}};
335 slow_clk slow(.clk(sys_clk),
336 .slow_clk(slow_clk));
337 // assign led[6] = ~slow_clk;
338 wire[6:0] percent_kept;
339 assign led[7:1] = ~percent_kept;
340 wire busy;
341 assign led[0] = ~busy;
342
343 ///////////////////////////////////////////////////////////////////////////////////////////////////
344 // create debounced buttons
95