EnderW4785
Member level 1
Hello all. For work I was given a Spartan-6 on a Drigmorn3 demo board in order to prototype some hardware. Having never done verilog or any sort of FPGA design I downloaded ISE 13.3, read through the tutorials, read a Verilog for dummies book and got started. My first goal was given a 82 MHz clock, give or take, I wanted to divide it down to. When I failed to get that working, I added in a line or two of code that would simply turn the LCD screen backlight on. Everything failed. I can't get the FPGA to show me any sort of life. I'm sure I'm doing something incredibly wrong but I don't know what it is. Here is the code that I have so far:
There are a lot of pieces of this that I don’t fully understand, especially all of the timing settings in the constraits editor. I struggled for awhile trying to figure out how to interface my LVPECL 3.3V clock to the FPGA and while I think I’m close its probably not correct. The thing that’s the most discouraging is I can’t get a simple LED to turn on and off.
Any help would be appreciated. If you need more information, let me know.
Thanks,
Scott
Code Verilog - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 module main_module( clkADC_P, clkADC_N, clkWall_P, clkWall_N, div_clk, LCDbacklight); input wire clkADC_P; input wire clkADC_N; input wire clkWall_P; input wire clkWall_N; output wire div_clk; output reg LCDbacklight; wire clkADC; wire clkWall; reg [25:0] divisor = 1382400; IBUFDS #( .CAPACITANCE("DONT_CARE"), .DIFF_TERM("FALSE"), .IBUF_DELAY_VALUE("0"), .IFD_DELAY_VALUE("AUTO"), .IOSTANDARD("LVPECL_33")) IBUFDS_inst1 ( .O(clkADC), .I(clkADC_P), .IB(clkADC_N)); IBUFDS #( .CAPACITANCE("DONT_CARE"), .DIFF_TERM("FALSE"), .IBUF_DELAY_VALUE("0"), .IFD_DELAY_VALUE("AUTO"), .IOSTANDARD("LVPECL_33")) IBUFDS_inst2 ( .O(clkWall), .I(clkWall_P), .IB(clkWall_N)); clk_divider clk_divider_inst ( .clk(clkADC), .divisor(divisor), .div_clk(div_clk)); always begin @(posedge clkADC) LCDbacklight <= 1; end endmodule module clk_divider(clk, divisor, div_clk); input clk; input [25:0] divisor; output div_clk; reg div_clk; reg [25:0] cnt; initial begin cnt = 0; end always @(posedge clk)begin if (cnt >= divisor) begin div_clk <= 0; cnt <= 0; end else if (cnt < divisor/2) begin div_clk <= 0; cnt <= cnt + 1; end else if ((cnt >= divisor/2) && (cnt < divisor)) begin div_clk <= 1; cnt <= cnt + 1; end end // always endmodule #Created by Constraints Editor (xc6slx16-csg324-2) - 2012/01/30 NET "clkADC_N" TNM_NET = "clkADC_N"; TIMESPEC TS_clkADC_N = PERIOD "clkADC_N" 12.056 ns HIGH 50 %; NET "clkADC_P" TNM_NET = "clkADC_P"; TIMESPEC TS_clkADC_P = PERIOD "clkADC_P" 12.056 ns HIGH 50 %; NET "clkWall_N" OFFSET = IN 12.056 ns VALID 12.056 ns BEFORE "clkADC_N" RISING; NET "clkWall_P" OFFSET = IN 12.056 ns VALID 12.056 ns BEFORE "clkADC_N" RISING; NET "div_clk" OFFSET = OUT 12.056 ns AFTER "clkADC_N"; NET "clkADC_P" LOC = H2; NET "clkWall_P" LOC = T4; NET "div_clk" LOC = N6; NET "clkADC_N" IOSTANDARD = LVPECL_33; NET "clkADC_P" IOSTANDARD = LVPECL_33; NET "div_clk" IOSTANDARD = LVCMOS33; CONFIG VCCAUX = 3.3; #Created by Constraints Editor (xc6slx16-csg324-2) - 2012/01/30 NET "LCDbacklight" OFFSET = OUT 12.056 ns AFTER "clkADC_N"; NET "LCDbacklight" LOC = M3; # PlanAhead Generated IO constraints NET "LCDbacklight" IOSTANDARD = LVCMOS33; NET "LCDbacklight" DRIVE = 12; NET "div_clk" DRIVE = 12;
There are a lot of pieces of this that I don’t fully understand, especially all of the timing settings in the constraits editor. I struggled for awhile trying to figure out how to interface my LVPECL 3.3V clock to the FPGA and while I think I’m close its probably not correct. The thing that’s the most discouraging is I can’t get a simple LED to turn on and off.
Any help would be appreciated. If you need more information, let me know.
Thanks,
Scott
Last edited by a moderator: