XST ff merging - how do I "preserve" flip flops

Hi, I'm trying to code this structure in Verilog. There are two flip flops (c and d) that are identical. XST 6.1.3 wants to merge them together. I want to stop it from doing that.

e .---. c +-----|D Q|----- | +-|>C | a .---. b | | | | ----|D Q|-----+ | '---' +--|>C | | | | | | | | | '---' | f | .---. d | +-----|D Q|----- clk-+----------------+-|>C | | | '---'

created by Andy´s ASCII-Circuit v1.24.140803 Beta

formatting link

I am giving the -equivalent_register_removal YES option to XST (it's needed elsewhere in the design) so I have to use attributes to stop XST from merging these particular ffs, since I don't wish to instantiate unisim components.

When I use the keep attribute on all of c, d, e and f, XST still merges the ffs, and comes back with this warning:

WARNING:Xst:638 - in unit foo Conflict on KEEP property on signal e and f f signal will be lost.

[ Warning 638 isn't in the Xilinx documentation or the answers database. ]

Here's the Verilog:

module foo ( input wire clk, input wire a, output reg c, output reg d );

reg b;

wire e = b; wire f = b;

// synthesis attribute keep of c is "true" // synthesis attribute keep of d is "true" // synthesis attribute keep of e is "true" // synthesis attribute keep of f is "true"

always @(posedge clk) begin b

Reply to
Allan Herriman
Loading thread data ...
[snip]

Note: if I use buf (Verilog primitive) instead of BUF (Xilinx unisim component) it will merge the flip flops. Presumably bufs get stripped out fairly early during synthesis.

Regards, Allan.

Reply to
Allan Herriman

Try:

// synthesis attribute equivalent_register_removal of c is "no" // synthesis attribute equivalent_register_removal of d is "no"

and see if that does what you want it to.

-- Brian

Allan Herriman wrote:

Reply to
Brian Philofsky

Why you need follow 2 attribute? // synthesis attribute keep of e is "true" // synthesis attribute keep of f is "true" e and f are not flip-flop.

Remove them should be OK

"Allan Herriman" ?ÈëÓ?þ news: snipped-for-privacy@4ax.com...

Reply to
Peng Cong

Remove them and watch XST merge the two flip flops. (I know; I tried it.)

I suggest you read the XST documentation.

Regards, Allan.

Reply to
Allan Herriman

--

--Ray Andraka, P.E. President, the Andraka Consulting Group, Inc.

401/884-7930 Fax 401/884-7950 email snipped-for-privacy@andraka.com
formatting link

"They that give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin, 1759

Reply to
Ray Andraka

To clarify, a preserve attribute on the output of the flip flops would stop them from being merged. XST does not support such an attribute, hence the ugly workaround using keep attributes on the inputs of the flip flops.

I need to use attributes to do a few things:

  1. Placement
  2. Preventing flip flops from being merged
  3. Preventing flip flops from being replicated
  4. Preventing buffers from being inserted into high-fanout logic

#1 isn't too bad, but the others are needlessly difficult in XST.

Regards, Allan.

Reply to
Allan Herriman
[snip]

I didn't see Brian's post on my server, but google found it.

// synthesis attribute equivalent_register_removal of c is "no" // synthesis attribute equivalent_register_removal of d is "no"

Silly me. I was looking for constraints in the constraints guide, and this one isn't listed there.

Thanks, Allan.

Reply to
Allan Herriman

Hang on, it *is* there. I don't understand how I missed it.

Oh well.

Allan.

Reply to
Allan Herriman

If the attribute setting does not work, or you don't want to turn off global removal of duplicates for the whole design, and you happen to have a spare I/O. Make sure the I/O is in a known state say pulled-up. Ensure the pin is defined as input or bi-directional. Use the input(bi) as a enable signal into your register choosing the "enabled" state to be the one you use and is always true. Don't do the same to copy register. They are now different and the synthesiser wouldn't remove the duplicate. Very crude approach but usually works.

You can do a similar thing by having one reg with a reset and one reg without reset but you need to ensure that this does not cause you other issues. There many variations you use I will leave to find the most suitable.

John Adair Enterpoint Ltd.

formatting link

This message is the personal opinion of the sender and not that necessarily that of Enterpoint Ltd.. Readers should make their own evaluation of the facts. No responsibility for error or inaccuracy is accepted.

Reply to
John Adair

Allan,

We were having a little trouble with our server's posting ability so it might not be your fault. The sad part is I have written several responses to people over the past few months but no one could see them unless you look at our server (it showed up on our server but not the outside world so I thought they were getting out). I think all is fixed now and if you are reading this, then hopefully the problem is corrected and should not cause confusion going forward. Sorry about that.

BTW, that attribute is in the 6.1i Constraints Guide on page 333 but looks like you might have found it now.

-- Brian

Allan Herriman wrote:

Reply to
Brian Philofsky

Hi Brian,

Reading you loud and clear.

I think I was misled by a statement on page 254 of the XST User Guide that said "You must use the KEEP constraint instead of SIGNAL_PRESERVE" (which is wrong), and didn't mention equivalent_register_removal at all.

Regards, Allan.

Reply to
Allan Herriman

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.