Prev: Test Post
Next: VHDL vs Verilog
From: Test01 on 12 Feb 2010 13:51 I am not sure why the QuartusII synthesis tool is considering ReqInFifoDataIn[72] a latch and not a flip-flop? ReqInFifoData[72] is clearly defined as part of synchronous always block. It is getting used by wTag signal - Here I am anding the D input of the Flip-Flop and Qn output of the same D flip-flop. The purpose of this is to generate one clock wide wTag pulse. input [81:0] RxStreamData0, wire wTag = RxStreamData0[72] & ~ReqInFifoDataIn[72]; always @(posedge AppClk or negedge PcieRstN) begin if (!PcieRstN) begin ReqInFifoDataIn <= 96'b0; ReqInFifoDataValid <= 1'b0; ReqInFifoDataVal <= 1'b0; end else begin ReqInFifoDataIn[81:0] <= RxStreamData0[81:0]; ReqInFifoDataValid <= RxStreamValid0; ReqInFifoDataVal <= ReqInFifoRd; end end
From: Gabor on 12 Feb 2010 15:38 On Feb 12, 1:51 pm, Test01 <cpan...(a)yahoo.com> wrote: > I am not sure why the QuartusII synthesis tool is considering > ReqInFifoDataIn[72] a latch and not a flip-flop? ReqInFifoData[72] is > clearly defined as part of synchronous always block. It is getting > used by wTag signal - Here I am anding the D input of the Flip-Flop > and Qn output of the same D flip-flop. The purpose of this is to > generate one clock wide wTag pulse. > > input [81:0] RxStreamData0, > > wire wTag = RxStreamData0[72] & ~ReqInFifoDataIn[72]; > > always @(posedge AppClk or negedge PcieRstN) begin > if (!PcieRstN) begin > ReqInFifoDataIn <= 96'b0; > ReqInFifoDataValid <= 1'b0; > ReqInFifoDataVal <= 1'b0; > end > else begin > ReqInFifoDataIn[81:0] <= RxStreamData0[81:0]; > ReqInFifoDataValid <= RxStreamValid0; > ReqInFifoDataVal <= ReqInFifoRd; > end > end I'm not that familiar with Quartus, but in Xilinx tools there are often messages that reference "flip-flop/latch" which is the cover-all-cases text to talk about a register. The only weird thing in your code is that RegInFifoDataIn would appear to be 96 bits as evidenced by the reset term, but only 82 bits are assigned in the clocked term. That would tend to make bits 82 and up "latches" but doesn't explain the problem with bit 72. Regards, Gabor
From: Jonathan Bromley on 12 Feb 2010 17:06 On Fri, 12 Feb 2010 10:51:20 -0800 (PST), Test01 <cpandya(a)yahoo.com> wrote: >I am not sure why the QuartusII synthesis tool is considering >ReqInFifoDataIn[72] a latch and not a flip-flop? Hollow and self-mocking laughter.... This is an example of the error I make more than any other when writing RTL code. >ReqInFifoData[72] is >clearly defined as part of synchronous always block. No, it's not! You do NOT write to ReqInFifoData[75:82] in the clocked (else) part of the always block; it's only written in the reset branch. The clocked branch writes only to the lower 82 bits. It probably doesn't matter; if you don't use those extra bits, their flip-flops will be removed by synthesis optimizations. -- Jonathan Bromley
From: glen herrmannsfeldt on 12 Feb 2010 17:46 Jonathan Bromley <jonathan.bromley(a)mycompany.com> wrote: (snip, someone wrote) >>ReqInFifoData[72] is >>clearly defined as part of synchronous always block. > No, it's not! You do NOT write to ReqInFifoData[75:82] > in the clocked (else) part of the always block; it's > only written in the reset branch. The clocked branch > writes only to the lower 82 bits. The usual rule in other newgroups is to post the declarations of the data along with the code. As we don't know the width of RegInFifoData it is hard to say. It does seem likely to be ore than 82, though. > It probably doesn't matter; if you don't use those > extra bits, their flip-flops will be removed by > synthesis optimizations. -- glen
From: Jonathan Bromley on 12 Feb 2010 17:57
On Fri, 12 Feb 2010 22:46:31 +0000 (UTC), glen herrmannsfeldt wrote: >The usual rule in other newgroups is to post the declarations >of the data along with the code. A good plan, for sure. Maybe a declaration would have helped me to write "[95:82]", which is what I meant, instead of "[75:82]", which is what I wrote... > As we don't know the width >of RegInFifoData it is hard to say. It does seem likely to >be more than 82, though. I took the line ReqInFifoData <= 96'b0; to be a sufficiently broad hint :-) -- Jonathan Bromley |