There are 7 messages in this thread.
You are currently looking at messages 0 to 7.
I've been trying to make a _simple_ counter work, and it just doesn't. Can I get another set of eyes to look at this? It's probably something dumb/simple, but I just can't see it. The code: reg [3:0] DCM_Delay = 4'hF; reg DCM_Reset = 1'b1; always @ (posedge clk_fpga) begin if (reset) begin DCM_Reset <= 1'b1; DCM_Delay <= 4'hF; end else begin if (|DCM_Delay) begin DCM_Reset <= 1'b1; DCM_Delay <= DCM_Delay - 1; end else begin DCM_Reset <= 1'b0; end end end Comments: "reset" is the inversion of a push-button. I can bring it to a pin, and see that it is OK. I can put the DCM_Delay bus on pins - it's always high. I never see the counter count. What am I missing? I tried initialising DCM_Delay to all 0's to see if reset did anything - it seems to be ignored. I added 'reset' to the sensitivity list - that didn't help. What am I missing? Argh, Gary.______________________________
On Jan 18, 9:28=A0pm, ghelbig <ghel...@lycos.com> wrote: > I've been trying to make a _simple_ counter work, and it just doesn't. > > Can I get another set of eyes to look at this? =A0It's probably > something dumb/simple, but I just can't see it. > > The code: > > reg [3:0] DCM_Delay =3D 4'hF; > reg DCM_Reset =3D 1'b1; > > =A0 =A0always @ (posedge clk_fpga) begin > =A0 =A0 =A0 if (reset) begin > =A0 =A0 =A0 =A0 =A0DCM_Reset <=3D 1'b1; > =A0 =A0 =A0 =A0 =A0DCM_Delay <=3D 4'hF; > =A0 =A0 =A0 end else begin > =A0 =A0 =A0 =A0 =A0if (|DCM_Delay) begin > =A0 =A0 =A0 =A0 =A0 =A0 DCM_Reset <=3D 1'b1; > =A0 =A0 =A0 =A0 =A0 =A0 DCM_Delay <=3D DCM_Delay - 1; > =A0 =A0 =A0 =A0 =A0end else begin > =A0 =A0 =A0 =A0 =A0 =A0 DCM_Reset <=3D 1'b0; > =A0 =A0 =A0 =A0 =A0end > =A0 =A0 =A0 end > =A0 =A0end > > Comments: > > "reset" is the inversion of a push-button. =A0I can bring it to a pin, > and see that it is OK. > > I can put the DCM_Delay bus on pins - it's always high. > > I never see the counter count. =A0What am I missing? =A0I tried > initialising DCM_Delay to all 0's to see if reset did anything - it > seems to be ignored. > > I added 'reset' to the sensitivity list - that didn't help. > > What am I missing? > > Argh, > Gary. Have you tried simulating this code? It sounds like you are trying to debug a chip. Isn't it easier to use a simulator where you can see every signal? I am not as familiar with Verilog, but you might try evaluating |DCM_Delay as a separate signal which can be viewed independently. I sometimes find brain cramps by being very deliberate and looking for problems where I "know" they don't exist. Rick
On Jan 18, 6:28=A0pm, ghelbig <ghel...@lycos.com> wrote: > I've been trying to make a _simple_ counter work, and it just doesn't. > > Can I get another set of eyes to look at this? =A0It's probably > something dumb/simple, but I just can't see it. > > The code: > > reg [3:0] DCM_Delay =3D 4'hF; > reg DCM_Reset =3D 1'b1; > > =A0 =A0always @ (posedge clk_fpga) begin > =A0 =A0 =A0 if (reset) begin > =A0 =A0 =A0 =A0 =A0DCM_Reset <=3D 1'b1; > =A0 =A0 =A0 =A0 =A0DCM_Delay <=3D 4'hF; > =A0 =A0 =A0 end else begin > =A0 =A0 =A0 =A0 =A0if (|DCM_Delay) begin > =A0 =A0 =A0 =A0 =A0 =A0 DCM_Reset <=3D 1'b1; > =A0 =A0 =A0 =A0 =A0 =A0 DCM_Delay <=3D DCM_Delay - 1; > =A0 =A0 =A0 =A0 =A0end else begin > =A0 =A0 =A0 =A0 =A0 =A0 DCM_Reset <=3D 1'b0; > =A0 =A0 =A0 =A0 =A0end > =A0 =A0 =A0 end > =A0 =A0end > > Comments: > > "reset" is the inversion of a push-button. =A0I can bring it to a pin, > and see that it is OK. > > I can put the DCM_Delay bus on pins - it's always high. > > I never see the counter count. =A0What am I missing? =A0I tried > initialising DCM_Delay to all 0's to see if reset did anything - it > seems to be ignored. > > I added 'reset' to the sensitivity list - that didn't help. > > What am I missing? > > Argh, > Gary. What character is in front of DCM_Delay in that if statement? -- john, KE5FX______________________________
On Mon, 18 Jan 2010 23:50:01 -0800 (PST), "j...@pop.net" wrote: >> if (|DCM_Delay) begin >What character is in front of DCM_Delay in that if statement? I hope it's a vertical bar, the reduction-OR operator; that would make the test effectively "if (DCM_Delay != 0)" (which would have been more readable anyway). The code looks OK to me. The counter DCM_Delay should reset to 4'hf, count down to zero and then remain stuck at zero until the next reset. DCM_Reset should go to zero one clock after DCM_Delay reaches zero. Is there any chance that (a) the clock is not ticking, or (b) reset is stuck high? -- Jonathan Bromley______________________________
On Jan 19, 3:20=A0am, Jonathan Bromley <jonathan.brom...@MYCOMPANY.com> wrote: > On Mon, 18 Jan 2010 23:50:01 -0800 (PST), "jmi...@pop.net" wrote: > >> =A0 =A0 =A0 =A0 =A0if (|DCM_Delay) begin > >What character is in front of DCM_Delay in that if statement? > > I hope it's a vertical bar, the reduction-OR operator; > that would make the test effectively "if (DCM_Delay !=3D 0)" > (which would have been more readable anyway). > > The code looks OK to me. =A0The counter DCM_Delay should > reset to 4'hf, count down to zero and then remain stuck at > zero until the next reset. =A0DCM_Reset should go to zero > one clock after DCM_Delay reaches zero. > > Is there any chance that (a) the clock is not ticking, or > (b) reset is stuck high? > -- > Jonathan Bromley or (c) the lights are inverted and DCM_Delay bits are really all zero?______________________________
I assume you're using the raw input clock for this reset logic? If you're using the DCM output clock, it will nver count since the DCM is reset. John Providenza______________________________
On Jan 19, 12:20=A0am, Jonathan Bromley <jonathan.brom...@MYCOMPANY.com> wrote: > On Mon, 18 Jan 2010 23:50:01 -0800 (PST), "jmi...@pop.net" wrote: > >> =A0 =A0 =A0 =A0 =A0if (|DCM_Delay) begin > >What character is in front of DCM_Delay in that if statement? > > I hope it's a vertical bar, the reduction-OR operator; > that would make the test effectively "if (DCM_Delay !=3D 0)" > (which would have been more readable anyway). > > The code looks OK to me. =A0The counter DCM_Delay should > reset to 4'hf, count down to zero and then remain stuck at > zero until the next reset. =A0DCM_Reset should go to zero > one clock after DCM_Delay reaches zero. > > Is there any chance that (a) the clock is not ticking, or > (b) reset is stuck high? > -- > Jonathan Bromley I take both clock and reset to debug pins. They are working as expected. More investigation reveals that none of the clocked processes are running. It's as if there's some big global signal that is holding every flop in reset. I've tried 10.1.3 and 11.1.4 - both behave badly. I'm running in Linux64 (ubuntu 9.10), and can't find the 'enable global reset' option to turn it off. I got here trying to debug a DCM power-on reset. I've gone as far as stripping the code down to this counter and a couple of latches. The clock is the input to the DCM, but I've removed the DCM completely to debug this counter. I've noticed two more strange XST things: 1) If I use 'reset' as an async reset _anywhere_, XST assumes that it's OK to use it everywhere. Including on instance where I coded it (reset) as the input to a d-flop, and XST wired it to an async preset. 2) If I connect the counter to debug pins without a name translation or an OBUF, XST will disconnect the counter from the net. Looking at the RTL (or technology) schematic shows the output of the counter dangling. Frustrated, Gary. Comment on #1 above: The code is always @ (posedge fpga_clock) reset_d <=3D reset; XST ties the D input to '0', and connects reset to the async preset!