Description:
To add or control a net's delay manually is useful in some cases to improve hold time or adjust the skew between two nets. In order to add delay to a net, one or more buffers need to be added to the net. You will also need to add attributes and preferences to ensure the buffers do not get removed during the Synthesis and MAP processes.
Here is the sample code:
in Verilog:
module add_del(din,dout);
input din;
output dout;
wire buf1 /* synthesis syn_keep=1 nomerge=""*/;
wire buf2 /* synthesis syn_keep=1 nomerge=""*/;
BUFBA del1(.Z(buf1), .A(din))/* synthesis loc = "R3C3D" */;
BUFBA del2(.Z(buf2), .A(buf1))/* synthesis loc = "R3C4D" */;
assign dout = buf2;
endmodule
module BUFBA (Z, A);
output Z ;
input A ;
endmodule // BUFFER
in VHDL:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity add_del is
port (din : in std_logic;
dout : out std_logic);
end entity add_del;
architecture RTL of add_del is
component BUFBA is
port (
A : in std_logic;
Z : out std_logic
);
end component;
signal buf1 : std_logic;
signal buf2 : std_logic;
attribute syn_keep : boolean;
attribute syn_keep of buf1, buf2 : signal is true;
attribute nomerge : string;
attribute nomerge of buf1, buf2 : signal is "";
attribute loc : string;
attribute loc of del1 : label is "R3C3D";
attribute loc of del2 : label is "R3C4D";
begin
del1 : BUFBA port map ( A => din, Z => buf1);
del2 : BUFBA port map ( A => buf1, Z => buf2);
dout <= buf2;
end architecture RTL;
In the code, the module "BUFBA" is the Lattice primitive for a buffer.
The "syn_keep" attribute is the synthesis attribute to keep the specified net intact during optimization and synthesis.
The "nomerge" preference is the Lattice preference to prevent the net from being absorbed into a logic block during MAP.
The loc preference is used to lock the location of the buffers.
In the above example, two buffers are added. The number of buffers used depends on how much delay needs to be added. Locking the location of the buffers allows some measure of routing delay control. The closer the locations of the two buffers are, the smaller the routing delay. The real delay can be found in the Place and Route TRACE Report, see the example below: