Professional Documents
Culture Documents
XST Rev Mandrade
XST Rev Mandrade
This document applies to the following software versions: ISE Design Suite 14.5 through 14.7
Notice of Disclaimer
The information disclosed to you hereunder (the "Materials") is provided solely for the selection and use
of Xilinx products. To the maximum extent permitted by applicable law: (1) Materials are made available
"AS IS" and with all faults, Xilinx hereby DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS,
IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY,
NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and (2) Xilinx shall not be liable
(whether in contract or tort, including negligence, or under any other theory of liability) for any loss or damage
of any kind or nature related to, arising under, or in connection with, the Materials (including your use of the
Materials), including for any direct, indirect, special, incidental, or consequential loss or damage (including loss
of data, profits, goodwill, or any type of loss or damage suffered as a result of any action brought by a third
party) even if such damage or loss was reasonably foreseeable or Xilinx had been advised of the possibility of the
same. Xilinx assumes no obligation to correct any errors contained in the Materials or to notify you of updates to
the Materials or to product specifications. You may not reproduce, modify, distribute, or publicly display the
Materials without prior written consent. Certain products are subject to the terms and conditions of the Limited
Warranties which can be viewed at http://www.xilinx.com/warranty.htm; IP cores may be subject to warranty
and support terms contained in a license issued to you by Xilinx. Xilinx products are not designed or intended to
be fail-safe or for use in any application requiring fail-safe performance; you assume sole risk and liability for use
of Xilinx products in Critical Applications: http://www.xilinx.com/warranty.htm#critapps.
© Copyright 2002-2013 Xilinx Inc. All rights reserved. Xilinx, the Xilinx logo, Artix, ISE, Kintex, Spartan, Virtex,
Vivado, Zynq, and other designated brands included herein are trademarks of Xilinx in the United States and
other countries. The PowerPC name and logo are registered trademarks of IBM Corp., and used under license.
All other trademarks are the property of their respective owners.
Frontmatter
2 www.xilinx.com UG627 (v 14.5) March 20, 2013
Table of Contents
Chapter 1 About This Guide ......................................................................................11
Guide Overview................................................................................................... 11
Supported Devices ............................................................................................... 12
Guide Overview
This Guide:
• Applies only to the devices listed in Supported Devices.
• Describes Xilinx Synthesis Technology (XST) support for:
– Hardware Description Language (HDL) designs
– Supported Xilinx® devices
– Design constraints for the Xilinx ISE® Design Suite software
• Discusses optimization and coding techniques when creating designs for use with
XST.
• Explains how to run XST from the:
– ISE Design Suite Process window
– Command line
Supported Devices
This Guide applies to the following Xilinx® devices only:
• FPGA Devices
– Virtex®-4
– Virtex-5
– Spartan®-3 device family, including:
♦ Spartan-3
♦ Spartan-3A
♦ Spartan-3A DSP
♦ Spartan-3AN
♦ Spartan-3E
♦ Spartan-3L
• CPLD Devices
– CoolRunner™ XPLA3
– CoolRunner-II
– XC9500
– XC9500XL
About XST
Xilinx Synthesis Technology (XST) is a Xilinx® application that synthesizes Hardware
Description Language (HDL) designs to create Xilinx specific netlist files called NGC
files.
The NGC file:
• Is a netlist that contains both logical design data and constraints.
• Takes the place of both Electronic Data Interchange Format (EDIF) and Netlist
Constraints File (NCF) files.
For more information, see:
Xilinx Synthesis Technology (XST) - Frequently Asked Questions (FAQ)
Search for keyword XST FAQ.
Unsigned Adders
PACKAGE TYPE
numeric_std unsigned
std_logic_arith unsigned
std_logic_unsigned std_logic_vector
To create a signed adder, use the arithmetic packages and types that operate on signed
values shown in the following table.
Signed Adders
PACKAGE TYPE
numeric_std signed
std_logic_arith signed
std_logic_signed std_logic_vector
For more information about available types, see the IEEE VHDL Manual.
About Registers
XST recognizes flip-flops with the following control signals:
• Asynchronous Set/Reset
• Synchronous Set/Reset
• Clock Enable
For more information, see:
Specifying INIT and RLOC
===============================================================
HDL Synthesis Report
Macro Statistics
# Registers : 1
4-bit register : 1
===============================================================
===============================================================
* Advanced HDL Synthesis *
===============================================================
===============================================================
Advanced HDL Synthesis Report
Macro Statistics
# Registers : 4
Flip-Flops/Latches : 4
===============================================================
...
entity registers_1 is
port(C, D : in std_logic;
Q : out std_logic);
end registers_1;
process (C)
begin
if (C’event and C=’1’) then
Q <= D;
end if;
end process;
end archi;
always @(posedge C)
begin
Q <= D;
end
endmodule
Flip-Flop With Positive Edge Clock with INITSTATE of the Flop Set Verilog
Coding Example
module test(d, C, q);
input d;
input C;
output q;
always @ (posedge C)
begin
qtemp = d;
end
assign q = qtemp;
endmodule
Flip-Flop With Positive Edge Clock with INITSTATE of the Flop Set VHDL
Coding Example
library ieee;
use ieee.std_logic_1164.all;
entity registers_1 is
port(C, D : in std_logic;
Q : out std_logic);
end registers_1;
begin
process (C)
begin
if (C’event and C=’1’) then
qtemp <= D;
end if;
Q <= Qtemp;
end process;
end archi;
library ieee;
use ieee.std_logic_1164.all;
entity registers_2 is
port(C, D, CLR : in std_logic;
Q : out std_logic);
end registers_2;
end archi;
endmodule
process (C)
begin
if (C’event and C=’1’) then
if (S=’1’) then
Q <= ’1’;
else
Q <= D;
end if;
end if;
end process;
end archi;
always @(posedge C)
begin
if (S)
Q <= 1’b1;
else
Q <= D;
end
endmodule
entity registers_4 is
port(C, D, CE : in std_logic;
Q : out std_logic);
end registers_4;
process (C)
begin
if (C’event and C=’1’) then
if (CE=’1’) then
Q <= D;
end if;
end if;
end process;
end archi;
Flip-Flop With Positive-Edge Clock and Clock Enable Verilog Coding
Example
//
// Flip-Flop with Positive-Edge Clock and Clock Enable
//
always @(posedge C)
begin
if (CE)
Q <= D;
end
endmodule
--
-- 4-bit Register with Positive-Edge Clock,
-- Asynchronous Set and Clock Enable
--
library ieee;
use ieee.std_logic_1164.all;
entity registers_5 is
port(C, CE, PRE : in std_logic;
D : in std_logic_vector (3 downto 0);
Q : out std_logic_vector (3 downto 0));
end registers_5;
end archi;
//
// 4-bit Register with Positive-Edge Clock,
// Asynchronous Set and Clock Enable
//
endmodule
About Latches
XST can recognize latches with asynchronous set/reset control signals. Latches can
be described using:
• Process (VHDL)
• Always block (Verilog)
• Concurrent state assignment
XST does not support wait statements (VHDL) for latch descriptions.
=======================================
HDL Synthesis Report
Macro Statistics
# Latches : 1
1-bit latch : 1
========================================
...
always @(G or D)
begin
if (G)
Q = D;
end
endmodule
Latch With Positive Gate and Asynchronous Reset VHDL Coding Example
--
-- Latch with Positive Gate and Asynchronous Reset
--
library ieee;
use ieee.std_logic_1164.all;
entity latches_2 is
port(G, D, CLR : in std_logic;
Q : out std_logic);
end latches_2;
Latch With Positive Gate and Asynchronous Reset Verilog Coding Example
//
// Latch with Positive Gate and Asynchronous Reset
//
4-Bit Latch With Inverted Gate and Asynchronous Set VHDL Coding
Example
--
-- 4-bit Latch with Inverted Gate and Asynchronous Set
--
library ieee;
use ieee.std_logic_1164.all;
entity latches_3 is
port(D : in std_logic_vector(3 downto 0);
G, PRE : in std_logic;
Q : out std_logic_vector(3 downto 0));
end latches_3;
4-Bit Latch With Inverted Gate and Asynchronous Set Verilog Coding
Example
//
// 4-bit Latch with Inverted Gate and Asynchronous Set
//
About Tristates
Tristate elements can be described using:
• Combinatorial process (VHDL)
• Always block (Verilog)
• Concurrent assignment
In the Tristates Coding Examples, comparing to 0 instead of 1 infers a BUFT primitive
instead of a BUFE macro. The BUFE macro has an inverter on the E pin.
=============================
HDL Synthesis Report
Macro Statistics
# Tristates : 1
1-bit tristate buffer : 1
=============================
...
library ieee;
use ieee.std_logic_1164.all;
entity three_st_1 is
port(T : in std_logic;
I : in std_logic;
O : out std_logic);
end three_st_1;
process (I, T)
begin
if (T=’0’) then
O <= I;
else
O <= ’Z’;
end if;
end process;
end archi;
always @(T or I)
begin
if (~T)
O = I;
else
O = 1’bZ;
end
endmodule
library ieee;
use ieee.std_logic_1164.all;
entity three_st_2 is
port(T : in std_logic;
I : in std_logic;
O : out std_logic);
end three_st_2;
end archi;
endmodule
About Counters
XST recognizes counters with the following control signals:
• Asynchronous Set/Reset
• Synchronous Set/Reset
• Asynchronous/Synchronous Load (signal or constant or both)
• Clock Enable
• Modes (Up, Down, Up/Down)
• Mixture of all of the above
Hardware Description Language (HDL) coding styles for the following control signals
are equivalent to those described in Registers HDL Coding Techniques.
• Clock
• Asynchronous Set/Reset
• Synchronous Set/Reset
XST supports both unsigned and signed counters.
==============================
HDL Synthesis Report
Macro Statistics
# Counters : 1
4-bit up counter : 1
==============================
...
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity counters_1 is
port(C, CLR : in std_logic;
Q : out std_logic_vector(3 downto 0));
end counters_1;
Q <= tmp;
end archi;
assign Q = tmp;
endmodule
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity counters_2 is
port(C, S : in std_logic;
Q : out std_logic_vector(3 downto 0));
end counters_2;
Q <= tmp;
end archi;
always @(posedge C)
begin
if (S)
tmp <= 4’b1111;
else
tmp <= tmp - 1’b1;
end
assign Q = tmp;
endmodule
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity counters_3 is
port(C, ALOAD : in std_logic;
D : in std_logic_vector(3 downto 0);
Q : out std_logic_vector(3 downto 0));
end counters_3;
Q <= tmp;
end archi;
assign Q = tmp;
endmodule
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity counters_4 is
port(C, SLOAD : in std_logic;
Q : out std_logic_vector(3 downto 0));
end counters_4;
Q <= tmp;
end archi;
4-Bit Unsigned Up Counter With Synchronous Load With Constant Verilog
Coding Example
//
// 4-bit Unsigned Up Counter with Synchronous Load
// with a Constant
//
always @(posedge C)
begin
if (SLOAD)
tmp <= 4’b1010;
else
tmp <= tmp + 1’b1;
end
assign Q = tmp;
endmodule
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity counters_5 is
port(C, CLR, CE : in std_logic;
Q : out std_logic_vector(3 downto 0));
end counters_5;
Q <= tmp;
end archi;
assign Q = tmp;
endmodule
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity counters_6 is
port(C, CLR, UP_DOWN : in std_logic;
Q : out std_logic_vector(3 downto 0));
end counters_6;
Q <= tmp;
end archi;
end
assign Q = tmp;
endmodule
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_signed.all;
entity counters_7 is
port(C, CLR : in std_logic;
Q : out std_logic_vector(3 downto 0));
end counters_7;
Q <= tmp;
end archi;
assign Q = tmp;
endmodule
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
entity counters_8 is
Q <= cnt;
end archi;
input C, CLR;
output [MAX_SQRT-1:0] Q;
reg [MAX_SQRT-1:0] cnt;
assign Q = cnt;
endmodule
About Accumulators
An accumulator differs from a counter in the nature of the operands of the add and
subtract operation.
• In a counter:
– The destination and first operand is a signal or variable
– The second operand is a constant equal to 1:
A <= A + 1
• In an accumulator:
– The destination and first operand is a signal or variable
– The second operand is either:
♦ A signal or variable:
A <= A + B
♦ A constant not equal to 1:
A <= A + Constant
An inferred accumulator can be up, down, or updown. For an updown accumulator,
the accumulated data may differ between the up and down mode:
...
if updown = ’1’ then
a <= a + b;
else
a <= a - c;
...
XST can infer an accumulator with the same set of control signals available for counters.
For more information, see:
Counters HDL Coding Techniques
==============================
HDL Synthesis Report
Macro Statistics
# Accumulators : 1
4-bit up accumulator : 1
==============================
...
--
-- 4-bit Unsigned Up Accumulator with Asynchronous Reset
--
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity accumulators_1 is
port(C, CLR : in std_logic;
D : in std_logic_vector(3 downto 0);
Q : out std_logic_vector(3 downto 0));
end accumulators_1;
Q <= tmp;
end archi;
//
// 4-bit Unsigned Up Accumulator with Asynchronous Reset
//
input C, CLR;
input [3:0] D;
output [3:0] Q;
reg [3:0] tmp;
Additional Functionality
You can include additional functionality, such as reset, set, or parallel load logic.
In this case however, XST may not always be able to take advantage of dedicated
SRL-type primitives for reduced device utilization and optimized performance. Xilinx®
recommends removing such logic, and loading the desired contents serially instead.
=============================================
* Advanced HDL Synthesis *
=============================================
Advanced HDL Synthesis Report
Macro Statistics
# Registers : 8
Flip-Flops : 8
=============================================
=============================================
* Low Level Synthesis *
=============================================
Processing Unit <shift_registers_1> :
Found 8-bit shift register for signal <tmp_7>.
Unit <shift_registers_1> processed.
=============================================
Final Register Report
Macro Statistics
# Shift Registers : 1
8-bit shift register : 1
=============================================
library ieee;
use ieee.std_logic_1164.all;
entity shift_registers_1 is
port(C, SI : in std_logic;
SO : out std_logic);
end shift_registers_1;
process (C)
begin
if (C’event and C=’1’) then
for i in 0 to 6 loop
tmp(i+1) <= tmp(i);
end loop;
tmp(0) <= SI;
end if;
end process;
SO <= tmp(7);
end archi;
always @(posedge C)
begin
tmp = {tmp[6:0], SI};
end
assign SO = tmp[7];
endmodule
entity shift_registers_2 is
port(C, SI, CE : in std_logic;
SO : out std_logic);
end shift_registers_2;
process (C)
begin
if (C’event and C=’0’) then
if (CE=’1’) then
for i in 0 to 6 loop
tmp(i+1) <= tmp(i);
end loop;
tmp(0) <= SI;
end if;
end if;
end process;
SO <= tmp(7);
end archi;
always @(negedge C)
begin
if (CE)
begin
tmp = {tmp[6:0], SI};
end
end
assign SO = tmp[7];
endmodule
=============================================
* Advanced HDL Synthesis *
=============================================
...
Synthesizing (advanced) Unit <dynamic_shift_registers_1>.
Found 16-bit dynamic shift register for signal <Q>.
Unit <dynamic_shift_registers_1> synthesized (advanced).
=============================================
HDL Synthesis Report
Macro Statistics
# Shift Registers : 1
16-bit dynamic shift register : 1
=============================================
...
The following table shows pin descriptions for a dynamic register. The register can:
• Be either serial or parallel
• Be left or right
• Have a synchronous or asynchronous reset
• Have a depth up to 16 bits.
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_unsigned.all;
entity dynamic_shift_registers_1 is
port(CLK : in std_logic;
DATA : in std_logic;
CE : in std_logic;
A : in std_logic_vector(3 downto 0);
Q : out std_logic);
end dynamic_shift_registers_1;
begin
PROC_SRL16 : process (CLK)
begin
if (CLK’event and CLK = ’1’) then
if (CE = ’1’) then
SRL_SIG <= DATA & SRL_SIG(0 to DEPTH_WIDTH-2);
end if;
end if;
end process;
Q <= SRL_SIG(conv_integer(A));
end rtl;
assign Q = data[A];
endmodule
About Multiplexers
This section discusses About Multiplexers, and includes:
• Multiplexers Description Styles
• Verilog Case Statements
• Verilog Case Statement Resources
• Case Implementation Style Parameter
• Multiplexers Case Statements
Parameter
Value Case Implementation
Full Not Full Neither Full nor Parallel
none MUX Latch Priority Encoder + Latch
parallel MUX Latch Latch
full MUX MUX Priority Encoder
full-parallel MUX MUX MUX
parallel Considers that the branches cannot occur in parallel and does not use a priority
encoder
full-parallel Considers that case statements are complete and that the branches cannot occur
in parallel, therefore saving latches and priority encoders
XST automatically determines the characteristics of the case statements and generates
logic using multiplexers, priority encoders, and latches that best implement the exact
behavior of the case statement.
=============================
HDL Synthesis Report
Macro Statistics
# Multiplexers : 1
1-bit 4-to-1 multiplexer : 1
==============================
...
Explicit inference and reporting of multiplexers may vary depending on the targeted
device families. The following coding examples are limited to 4-to-1 multiplexers. They
are reported as shown above only if the target is a LUT4-based device family. For
Virtex®-5 devices, multiplexers are explicitly inferred only for sizes of 8-to-1 and above.
library ieee;
use ieee.std_logic_1164.all;
entity multiplexers_1 is
port (a, b, c, d : in std_logic;
s : in std_logic_vector (1 downto 0);
o : out std_logic);
end multiplexers_1;
always @(a or b or c or d or s)
begin
if (s == 2’b00) o = a;
else if (s == 2’b01) o = b;
else if (s == 2’b10) o = c;
else o = d;
end
endmodule
library ieee;
use ieee.std_logic_1164.all;
entity multiplexers_2 is
port (a, b, c, d : in std_logic;
s : in std_logic_vector (1 downto 0);
o : out std_logic);
end multiplexers_2;
always @(a or b or c or d or s)
begin
case (s)
2’b00 : o = a;
2’b01 : o = b;
2’b10 : o = c;
default : o = d;
endcase
end
endmodule
library ieee;
use ieee.std_logic_1164.all;
entity multiplexers_3 is
port (a, b, c, d : in std_logic;
s : in std_logic_vector (3 downto 0);
o : out std_logic);
end multiplexers_3;
Unless you actually intended to describe such a latch, add the missing else statement.
Caution! Leaving out an else statement may result in errors during simulation.
--
-- 3-to-1 1-bit MUX with a 1-bit latch.
--
library ieee;
use ieee.std_logic_1164.all;
entity multiplexers_4 is
port (a, b, c: in std_logic;
s : in std_logic_vector (1 downto 0);
o : out std_logic);
end multiplexers_4;
always @(a or b or c or s)
begin
if (s == 2’b00) o = a;
else if (s == 2’b01) o = b;
else if (s == 2’b10) o = c;
end
endmodule
About Decoders
A decoder is a multiplexer the inputs of which are all constant with distinct one-hot (or
one-cold) coded values.
For more information, see:
Multiplexers HDL Coding Techniques
Macro Statistics
# Decoders : 1
1-of-8 decoder : 1
==============================
...
library ieee;
use ieee.std_logic_1164.all;
entity decoders_1 is
port (sel: in std_logic_vector (2 downto 0);
res: out std_logic_vector (7 downto 0));
end decoders_1;
library ieee;
use ieee.std_logic_1164.all;
entity decoders_2 is
port (sel: in std_logic_vector (2 downto 0);
res: out std_logic_vector (7 downto 0));
end decoders_2;
always @(sel)
begin
case (sel)
3’b000 : res = 8’b11111110;
3’b001 : res = 8’b11111101;
3’b010 : res = 8’b11111011;
3’b011 : res = 8’b11110111;
3’b100 : res = 8’b11101111;
3’b101 : res = 8’b11011111;
3’b110 : res = 8’b10111111;
default : res = 8’b01111111;
endcase
end
endmodule
library ieee;
use ieee.std_logic_1164.all;
entity decoders_3 is
port (sel: in std_logic_vector (2 downto 0);
res: out std_logic_vector (7 downto 0));
end decoders_3;
end archi;
always @(sel)
begin
case (sel)
3’b000 : res = 8’b00000001;
// unused decoder output
3’b001 : res = 8’bxxxxxxxx;
3’b010 : res = 8’b00000100;
3’b011 : res = 8’b00001000;
3’b100 : res = 8’b00010000;
3’b101 : res = 8’b00100000;
3’b110 : res = 8’b01000000;
default : res = 8’b10000000;
endcase
end
endmodule
library ieee;
use ieee.std_logic_1164.all;
entity decoders_4 is
port (sel: in std_logic_vector (2 downto 0);
res: out std_logic_vector (7 downto 0));
end decoders_4;
==============================
HDL Synthesis Report
Macro Statistics
# Priority Encoders : 1
3-bit 1-of-9 priority encoder : 1
==============================
...
library ieee;
use ieee.std_logic_1164.all;
entity priority_encoder_1 is
port ( sel : in std_logic_vector (7 downto 0);
code :out std_logic_vector (2 downto 0));
end archi;
(* priority_extract="force" *)
module v_priority_encoder_1 (sel, code);
input [7:0] sel;
output [2:0] code;
reg [2:0] code;
always @(sel)
begin
if (sel[0]) code = 3’b000;
else if (sel[1]) code = 3’b001;
else if (sel[2]) code = 3’b010;
else if (sel[3]) code = 3’b011;
else if (sel[4]) code = 3’b100;
else if (sel[5]) code = 3’b101;
else if (sel[6]) code = 3’b110;
else if (sel[7]) code = 3’b111;
else code = 3’bxxx;
end
endmodule
Macro Statistics
# Logic shifters : 1
8-bit shifter logical left : 1
==============================
...
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity logical_shifters_1 is
port(DI : in unsigned(7 downto 0);
SEL : in unsigned(1 downto 0);
SO : out unsigned(7 downto 0));
end logical_shifters_1;
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity logical_shifters_2 is
port(DI : in unsigned(7 downto 0);
SEL : in unsigned(1 downto 0);
SO : out unsigned(7 downto 0));
end logical_shifters_2;
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity logical_shifters_3 is
port(DI : in unsigned(7 downto 0);
SEL : in unsigned(1 downto 0);
SO : out unsigned(7 downto 0));
end logical_shifters_3;
Resource Sharing
XST performs resource sharing for:
• Adders
• Subtractors
• Adders/subtractors
• Multipliers
=============================
HDL Synthesis Report
Macro Statistics
# Adders/Subtractors : 1
8-bit adder : 1
==============================
===========================================================
HDL Synthesis Report
Macro Statistics
# Adders/Subtractors : 1
8-bit adder carry in/out : 1
============================================================
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity adders_1 is
port(A,B : in std_logic_vector(7 downto 0);
SUM : out std_logic_vector(7 downto 0));
end adders_1;
SUM <= A + B;
end archi;
Unsigned 8-Bit Adder Verilog Coding Example
//
// Unsigned 8-bit Adder
//
assign SUM = A + B;
endmodule
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity adders_2 is
port(A,B : in std_logic_vector(7 downto 0);
CI : in std_logic;
SUM : out std_logic_vector(7 downto 0));
end adders_2;
end archi;
Unsigned 8-Bit Adder With Carry In Verilog Coding Example
//
// Unsigned 8-bit Adder with Carry In
//
endmodule
One solution for the example is to adjust the size of operands A and B to 9 bits using
concatenation.
Res <= ("0" & A) + ("0" & B);
In this case, XST recognizes that this 9-bit adder can be implemented as an 8-bit adder
with carry out.
Another solution is:
• Convert A and B to integers
• Convert the result back to the std_logic vector
• Specify the size of the vector equal to 9
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity adders_3 is
port(A,B : in std_logic_vector(7 downto 0);
SUM : out std_logic_vector(7 downto 0);
CO : out std_logic);
end adders_3;
end archi;
assign tmp = A + B;
assign SUM = tmp [7:0];
assign CO = tmp [8];
endmodule
Unsigned 8-Bit Adder With Carry In and Carry Out Pin Descriptions IO Pins
IO Pins Description
A, B Add Operands
CI Carry In
SUM Add Result
CO Carry Out
Unsigned 8-Bit Adder With Carry In and Carry Out VHDL Coding Example
--
-- Unsigned 8-bit Adder with Carry In and Carry Out
--
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity adders_4 is
port(A,B : in std_logic_vector(7 downto 0);
CI : in std_logic;
SUM : out std_logic_vector(7 downto 0);
CO : out std_logic);
end adders_4;
end archi;
Unsigned 8-Bit Adder With Carry In and Carry Out Verilog Coding Example
//
// Unsigned 8-bit Adder with Carry In and Carry Out
//
endmodule
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_signed.all;
entity adders_5 is
port(A,B : in std_logic_vector(7 downto 0);
SUM : out std_logic_vector(7 downto 0));
end adders_5;
SUM <= A + B;
end archi;
assign SUM = A + B;
endmodule
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity adders_6 is
port(A,B : in std_logic_vector(7 downto 0);
RES : out std_logic_vector(7 downto 0));
end adders_6;
RES <= A - B;
end archi;
Unsigned 8-Bit Subtractor Verilog Coding Example
//
// Unsigned 8-bit Subtractor
//
assign RES = A - B;
endmodule
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity adders_8 is
port(A,B : in std_logic_vector(7 downto 0);
BI : in std_logic;
RES : out std_logic_vector(7 downto 0));
end adders_8;
begin
end archi;
endmodule
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity adders_7 is
port(A,B : in std_logic_vector(7 downto 0);
OPER: in std_logic;
RES : out std_logic_vector(7 downto 0));
end adders_7;
end archi;
endmodule
About Comparators
Not applicable.
=============================
HDL Synthesis Report
Macro Statistics
# Comparators : 1
8-bit comparator greatequal : 1
==============================
...
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity comparator_1 is
port(A,B : in std_logic_vector(7 downto 0);
CMP : out std_logic);
end comparator_1;
end archi;
About Multipliers
This section discusses Multipliers, and includes:
• Implementing a Multiplier
• Registered Multipliers
• Multiplication with Constant
Implementing a Multiplier
When implementing a multiplier, the size of the resulting signal is equal to the sum of
two operand lengths. For example, if you multiply A (8-bit signal) by B (4-bit signal),
the size of the result must be declared as a 12-bit signal.
Registered Multipliers
In instances where a multiplier would have a registered output, XST infers a unique
registered multiplier for the following devices:
• Virtex®-4
• Virtex-5
This registered multiplier is 18x18 bits.
Under the following conditions, a registered multiplier is not used, and a multiplier +
register is used instead.
• Output from the multiplier goes to any component other than the register.
• The Multiplier Style (MULT_STYLE) constraint is set to:
lut
• The multiplier is asynchronous.
• The multiplier has control signals other than synchronous reset or clock enable.
• The multiplier does not fit in a single 18x18 bit block multiplier.
The following pins are optional for a registered multiplier:
• Clock enable port
• Synchronous and asynchronous reset, and load ports
Dedicated implementations do not always provide the best results for multiplication
with constants. XST can automatically choose between KCM or standard multiplier
implementation. The CSD method cannot be automatically chosen. Use Mux Style
(MUX_STYLE) to force CSD implementation.
XST does not support KCM or CSD implementation for signed numbers.
If the either of the arguments is larger than 32 bits, XST does not use KCM or CSD
implementation, even if it is specified with Multiplier Style (MULT_STYLE).
Xilinx® recommends:
• Use Use DSP48 (USE_DSP48) for Virtex-4 devices and Virtex-5 devices to define
FPGA resources used for multiplier implementation.
• Use Multiplier Style (MULT_STYLE) to define the multiplier implementation
method on the selected FPGA resources.
The following rules apply:
• If Use DSP48 (USE_DSP48) is set to auto or yes, you may use mult_style=pipe_block
to pipeline the DSP48 implementation if the multiplier implementation requires
multiple DSP48 blocks.
• If Use DSP48 (USE_DSP48) is set to no, use mult_style=pipe_lut|KCM|CSD to
define the multiplier implementation method on LUTs.
=============================
HDL Synthesis Report
Macro Statistics
# Multiplexers : 1
1-bit 4-to-1 multiplexer : 1
==============================
...
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity multipliers_1 is
port(A : in std_logic_vector(7 downto 0);
B : in std_logic_vector(3 downto 0);
RES : out std_logic_vector(11 downto 0));
end multipliers_1;
assign RES = A * B;
endmodule
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity multipliers_8 is
generic(A_WIDTH: positive:=18;
B_WIDTH: positive:=18;
RES_WIDTH: positive:=48);
port( CLK: in std_logic;
A: in signed(A_WIDTH-1 downto 0);
B: in signed(B_WIDTH-1 downto 0);
Oper_Load: in std_logic;
Oper_AddSub: in std_logic;
-- Oper_Load Oper_AddSub Operation
-- 0 0 R= +A*B
-- 0 1 R= -A*B
-- 1 0 R=R+A*B
-- 1 1 R=R-A*B
process (clk)
variable acc: signed(RES_WIDTH-1 downto 0);
begin
if rising_edge(clk) then
p1 <= A*B;
oper_load1 <= oper_load0;
oper_addsub1 <= oper_addsub0;
if (oper_load1=’1’) then
acc := res0;
else
acc := (others=>’0’);
end if;
if (oper_addsub1=’1’) then
res0 <= acc-p1;
else
res0 <= acc+p1;
end if;
end if;
end process;
end architecture;
input CLK;
input signed [A_WIDTH-1:0] A, B;
reg oper_load0 = 0;
reg oper_addsub0 = 0;
p1 <= A*B;
oper_load1 <= oper_load0;
oper_addsub1 <= oper_addsub0;
if (oper_load1==1’b1)
acc = res0;
else
acc = 0;
if (oper_addsub1==1’b1)
res0 <= acc-p1;
else
res0 <= acc+p1;
end
endmodule
Maximizing Performance
In order to reach the maximum multiplier speed, XST uses the maximum number of
available registers when:
• XST detects valid registers for pipelining, and
• Multiplier Style (MULT_STYLE) is set to:
pipe_lut or pipe_block
In order to obtain the best frequency, XST automatically calculates the maximum
number of registers for each multiplier .
During the Advanced HDL Synthesis step, the XST HDL Advisor advises you to specify
the optimum number of register stages if:
• You have not specified sufficient register stages, and
• Multiplier Style (MULT_STYLE) is coded directly on a signal,
XST Limitations
XST has the following limitations:
• XST cannot pipeline hardware Multipliers (implementation using MULT18X18S
resource)
• XST cannot pipeline Multipliers if registers contain async set/reset or sync reset
signals. XST can pipeline if registers contain sync reset signals.
====================================================================
HDL Synthesis Report
Macro Statistics
# Multipliers : 1
18x18-bit registered multiplier : 1
====================================================================
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity multipliers_2 is
generic(A_port_size : integer := 18;
B_port_size : integer := 18);
port(clk : in std_logic;
A : in unsigned (A_port_size-1 downto 0);
B : in unsigned (B_port_size-1 downto 0);
MULT : out unsigned ( (A_port_size+B_port_size-1) downto 0));
end multipliers_2;
begin
process (clk)
begin
if (clk’event and clk=’1’) then
a_in <= A; b_in <= B;
pipe_1 <= mult_res;
pipe_2 <= pipe_1;
pipe_3 <= pipe_2;
MULT <= pipe_3;
end if;
end process;
end beh;
(*mult_style="pipe_lut"*)
module v_multipliers_2(clk, A, B, MULT);
input clk;
input [17:0] A;
input [17:0] B;
output [35:0] MULT;
reg [35:0] MULT;
reg [17:0] a_in, b_in;
wire [35:0] mult_res;
reg [35:0] pipe_1, pipe_2, pipe_3;
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity multipliers_3 is
generic(A_port_size: integer := 18;
B_port_size: integer := 18);
port(clk : in std_logic;
A : in unsigned (A_port_size-1 downto 0);
B : in unsigned (B_port_size-1 downto 0);
MULT : out unsigned ((A_port_size+B_port_size-1) downto 0));
end multipliers_3;
begin
process (clk)
begin
if (clk’event and clk=’1’) then
a_in <= A; b_in <= B;
mult_res <= a_in * b_in;
pipe_2 <= mult_res;
pipe_3 <= pipe_2;
MULT <= pipe_3;
end if;
end process;
end beh;
(*mult_style="pipe_lut"*)
module v_multipliers_3(clk, A, B, MULT);
input clk;
input [17:0] A;
input [17:0] B;
output [35:0] MULT;
reg [35:0] MULT;
reg [17:0] a_in, b_in;
reg [35:0] mult_res;
reg [35:0] pipe_2, pipe_3;
begin
a_in <= A; b_in <= B;
mult_res <= a_in * b_in;
pipe_2 <= mult_res;
pipe_3 <= pipe_2;
MULT <= pipe_3;
end
endmodule
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity multipliers_4 is
generic(A_port_size: integer := 18;
B_port_size: integer := 18);
port(clk : in std_logic;
A : in unsigned (A_port_size-1 downto 0);
B : in unsigned (B_port_size-1 downto 0);
MULT : out unsigned ( (A_port_size+B_port_size-1) downto 0));
end multipliers_4;
begin
process (clk)
begin
if (clk’event and clk=’1’) then
a_in <= A; b_in <= B;
pipe_regs <= mult_res & pipe_regs(2 downto 1);
MULT <= pipe_regs(0);
end if;
end process;
end beh;
(*mult_style="pipe_lut"*)
module v_multipliers_4(clk, A, B, MULT);
input clk;
input [17:0] A;
input [17:0] B;
output [35:0] MULT;
reg [35:0] MULT;
reg [17:0] a_in, b_in;
wire [35:0] mult_res;
reg [35:0] pipe_regs [2:0];
integer i;
endmodule
====================================================================
HDL Synthesis Report
Macro Statistics
# MACs : 1
8x8-to-16-bit MAC : 1
====================================================================
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity multipliers_5 is
generic (p_width: integer:=8);
port (clk : in std_logic;
A, B, C : in std_logic_vector(p_width-1 downto 0);
RES : out std_logic_vector(p_width*2-1 downto 0));
end multipliers_5;
process (clk)
begin
if (clk’event and clk=’1’) then
A_reg1 <= A; A_reg2 <= A_reg1;
B_reg1 <= B; B_reg2 <= B_reg1;
end if;
end process;
end beh;
Multiplier Adder With 2 Register Levels on Multiplier Inputs Verilog Coding
Example
//
// Multiplier Adder with 2 Register Levels on Multiplier Inputs
//
input clk;
input [7:0] A;
input [7:0] B;
input [7:0] C;
output [15:0] RES;
reg [7:0] A_reg1, A_reg2, B_reg1, B_reg2;
wire [15:0] multaddsub;
endmodule
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity multipliers_6 is
generic (p_width: integer:=8);
port (clk,add_sub: in std_logic;
A, B, C: in std_logic_vector(p_width-1 downto 0);
RES: out std_logic_vector(p_width*2-1 downto 0));
end multipliers_6;
process (clk)
begin
if (clk’event and clk=’1’) then
A_reg1 <= A; A_reg2 <= A_reg1;
B_reg1 <= B; B_reg2 <= B_reg1;
end if;
end process;
end beh;
input clk,add_sub;
input [7:0] A;
input [7:0] B;
input [7:0] C;
endmodule
====================================================================
HDL Synthesis Report
Macro Statistics
# MACs : 1
8x8-to-16-bit MAC : 1
====================================================================
entity multipliers_7a is
generic (p_width: integer:=8);
port (clk, reset: in std_logic;
A, B: in std_logic_vector(p_width-1 downto 0);
RES: out std_logic_vector(p_width*2-1 downto 0));
end multipliers_7a;
begin
process (clk)
begin
if (clk’event and clk=’1’) then
if (reset = ’1’) then
accum <= (others => ’0’);
mult <= (others => ’0’);
else
accum <= accum + mult;
mult <= A * B;
end if;
end if;
end process;
end beh;
Multiplier Up Accumulate With Register After Multiplication Verilog Coding
Example
//
// Multiplier Up Accumulate with Register After Multiplication
//
module v_multipliers_7a (clk, reset, A, B, RES);
input clk, reset;
input [7:0] A;
input [7:0] B;
output [15:0] RES;
reg [15:0] mult, accum;
endmodule
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity multipliers_7b is
generic (p_width: integer:=8);
port (clk, reset, add_sub: in std_logic;
A, B: in std_logic_vector(p_width-1 downto 0);
RES: out std_logic_vector(p_width*2-1 downto 0));
end multipliers_7b;
process (clk)
begin
if (clk’event and clk=’1’) then
if (reset = ’1’) then
accum <= (others => ’0’);
mult <= (others => ’0’);
else
mult <= A * B;
end if;
end if;
end process;
end beh;
Multiplier Up/Down Accumulate With Register After Multiplication Verilog
Coding Example
//
// Multiplier Up/Down Accumulate with Register
// After Multiplication
//
endmodule
About Dividers
Dividers are supported only when the divisor is a constant and is a power of 2. In that
case, the operator is implemented as a shifter. Otherwise, XST issues an error message.
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity divider_1 is
port(DI : in unsigned(7 downto 0);
DO : out unsigned(7 downto 0));
end divider_1;
DO <= DI / 2;
end archi;
assign DO = DI / 2;
endmodule
==============================
HDL Synthesis Report
Macro Statistics
# Multiplexers : 1
2-to-1 multiplexer : 1
# Adders/Subtractors : 1
8-bit addsub : 1
==============================
...
===================================================================
* Advanced HDL Synthesis *
===================================================================
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity resource_sharing_1 is
port(A,B,C : in std_logic_vector(7 downto 0);
OPER : in std_logic;
RES : out std_logic_vector(7 downto 0));
end resource_sharing_1;
end archi;
endmodule
Speed-Oriented Implementation
XST uses speed-oriented implementation to implement RAMs on BRAM resources. This
gives good results for speed, but may require more BRAM resources than area-oriented
implementation. XST does not support area-oriented BRAM implementation. Xilinx®
recommends the CORE Generator™ software for area-oriented implementation.
For more information, see:
XST FPGA Optimization
To achieve better design speed, XST implements small RAMs and ROMs using
distributed resources. RAMs and ROMs are considered small if their sizes follow the
rules shown in the following table.
Devices Size (bits) * Width (bits)
Virtex®-4 <= 512
Virtex-5 <= 512
=========================================================================
HDL Synthesis Report
Macro Statistics
# RAMs : 1
64x16-bit dual-port RAM : 1
# Registers: 2
16-bit register : 2
=========================================================================
=========================================================================
* Advanced HDL Synthesis*
=========================================================================
-----------------------------------------------------------------------
| ram_type | Block | |
-----------------------------------------------------------------------
| Port A |
| aspect ratio | 64-word x 16-bit | |
| mode | write-first | |
| clkA | connected to signal <clka> | rise |
| enA | connected to signal <ena> | high |
| weA | connected to internal <wea> | high |
| addrA | connected to signal <addra> | |
| diA | connected to internal <dia> | |
| doA | connected to signal <doa> | |
-----------------------------------------------------------------------
| optimization | speed | |
=========================================================================
-----------------------------------------------------------------------
| ram_type | Block | |
-----------------------------------------------------------------------
| Port B |
| aspect ratio | 64-word x 16-bit | |
| mode | write-first | |
| clkB | connected to signal <clkb> | rise |
| enB | connected to signal <enb> | high |
| weB | connected to internal <web> | high |
| addrB | connected to signal <addrb> | |
| diB | connected to internal <dib> | |
| doB | connected to signal <dob> | |
-----------------------------------------------------------------------
| optimization | speed | |
=========================================================================
-----------------------------------------------------------------------
Unit <rams_16> synthesized (advanced).
=========================================================================
Advanced HDL Synthesis Report
Macro Statistics
# RAMs : 1
64x16-bit dual-port block RAM : 1
=========================================================================
Virtex-5
CPLD none RAM inference completely disabled
process (clk)
begin
if clk’event and clk = ’1’ then
if en = ’1’ then
if we = ’1’ then
RAM(conv_integer(addr)) <= di;
end if;
do <= RAM(conv_integer(addr)) ;
end if;
end if;
end process;
end syn;
endmodule
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity rams_02a is
port (clk : in std_logic;
we : in std_logic;
en : in std_logic;
addr : in std_logic_vector(5 downto 0);
di : in std_logic_vector(15 downto 0);
do : out std_logic_vector(15 downto 0));
end rams_02a;
process (clk)
begin
if clk’event and clk = ’1’ then
if en = ’1’ then
if we = ’1’ then
RAM(conv_integer(addr)) <= di;
do <= di;
else
do <= RAM( conv_integer(addr));
end if;
end if;
end if;
end process;
end syn;
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity rams_02b is
port (clk : in std_logic;
we : in std_logic;
en : in std_logic;
addr : in std_logic_vector(5 downto 0);
di : in std_logic_vector(15 downto 0);
do : out std_logic_vector(15 downto 0));
end rams_02b;
process (clk)
begin
if clk’event and clk = ’1’ then
if en = ’1’ then
if we = ’1’ then
ram(conv_integer(addr)) <= di;
end if;
read_addr <= addr;
end if;
end if;
end process;
do <= ram(conv_integer(read_addr));
end syn;
input clk;
input we;
input en;
input [5:0] addr;
input [15:0] di;
output [15:0] do;
reg [15:0] RAM [63:0];
reg [15:0] do;
do <= di;
end
else
do <= RAM[addr];
end
end
endmodule
input clk;
input we;
input en;
input [5:0] addr;
input [15:0] di;
output [15:0] do;
reg [15:0] RAM [63:0];
reg [5:0] read_addr;
assign do = RAM[read_addr];
endmodule
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity rams_03 is
port (clk : in std_logic;
we : in std_logic;
en : in std_logic;
addr : in std_logic_vector(5 downto 0);
di : in std_logic_vector(15 downto 0);
do : out std_logic_vector(15 downto 0));
end rams_03;
process (clk)
begin
if clk’event and clk = ’1’ then
if en = ’1’ then
if we = ’1’ then
RAM(conv_integer(addr)) <= di;
else
do <= RAM( conv_integer(addr));
end if;
end if;
end if;
end process;
end syn;
input clk;
input we;
input en;
input [5:0] addr;
input [15:0] di;
output [15:0] do;
endmodule
The following descriptions are directly mappable onto distributed RAM only.
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity rams_04 is
port (clk : in std_logic;
we : in std_logic;
a : in std_logic_vector(5 downto 0);
di : in std_logic_vector(15 downto 0);
do : out std_logic_vector(15 downto 0));
end rams_04;
process (clk)
begin
if (clk’event and clk = ’1’) then
if (we = ’1’) then
RAM(conv_integer(a)) <= di;
end if;
end if;
end process;
do <= RAM(conv_integer(a));
end syn;
input clk;
input we;
input [5:0] a;
input [15:0] di;
output [15:0] do;
reg [15:0] ram [63:0];
assign do = ram[a];
endmodule
The following description implements a true synchronous read. A true synchronous
read is the synchronization mechanism in Virtex device block RAMs, where the read
address is registered on the RAM clock edge. Such descriptions are directly mappable
onto block RAM, as shown in the diagram below. The same descriptions can also be
mapped onto Distributed RAM.
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity rams_07 is
port (clk : in std_logic;
we : in std_logic;
a : in std_logic_vector(5 downto 0);
di : in std_logic_vector(15 downto 0);
do : out std_logic_vector(15 downto 0));
end rams_07;
process (clk)
begin
if (clk’event and clk = ’1’) then
if (we = ’1’) then
RAM(conv_integer(a)) <= di;
end if;
read_a <= a;
end if;
end process;
do <= RAM(conv_integer(read_a));
end syn;
input clk;
input we;
input [5:0] a;
input [15:0] di;
output [15:0] do;
assign do = ram[read_a];
endmodule
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity rams_08 is
port (clk : in std_logic;
en : in std_logic;
we : in std_logic;
a : in std_logic_vector(5 downto 0);
di : in std_logic_vector(15 downto 0);
do : out std_logic_vector(15 downto 0));
end rams_08;
process (clk)
begin
if (clk’event and clk = ’1’) then
if (en = ’1’) then
if (we = ’1’) then
RAM(conv_integer(a)) <= di;
end if;
read_a <= a;
end if;
end if;
end process;
do <= RAM(conv_integer(read_a));
end syn;
input clk;
input en;
input we;
input [5:0] a;
input [15:0] di;
output [15:0] do;
reg [15:0] ram [63:0];
reg [5:0] read_a;
assign do = ram[read_a];
endmodule
The following diagram shows where the two output ports are used. It is directly
mappable onto Distributed RAM only.
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity rams_09 is
port (clk : in std_logic;
we : in std_logic;
a : in std_logic_vector(5 downto 0);
dpra : in std_logic_vector(5 downto 0);
di : in std_logic_vector(15 downto 0);
spo : out std_logic_vector(15 downto 0);
dpo : out std_logic_vector(15 downto 0));
end rams_09;
process (clk)
begin
if (clk’event and clk = ’1’) then
if (we = ’1’) then
RAM(conv_integer(a)) <= di;
end if;
end if;
end process;
end syn;
input clk;
input we;
input [5:0] a;
input [5:0] dpra;
input [15:0] di;
output [15:0] spo;
output [15:0] dpo;
reg [15:0] ram [63:0];
endmodule
The following descriptions are directly mappable onto block RAM, as shown in the
diagram below. They may also be implemented with Distributed RAM.
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity rams_11 is
port (clk : in std_logic;
we : in std_logic;
a : in std_logic_vector(5 downto 0);
dpra : in std_logic_vector(5 downto 0);
di : in std_logic_vector(15 downto 0);
spo : out std_logic_vector(15 downto 0);
dpo : out std_logic_vector(15 downto 0));
end rams_11;
process (clk)
begin
if (clk’event and clk = ’1’) then
if (we = ’1’) then
RAM(conv_integer(a)) <= di;
end if;
read_a <= a;
read_dpra <= dpra;
end if;
end process;
end syn;
input clk;
input we;
input [5:0] a;
input [5:0] dpra;
endmodule
Dual-Port RAM With Synchronous Read (Read Through) and Two Clocks
VHDL Coding Example
--
-- Dual-Port RAM with Synchronous Read (Read Through)
-- using More than One Clock
--
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity rams_12 is
port (clk1 : in std_logic;
clk2 : in std_logic;
we : in std_logic;
add1 : in std_logic_vector(5 downto 0);
add2 : in std_logic_vector(5 downto 0);
di : in std_logic_vector(15 downto 0);
do1 : out std_logic_vector(15 downto 0);
do2 : out std_logic_vector(15 downto 0));
end rams_12;
process (clk1)
begin
if (clk1’event and clk1 = ’1’) then
if (we = ’1’) then
RAM(conv_integer(add1)) <= di;
end if;
read_add1 <= add1;
end if;
end process;
process (clk2)
begin
if (clk2’event and clk2 = ’1’) then
read_add2 <= add2;
end if;
end process;
end syn;
Dual-Port RAM With Synchronous Read (Read Through) and Two Clocks
Verilog Coding Example
//
// Dual-Port RAM with Synchronous Read (Read Through)
// using More than One Clock
//
module v_rams_12 (clk1, clk2, we, add1, add2, di, do1, do2);
input clk1;
input clk2;
input we;
input [5:0] add1;
input [5:0] add2;
endmodule
Dual-Port RAM With One Enable Controlling Both Ports VHDL Coding
Example
--
-- Dual-Port RAM with One Enable Controlling Both Ports
--
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity rams_13 is
port (clk : in std_logic;
en : in std_logic;
we : in std_logic;
addra : in std_logic_vector(5 downto 0);
addrb : in std_logic_vector(5 downto 0);
di : in std_logic_vector(15 downto 0);
doa : out std_logic_vector(15 downto 0);
dob : out std_logic_vector(15 downto 0));
end rams_13;
process (clk)
begin
if (clk’event and clk = ’1’) then
if (en = ’1’) then
if (we = ’1’) then
RAM(conv_integer(addra)) <= di;
end if;
end if;
end if;
end process;
end syn;
Dual-Port RAM With One Enable Controlling Both Ports Verilog Coding
Example
//
// Dual-Port RAM with One Enable Controlling Both Ports
//
module v_rams_13 (clk, en, we, addra, addrb, di, doa, dob);
input clk;
input en;
input we;
input [5:0] addra;
input [5:0] addrb;
input [15:0] di;
output [15:0] doa;
output [15:0] dob;
reg [15:0] ram [63:0];
reg [5:0] read_addra;
endmodule
The following descriptions are directly mappable onto block RAM, as shown in the
diagram.
Dual Port RAM With Enable on Each Port VHDL Coding Example
--
-- Dual-Port RAM with Enable on Each Port
--
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity rams_14 is
port (clk : in std_logic;
ena : in std_logic;
enb : in std_logic;
wea : in std_logic;
addra : in std_logic_vector(5 downto 0);
addrb : in std_logic_vector(5 downto 0);
dia : in std_logic_vector(15 downto 0);
doa : out std_logic_vector(15 downto 0);
dob : out std_logic_vector(15 downto 0));
end rams_14;
process (clk)
begin
if (clk’event and clk = ’1’) then
end if;
end process;
end syn;
Dual Port RAM With Enable on Each Port Verilog Coding Example
//
// Dual-Port RAM with Enable on Each Port
//
input clk;
input ena;
input enb;
input wea;
input [5:0] addra;
input [5:0] addrb;
input [15:0] dia;
output [15:0] doa;
output [15:0] dob;
if (enb)
read_addrb <= addrb;
end
endmodule
XST supports dual-port block RAMs with two write ports for VHDL and Verilog.
The concept of dual-write ports implies not only distinct data ports, but the possibility
of distinct write clocks and write enables as well. Distinct write clocks also mean distinct
read clocks, since the dual-port block RAM offers two clocks, one shared by the primary
read and write port, the other shared by the secondary read and write port.
In VHDL, the description of this type of block RAM is based on the usage of shared
variables. The XST VHDL analyzer accepts shared variables, but errors out in the HDL
Synthesis step if a shared variable does not describe a valid RAM macro.
Dual-Port Block RAM With Two Write Ports VHDL Coding Example
This is the most general example. It has different clocks, enables, and write enables.
--
-- Dual-Port Block RAM with Two Write Ports
--
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_unsigned.all;
entity rams_16 is
port(clka : in std_logic;
clkb : in std_logic;
ena : in std_logic;
enb : in std_logic;
wea : in std_logic;
web : in std_logic;
addra : in std_logic_vector(5 downto 0);
addrb : in std_logic_vector(5 downto 0);
dia : in std_logic_vector(15 downto 0);
dib : in std_logic_vector(15 downto 0);
doa : out std_logic_vector(15 downto 0);
dob : out std_logic_vector(15 downto 0));
end rams_16;
process (CLKA)
begin
if CLKA’event and CLKA = ’1’ then
if ENA = ’1’ then
if WEA = ’1’ then
RAM(conv_integer(ADDRA)) := DIA;
end if;
DOA <= RAM(conv_integer(ADDRA));
end if;
end if;
end process;
process (CLKB)
begin
if CLKB’event and CLKB = ’1’ then
if ENB = ’1’ then
if WEB = ’1’ then
RAM(conv_integer(ADDRB)) := DIB;
end if;
DOB <= RAM(conv_integer(ADDRB));
end if;
end if;
end process;
end syn;
Dual-Port Block RAM With Two Write Ports Verilog Coding Example
This is the most general example. It has different clocks, enables, and write enables.
//
// Dual-Port Block RAM with Two Write Ports
//
input clka,clkb,ena,enb,wea,web;
input [5:0] addra,addrb;
input [15:0] dia,dib;
output [15:0] doa,dob;
reg [15:0] ram [63:0];
reg [15:0] doa,dob;
endmodule
Although they may look the same except for the signal/variable difference, it is also
important to understand the functional difference between this template and the
following well known template which describes a read-first synchronization in a
single-write RAM.
signal RAM : RAMtype;
process (CLKA)
begin
if CLKA’event and CLKA = ’1’ then
if WEA = ’1’ then
RAM(conv_integer(ADDRA)) <= DIA;
end if;
DOA <= RAM(conv_integer(ADDRA));
end if;
end process;
Read-First Synchronization Coding Example
A read-first synchronization is described as follows, where the read statement must
come BEFORE the write statement.
process (CLKA)
begin
if CLKA’event and CLKA = ’1’ then
DOA <= RAM(conv_integer(ADDRA)); -- The read statement must come
-- BEFORE the write statement
if WEA = ’1’ then
RAM(conv_integer(ADDRA)) := DIA;
end if;
end if;
end process;
(...)
process(clk)
begin
if posedge(clk) then
if we(1) = ’1’ then
RAM(conv_integer(addr))(2*WIDTH-1 downto WIDTH) <= di(2*WIDTH-1 downto WIDTH);
end if;
if we(0) = ’1’ then
RAM(conv_integer(addr))(WIDTH-1 downto 0) <= di(WIDTH-1 downto 0);
end if;
do <= RAM(conv_integer(addr));
end if;
end process;
do <= RAM[addr];
end
Single Write Statement VHDL Coding Example
type ram_type is array (SIZE-1 downto 0)
of std_logic_vector (2*WIDTH-1 downto 0);
signal RAM : ram_type;
signal di0, di1 : std_logic_vector (WIDTH-1 downto 0);
(...)
end process;
process(clk)
begin
if posedge(clk) then
if en = ’1’ then
RAM(conv_integer(addr)) <= di1 & di0; -- single write access statement
do <= RAM(conv_integer(addr));
end if;
end if;
end process;
if (we[0])
di0 = di[DI_WIDTH-1:0];
else
di0 = RAM[addr][DI_WIDTH-1:0];
end
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity rams_24 is
generic (SIZE : integer := 512;
ADDR_WIDTH : integer := 9;
DI_WIDTH : integer := 8);
process(we, di)
begin
if we(1) = ’1’ then
di1 <= di(2*DI_WIDTH-1 downto 1*DI_WIDTH);
else
di1 <= RAM(conv_integer(addr))(2*DI_WIDTH-1 downto 1*DI_WIDTH);
end if;
process(clk)
begin
if (clk’event and clk = ’1’) then
RAM(conv_integer(addr)) <= di1 & di0;
do <= RAM(conv_integer(addr));
end if;
end process;
end syn;
input clk;
input [1:0] we;
input [ADDR_WIDTH-1:0] addr;
input [2*DI_WIDTH-1:0] di;
output [2*DI_WIDTH-1:0] do;
reg [2*DI_WIDTH-1:0] RAM [SIZE-1:0];
reg [2*DI_WIDTH-1:0] do;
if (we[0])
di0 = di[DI_WIDTH-1:0];
else
di0 = RAM[addr][DI_WIDTH-1:0];
end
endmodule
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity rams_25 is
generic (SIZE : integer := 512;
ADDR_WIDTH : integer := 9;
DI_WIDTH : integer := 8);
process(we, di)
begin
if we(1) = ’1’ then
di1 <= di(2*DI_WIDTH-1 downto 1*DI_WIDTH);
do1 <= di(2*DI_WIDTH-1 downto 1*DI_WIDTH);
else
di1 <= RAM(conv_integer(addr))(2*DI_WIDTH-1 downto 1*DI_WIDTH);
do1 <= RAM(conv_integer(addr))(2*DI_WIDTH-1 downto 1*DI_WIDTH);
end if;
process(clk)
begin
if (clk’event and clk = ’1’) then
RAM(conv_integer(addr)) <= di1 & di0;
do <= do1 & do0;
end if;
end process;
end syn;
input clk;
input [1:0] we;
input [ADDR_WIDTH-1:0] addr;
input [2*DI_WIDTH-1:0] di;
output [2*DI_WIDTH-1:0] do;
reg [2*DI_WIDTH-1:0] RAM [SIZE-1:0];
reg [2*DI_WIDTH-1:0] do;
if (we[0])
begin
di0 <= di[DI_WIDTH-1:0];
do0 <= di[DI_WIDTH-1:0];
end
else
begin
di0 <= RAM[addr][DI_WIDTH-1:0];
do0 <= RAM[addr][DI_WIDTH-1:0];
end
end
endmodule
XST infers latches for do1 and do0 signals during the basic HDL Synthesis. These
latches are absorbed by BRAM during the Advanced HDL Synthesis step.
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity rams_26 is
generic (SIZE : integer := 512;
ADDR_WIDTH : integer := 9;
DI_WIDTH : integer := 8);
process(we, di)
begin
if we(1) = ’1’ then
di1 <= di(2*DI_WIDTH-1 downto 1*DI_WIDTH);
else
di1 <= RAM(conv_integer(addr))(2*DI_WIDTH-1 downto 1*DI_WIDTH);
do1 <= RAM(conv_integer(addr))(2*DI_WIDTH-1 downto 1*DI_WIDTH);
end if;
process(clk)
begin
if (clk’event and clk = ’1’) then
RAM(conv_integer(addr)) <= di1 & di0;
do <= do1 & do0;
end if;
end process;
end syn;
input clk;
input [1:0] we;
input [ADDR_WIDTH-1:0] addr;
input [2*DI_WIDTH-1:0] di;
output [2*DI_WIDTH-1:0] do;
reg [2*DI_WIDTH-1:0] RAM [SIZE-1:0];
reg [2*DI_WIDTH-1:0] do;
if (we[0])
di0 <= di[DI_WIDTH-1:0];
else
begin
di0 <= RAM[addr][DI_WIDTH-1:0];
do0 <= RAM[addr][DI_WIDTH-1:0];
end
end
endmodule
XST can identify RAM descriptions with two or more read ports that access the RAM
contents at addresses different from the write address. However, there can only be one
write port. XST implements the following descriptions by replicating the RAM contents
for each output port, as shown in the following figure.
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity rams_17 is
port (clk : in std_logic;
we : in std_logic;
wa : in std_logic_vector(5 downto 0);
ra1 : in std_logic_vector(5 downto 0);
ra2 : in std_logic_vector(5 downto 0);
di : in std_logic_vector(15 downto 0);
do1 : out std_logic_vector(15 downto 0);
do2 : out std_logic_vector(15 downto 0));
end rams_17;
process (clk)
begin
if (clk’event and clk = ’1’) then
if (we = ’1’) then
RAM(conv_integer(wa)) <= di;
end if;
end if;
end process;
end syn;
module v_rams_17 (clk, we, wa, ra1, ra2, di, do1, do2);
input clk;
input we;
input [5:0] wa;
input [5:0] ra1;
input [5:0] ra2;
input [15:0] di;
output [15:0] do1;
output [15:0] do2;
reg [15:0] ram [63:0];
endmodule
Block RAM with Reset on the Data Outputs
XST supports block RAM with reset on the data outputs, as offered with Virtex-4
devices, Virtex-5 devices, and related block RAM resources. Optionally, you can include
a synchronously controlled initialization of the RAM data outputs.
Block RAM with the following synchronization modes can have re-settable data ports.
• Read-First Block RAM with Reset
• Write-First Block RAM with Reset
• No-Change Block RAM with Reset
• Registered ROM with Reset
• Supported Dual-Port Templates
Because XST does not support block RAMs with dual-write in a dual-read block RAM
description, both data outputs may be reset, but the various read-write synchronizations
are allowed for the primary data output only. The dual output may be used in Read-First
Mode only.
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity rams_18 is
port (clk : in std_logic;
en : in std_logic;
we : in std_logic;
rst : in std_logic;
addr : in std_logic_vector(5 downto 0);
di : in std_logic_vector(15 downto 0);
do : out std_logic_vector(15 downto 0));
end rams_18;
process (clk)
begin
if clk’event and clk = ’1’ then
if en = ’1’ then -- optional enable
end if;
end if;
end process;
end syn;
input clk;
input en;
input we;
input rst;
input [5:0] addr;
input [15:0] di;
output [15:0] do;
reg [15:0] ram [63:0];
reg [15:0] do;
endmodule
library IEEE;
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity rams_19 is
port (clk1, clk2 : in std_logic;
we, en1, en2 : in std_logic;
addr1 : in std_logic_vector(5 downto 0);
addr2 : in std_logic_vector(5 downto 0);
di : in std_logic_vector(15 downto 0);
res1 : out std_logic_vector(15 downto 0);
res2 : out std_logic_vector(15 downto 0));
end rams_19;
process (clk1)
begin
if rising_edge(clk1) then
if we = ’1’ then
ram(conv_integer(addr1)) <= di;
end if;
do1 <= ram(conv_integer(addr1));
end if;
end process;
process (clk2)
begin
if rising_edge(clk2) then
do2 <= ram(conv_integer(addr2));
end if;
end process;
process (clk1)
begin
if rising_edge(clk1) then
if en1 = ’1’ then
res1 <= do1;
end if;
end if;
end process;
process (clk2)
begin
if rising_edge(clk2) then
if en2 = ’1’ then
res2 <= do2;
end if;
end if;
end process;
end beh;
module v_rams_19 (clk1, clk2, we, en1, en2, addr1, addr2, di, res1, res2);
input clk1;
input clk2;
input we, en1, en2;
input [5:0] addr1;
input [5:0] addr2;
input [15:0] di;
output [15:0] res1;
output [15:0] res2;
reg [15:0] res1;
reg [15:0] res2;
reg [15:0] RAM [63:0];
reg [15:0] do1;
reg [15:0] do2;
endmodule
entity rams_20a is
port (clk : in std_logic;
we : in std_logic;
addr : in std_logic_vector(5 downto 0);
di : in std_logic_vector(19 downto 0);
do : out std_logic_vector(19 downto 0));
end rams_20a;
begin
process (clk)
begin
if rising_edge(clk) then
if we = ’1’ then
RAM(conv_integer(addr)) <= di;
end if;
do <= RAM(conv_integer(addr));
end if;
end process;
end syn;
initial begin
ram[63] = 20’h0200A; ram[62] = 20’h00300; ram[61] = 20’h08101;
ram[60] = 20’h04000; ram[59] = 20’h08601; ram[58] = 20’h0233A;
ram[57] = 20’h00300; ram[56] = 20’h08602; ram[55] = 20’h02310;
ram[54] = 20’h0203B; ram[53] = 20’h08300; ram[52] = 20’h04002;
ram[51] = 20’h08201; ram[50] = 20’h00500; ram[49] = 20’h04001;
ram[48] = 20’h02500; ram[47] = 20’h00340; ram[46] = 20’h00241;
ram[45] = 20’h04002; ram[44] = 20’h08300; ram[43] = 20’h08201;
ram[42] = 20’h00500; ram[41] = 20’h08101; ram[40] = 20’h00602;
ram[39] = 20’h04003; ram[38] = 20’h0241E; ram[37] = 20’h00301;
ram[36] = 20’h00102; ram[35] = 20’h02122; ram[34] = 20’h02021;
ram[33] = 20’h00301; ram[32] = 20’h00102; ram[31] = 20’h02222;
endmodule
entity rams_20b is
port (clk1 : in std_logic;
clk2 : in std_logic;
we : in std_logic;
addr1 : in std_logic_vector(7 downto 0);
addr2 : in std_logic_vector(7 downto 0);
di : in std_logic_vector(15 downto 0);
do1 : out std_logic_vector(15 downto 0);
do2 : out std_logic_vector(15 downto 0));
end rams_20b;
begin
process (clk1)
begin
if rising_edge(clk1) then
if we = ’1’ then
RAM(conv_integer(addr1)) <= di;
end if;
do1 <= RAM(conv_integer(addr1));
end if;
end process;
process (clk2)
begin
if rising_edge(clk2) then
do2 <= RAM(conv_integer(addr2));
end if;
end process;
end syn;
module v_rams_20b (clk1, clk2, we, addr1, addr2, di, do1, do2);
input clk1, clk2;
input we;
input [7:0] addr1, addr2;
input [15:0] di;
output [15:0] do1, do2;
initial begin
for (index = 0 ; index <= 99 ; index = index + 1) begin
ram[index] = 16’h8282;
end
endmodule
01001010001000001100000010000100
00000000001111100000000001000001
11111101010000011100010000100100
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use std.textio.all;
entity rams_20c is
port(clk : in std_logic;
we : in std_logic;
addr : in std_logic_vector(5 downto 0);
din : in std_logic_vector(31 downto 0);
dout : out std_logic_vector(31 downto 0));
end rams_20c;
begin
process (clk)
begin
if clk’event and clk = ’1’ then
if we = ’1’ then
RAM(conv_integer(addr)) <= to_bitvector(din);
end if;
dout <= to_stdlogicvector(RAM(conv_integer(addr)));
end if;
end process;
end syn;
If there are not enough lines in the external data file, XST issues the following message.
ERROR:Xst - raminitfile1.vhd line 40: Line <RamFileLine has not
enough elements for target <RAM<63>>.
initial
begin
$readmemb("rams_20c.data",ram, 0, 63);
end
endmodule
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use std.textio.all;
entity rams_20c is
port(clk : in std_logic;
we : in std_logic;
addr : in std_logic_vector(5 downto 0);
din : in std_logic_vector(31 downto 0);
dout : out std_logic_vector(31 downto 0));
end rams_20c;
begin
process (clk)
begin
if clk’event and clk = ’1’ then
if we = ’1’ then
RAM(conv_integer(addr)) <= to_bitvector(din);
end if;
dout <= to_stdlogicvector(RAM(conv_integer(addr)));
end if;
end process;
end syn;
If there are not enough lines in the external data file, XST issues the following message.
ERROR:Xst - raminitfile1.vhd line 40: Line <RamFileLine has not
enough elements for target <RAM<63>>.
initial
begin
$readmemb("rams_20c.data",ram, 0, 63);
end
endmodule
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity rams_21a is
port (clk : in std_logic;
en : in std_logic;
addr : in std_logic_vector(5 downto 0);
data : out std_logic_vector(19 downto 0));
end rams_21a;
begin
process (clk)
begin
if (clk’event and clk = ’1’) then
if (en = ’1’) then
data <= ROM(conv_integer(addr));
end if;
end if;
end process;
end syn;
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity rams_21b is
port (clk : in std_logic;
en : in std_logic;
addr : in std_logic_vector(5 downto 0);
data : out std_logic_vector(19 downto 0));
end rams_21b;
process (clk)
begin
if (clk’event and clk = ’1’) then
if (en = ’1’) then
data <= rdata;
end if;
end if;
end process;
end syn;
input clk;
input en;
input [5:0] addr;
output reg [19:0] data;
endmodule
input clk;
input en;
input [5:0] addr;
output reg [19:0] data;
reg [19:0] rdata;
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity rams_21c is
port (clk : in std_logic;
en : in std_logic;
addr : in std_logic_vector(5 downto 0);
data : out std_logic_vector(19 downto 0));
end rams_21c;
process (clk)
begin
if (clk’event and clk = ’1’) then
if (en = ’1’) then
raddr <= addr;
end if;
end if;
end process;
end syn;
input clk;
input en;
input [5:0] addr;
output reg [19:0] data;
reg [5:0] raddr;
endmodule
=========================================================================
HDL Synthesis Report
Macro Statistics
# RAMs : 1
64x4-bit single-port RAM : 1
# Registers : 1
4-bit register : 1
=========================================================================
====================================================================
* Advanced HDL Synthesis *
====================================================================
INFO:Xst - Unit <rams_22> : The RAM <Mram_RAM> will be implemented as a
distributed RAM, absorbing the following register(s): <do>.
-------------------------------------------------------------
| aspect ratio | 64-word x 4-bit | |
| clock | connected to signal <clk> | rise |
| write enable | connected to signal <we> | high |
| address | connected to signal <addr> | |
| data in | connected to signal <di> | |
| data out | connected to internal node | |
| ram_style | distributed | |
-------------------------------------------------------------
=========================================================================
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity rams_22 is
port (clk : in std_logic;
we : in std_logic;
addr : in std_logic_vector(8 downto 0);
di : in std_logic_vector(3 downto 0);
do : out std_logic_vector(3 downto 0));
end rams_22;
process (clk)
begin
if clk’event and clk = ’1’ then
if we = ’1’ then
RAM(conv_integer(addr)) <= di;
else
pipe_reg <= RAM( conv_integer(addr));
end if;
do <= pipe_reg;
end if;
end process;
end syn;
input clk;
input we;
input [8:0] addr;
input [3:0] di;
output [3:0] do;
(*ram_style="pipe_distributed"*)
reg [3:0] RAM [511:0];
reg [3:0] do;
reg [3:0] pipe_reg;
endmodule
You may have several processes (1, 2 or 3) in your description, depending upon how you
consider and decompose the different parts of the preceding model. Following is an
example of the Moore Machine with Asynchronous Reset, RESET.
• 4 states
– s1
– s2
– s3
– s4
• 5 transitions
• 1 input
x1com
• 1 output
outp
The above model is represented by the following bubble diagram.
Bubble Diagram
State Registers
For XST to successfully identify a Finite State Machine (FSM), descriptions of the state
register should include either:
• A power-up state
The power-up state must use proper VHDL or Verilog signal initialization.
• An operational reset
The operational reset can be asynchronous or synchronous.
For coding examples on how to write Asynchronous and Synchronous initialization
signals, see:
Registers HDL Coding Techniques
In VHDL, the type of a state register can be a different type, such as:
• integer
• bit_vector
• std_logic_vector
But it is common and convenient to define an enumerated type containing all possible
state values and to declare your state register with that type.
In Verilog, the type of state register can be an integer or a set of defined parameters. In
the following Verilog examples the state assignments could have been made as follows:
parameter [3:0]
s1 = 4’b0001,
s2 = 4’b0010,
s3 = 4’b0100,
s4 = 4’b1000;
reg [3:0] state;
These parameters can be modified to represent different state encoding schemes.
Unreachable States
XST can detect unreachable states in an FSM. It lists them in the log file in the HDL
Synthesis step.
========================================================
HDL Synthesis Report
Macro Statistics
# Registers : 1
1-bit register : 1
========================================================
========================================================
* Advanced HDL Synthesis *
========================================================
-------------------
=======================================================
HDL Synthesis Report
Macro Statistics
# FSMs : 1
=======================================================
--
-- State Machine with a single process.
--
library IEEE;
use IEEE.std_logic_1164.all;
entity fsm_1 is
port ( clk, reset, x1 : IN std_logic;
outp : OUT std_logic);
end entity;
process (clk,reset)
begin
if (reset =’1’) then
state <=s1;
outp<=’1’;
elsif (clk=’1’ and clk’event) then
case state is
when s1 => if x1=’1’ then
state <= s2;
outp <= ’1’;
else
state <= s3;
outp <= ’0’;
end if;
when s2 => state <= s4; outp <= ’0’;
when s3 => state <= s4; outp <= ’0’;
when s4 => state <= s1; outp <= ’1’;
end case;
end if;
end process;
end beh1;
FSM With Single Always Block Verilog Coding Example
//
// State Machine with a single always block.
//
initial begin
state = 2’b00;
end
end
s3: begin
state <= s4; outp <= 1’b0;
end
s4: begin
state <= s1; outp <= 1’b0;
end
endcase
end
end
endmodule
FSM With Two Processes
To eliminate a register from the outputs, remove all assignments outp <=… from
the Clock synchronization section. This can be done by introducing two processes as
shown below.
library IEEE;
use IEEE.std_logic_1164.all;
entity fsm_2 is
port ( clk, reset, x1 : IN std_logic;
outp : OUT std_logic);
end entity;
end beh1;
FSM With Two Always Blocks Verilog Coding Example
//
// State Machine with two always blocks.
//
initial begin
state = 2’b00;
end
always @(state)
begin
case (state)
s1: outp = 1’b1;
s2: outp = 1’b1;
s3: outp = 1’b0;
s4: outp = 1’b0;
endcase
end
endmodule
You can also separate the NEXT State function from the state register.
library IEEE;
use IEEE.std_logic_1164.all;
entity fsm_3 is
port ( clk, reset, x1 : IN std_logic;
outp : OUT std_logic);
end entity;
begin
end beh1;
initial begin
state = 2’b00;
end
always @(state)
begin
case (state)
s1: outp = 1’b1;
s2: outp = 1’b1;
s3: outp = 1’b0;
s4: outp = 1’b0;
endcase
end
endmodule
library ieee;
use ieee.std_logic_1164.all;
entity black_box_1 is
port(DI_1, DI_2 : in std_logic;
DOUT : out std_logic);
end black_box_1;
component my_block
port (I1 : in std_logic;
I2 : in std_logic;
O : out std_logic);
end component;
begin
end archi;
Black Box Verilog Coding Example
//
// Black Box
//
v_my_block inst (
.in1(DI_1),
.in2(DI_2),
.dout(DOUT));
endmodule
For more information on component instantiation, see your VHDL and Verilog language
reference manuals.
Macro Generation
The FPGA Device Macro Generator module provides the XST HDL Flow with a catalog
of functions. These functions are identified by the inference engine from the Hardware
Description Language (HDL) description. Their characteristics are handed to the Macro
Generator for optimal implementation.
The set of inferred functions ranges in complexity from simple arithmetic operators
(such as adders, accumulators, counters and multiplexers), to more complex building
blocks (such as multipliers, shift registers and memories).
Inferred functions are optimized to deliver the highest levels of performance and
efficiency for the selected Virtex® architecture or Spartan® architecture, and then
integrated into the rest of the design. In addition, the generated functions are optimized
through their borders depending on the design context.
This section categorizes, by function, all available macros and briefly describes
technology resources used in the building and optimization phase.
Macro Generation can be controlled through attributes. These attributes are listed in
each subsection.
XST uses dedicated carry chain logic to implement many macros. In some situations
carry chain logic may result in less than ideal optimization. Use Carry Chain
(USE_CARRY_CHAIN) deactivates this feature.
For more information, see:
XST Design Constraints
To better control the implementation of the inferred multiplexer, XST offers a way
to select the generation of either the MUXF5/MUXF6 or Dedicated Carry-MUXs
architectures. The attribute MUX_STYLE (Mux Style) specifies that an inferred
multiplexer be implemented on a MUXFx based architecture if the value is MUXF, or a
Dedicated Carry-MUXs based architecture if the value is MUXCY.
You can apply this attribute to either a signal that defines the multiplexer or the instance
name of the multiplexer. This attribute can also be global.
The attribute MUX_EXTRACT (Mux Extraction) with, respectively, the value no or force
can be used to disable or force the inference of the multiplexer.
You still may have MUXFx elements in the final netlist even if multiplexer inference is
disabled using the MUX_EXTRACT (Mux Extraction) constraint. These elements come
from the general mapping procedure of Boolean equations.
Interconnected Macros
If your design contains several interconnected macros, where each macro can be
implemented on DSP48, XST attempts to interconnect DSP48 blocks using fast
BCIN/BCOUT and PCIN/PCOUT connections. Such situations are typical in filter and
complex multiplier descriptions.
XST can build complex DSP macros and DSP48 chains across the hierarchy when Keep
Hierarchy (KEEP_HIERARCHY) is set to no. This is the default in ISE® Design Suite.
=============================================================
* Advanced HDL Synthesis *
=============================================================
...
Entity <logic_bram_1> mapped on BRAM.
...
=============================================================
HDL Synthesis Report
Macro Statistics
# Block RAMs : 1
256x4-bit single-port block RAM : 1
=============================================================
...
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity logic_bram_1 is
port (clk, rst : in std_logic;
A,B : in unsigned (3 downto 0);
RES : out unsigned (3 downto 0));
end logic_bram_1;
process (clk)
begin
if (clk’event and clk=’1’) then
if (rst = ’1’) then
RES <= "0000";
else
RES <= A + B + "0001";
end if;
end if;
end process;
end beh;
8-Bit Adders With Constant in a Single Block Ram Primitive Verilog Coding
Example
//
// The following example places 8-bit adders with
// constant in a single block RAM primitive
//
(* bram_map="yes" *)
module v_logic_bram_1 (clk, rst, A, B, RES);
endmodule
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity logic_bram_2 is
port (clk, rst : in std_logic;
A,B : in unsigned (3 downto 0);
RES : out unsigned (3 downto 0));
end logic_bram_2;
end beh;
Asynchronous Reset Verilog Coding Example
//
// In the following example, an asynchronous reset is used and
// so, the logic is not mapped onto block RAM
//
(* bram_map="yes" *)
module v_logic_bram_2 (clk, rst, A, B, RES);
endmodule
Flip-Flop Retiming
This section discusses Flip-Flop Retiming, and includes:
• About Flip-Flop Retiming
• Global Optimization
• Flip-Flop Retiming Messages
• Limitations of Flip-Flop Retiming
• Controlling Flip-Flop Retiming
Global Optimization
Flip-flop retiming is part of global optimization. It respects the same constraints as
all other optimization techniques. Since retiming is incremental, a flip-flop that is the
result of a retiming can be moved again in the same direction (forward or backward)
if it results in better timing. The only limit for the retiming occurs when the timing
constraints are satisfied, or if no more improvements in timing can be obtained.
Partitions
XST now supports Partitions in place of Incremental Synthesis. Incremental Synthesis is
no longer supported. The incremental_synthesis and resynthesize constraints are no
longer supported. For more information on Partitions, see the ISE® Design Suite Help.
================================================================
Timing Report
This section discusses Timing Report, and includes:
• About Timing Report
• Timing Report Timing Summary Section
• Timing Report Timing Detail Section
• Timing Report Paths and Ports
Clock Information:
------------------
-----------------------------------+------------------------+-------+
Clock Signal | Clock buffer(FF name) | Load |
-----------------------------------+------------------------+-------+
CLK | BUFGP | 11 |
-----------------------------------+------------------------+-------+
Timing Summary:
---------------
Speed Grade: -12
Timing Detail:
--------------
All values displayed in nanoseconds (ns)
=========================================================================
Timing constraint: Default period analysis for Clock ’CLK’
Clock period: 2.644ns (frequency: 378.165MHz)
Total number of paths / destination ports: 77 / 11
-------------------------------------------------------------------------
Delay: 2.644ns (Levels of Logic = 3)
Source: MACHINE/current_state_FFd3 (FF)
Destination: sixty/msbcount/qoutsig_3 (FF)
Source Clock: CLK rising
Destination Clock: CLK rising
Implementation Constraints
XST writes all implementation constraints generated from Hardware Description
Language (HDL) or constraint file attributes (such as LOC) into the output NGC file.
Keep (KEEP) properties are generated during buffer insertion for maximum fanout
control or for optimization.
If BoxType (BOX_TYPE) is not attached to the MUXF5, XST processes this block as a
user hierarchical block. If the name of the user black box is the same as that of a Xilinx
device primitive, XST renames it to a unique name and issues a warning.
Device Libraries
In VHDL, declare library UNISIM with its package vcomponents in your source code:
library unisim;
use unisim.vcomponents.all;
The source code of this package can be found in the following file of the XST installation:
vhdl\src\ unisims\unisims_vcomp.vhd
In Verilog, the UNISIM library is precompiled. XST automatically links it with your
design.
XST issues a warning as shown in the log file example below if:
• You instantiate a block (non primitive) in your design
AND
• The block has no contents (no logic description)
OR
• The block has a logic description
AND
• You attach a BoxType (BOX_TYPE) constraint to it with a value of user_black_box.
Passing an INIT Value Via the INIT Constraint VHDL Coding Example
--
-- Passing an INIT value via the INIT constraint.
--
library ieee;
use ieee.std_logic_1164.all;
library unisim;
use unisim.vcomponents.all;
entity primitive_1 is
port(I0,I1 : in std_logic;
O : out std_logic);
end primitive_1;
begin
end beh;
Passing an INIT Value Via the INIT Constraint Verilog Coding Example
//
// Passing an INIT value via the INIT constraint.
//
(* INIT="1" *)
LUT2 inst (.I0(I0), .I1(I1), .O(O));
endmodule
Passing an INIT Value Via the Generics Mechanism VHDL Coding Example
--
-- Passing an INIT value via the generics mechanism.
--
library ieee;
use ieee.std_logic_1164.all;
library unisim;
use unisim.vcomponents.all;
entity primitive_2 is
port(I0,I1 : in std_logic;
O : out std_logic);
end primitive_2;
end beh;
Passing an INIT Value Via the Parameters Mechanism Verilog Coding
Example
//
// Passing an INIT value via the parameters mechanism.
//
endmodule
endmodule
Cores Processing
If a design contains cores represented by an Electronic Data Interchange Format (EDIF)
or an NGC file, XST can automatically read them for timing estimation and area
utilization control. Use ISE® Design Suite Process > Process Properties > Synthesis
Options > Read Cores to enable or disable this feature. Using the read_cores option of
the run command from the command line, you can also specify optimize. This enables
cores processing, and allows XST to integrate the core netlist into the overall design. XST
reads cores by default.
If Read Cores is disabled, XST estimates Maximum Combinational Path Delay as 6.639ns
(critical path goes through a simple AND function) and an area of one slice.
If Read Cores is enabled, XST issues the following messages during Low Level Synthesis:
...
============================================================
*
* Low Level Synthesis
*
============================================================
============================================================
...
Estimation of Maximum Combinational Path Delay is 8.281ns with an area of five slices.
By default, XST reads Electronic Data Interchange Format (EDIF) and NGC cores from
the current (project) directory. If the cores are not in the project directory, specify the
directory in which the cores are located with Cores Search Directories (-sd).
Coding Example
In the following VHDL coding example, the block my_add is an adder, which is
represented as a black box in the design whose netlist was generated by the CORE
Generator™ software.
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_signed.all;
entity read_cores is
port(
A, B : in std_logic_vector (7 downto 0);
a1, b1 : in std_logic;
SUM : out std_logic_vector (7 downto 0);
res : out std_logic);
end read_cores;
begin
res <= a1 and b1;
inst: my_add port map (A => A, B => B, S => SUM);
end beh;
Passing an INIT Value Via the LUT_MAP Constraint VHDL Coding Example
--
-- Mapping on LUTs via LUT_MAP constraint
--
library ieee;
use ieee.std_logic_1164.all;
entity and_one is
port (A, B : in std_logic;
REZ : out std_logic);
--------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
entity and_two is
port(A, B : in std_logic;
REZ : out std_logic);
--------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
entity inits_rlocs_1 is
port(A,B,C : in std_logic;
REZ : out std_logic);
end inits_rlocs_1;
component and_one
port(A, B : in std_logic;
REZ : out std_logic);
end component;
component and_two
port(A, B : in std_logic;
REZ : out std_logic);
end component;
Passing an INIT Value Via the LUT_MAP Constraint Verilog Coding Example
//
// Mapping on LUTs via LUT_MAP constraint
//
(* LUT_MAP="yes" *)
module v_and_one (A, B, REZ);
input A, B;
output REZ;
endmodule
// --------------------------------------------------
(* LUT_MAP="yes" *)
module v_and_two (A, B, REZ);
input A, B;
output REZ;
or or_inst(REZ, A, B);
endmodule
// --------------------------------------------------
wire tmp;
endmodule
library ieee;
use ieee.std_logic_1164.all;
entity inits_rlocs_2 is
port (CLK : in std_logic;
DI : in std_logic_vector(3 downto 0);
DO : out std_logic_vector(3 downto 0));
end inits_rlocs_2;
process (CLK)
begin
if (clk’event and clk=’1’) then
tmp <= DI;
end if;
end process;
DO <= tmp;
end beh;
initial begin
tmp = 4’b1011;
end
assign do = tmp;
endmodule
Specifying INIT and RLOC Values for a Flip-Flop VHDL Coding Example
--
-- Specification on an INIT and RLOC values for a flip-flop,
-- described at RTL level
--
library ieee;
use ieee.std_logic_1164.all;
entity inits_rlocs_3 is
port (CLK : in std_logic;
DI : in std_logic_vector(3 downto 0);
DO : out std_logic_vector(3 downto 0));
end inits_rlocs_3;
process (CLK)
begin
if (clk’event and clk=’1’) then
tmp <= DI;
end if;
end process;
DO <= tmp;
end beh;
Specifying INIT and RLOC Values for a Flip-Flop Verilog Coding Example
//
// Specification on an INIT and RLOC values for a flip-flop,
// described at RTL level
//
initial begin
tmp = 4’b1011;
end
assign do = tmp;
endmodule
A generated macro is optimized separately and then merged with surrounded logic
because optimization gives better results for larger components.
Final Results
Top Level Output file name : file_name
Output format : ngc
Optimization goal : {area | speed}
Target Technology : {9500 | 9500xl | 9500xv | xpla3 | xbr | cr2s}
Keep Hierarchy : {yes | soft | no}
Macro Preserve : {yes | no}
XOR Preserve : {yes | no}
Design Statistics
NGC Instances: nb_of_instances
I/Os: nb_of_io_ports
Macro Statistics
# FSMs: nb_of_FSMs
# Registers: nb_of_registers
# Tristates: nb_of_tristates
# Comparators: nb_of_comparators
n-bit comparator {equal | not equal | greater| less | greatequal | lessequal}:
nb_of_n_bit_comparators
# Multiplexers: nb_of_multiplexers
n-bit m-to-1 multiplexer :
nb_of_n_bit_m_to_1_multiplexers
# Adders/Subtractors: nb_of_adds_subs
n-bit adder: nb_of_n_bit_adds
n-bit subtractor: nb_of_n_bit_subs
# Multipliers: nb_of_multipliers
# Logic Shifters: nb_of_logic_shifters
# Counters: nb_of_counters
n-bit {up | down | updown} counter: nb_of_n_bit_counters
# XORs: nb_of_xors
Cell Usage :
# BELS: nb_of_bels
# AND...: nb_of_and ...
# OR...: nb_of_or ...
# INV: nb_of_inv
# XOR2: nb_of_xor2
# GND: nb_of_gnd # VCC: nb_of_vcc
# FlipFlops/Latches: nb_of_ff_latch
# FD...: nb_of_fd ...
# LD...: nb_of_ld ...
# Tri-States: nb_of_tristates
# BUFE: nb_of_bufe
# BUFT: nb_of_buft
# IO Buffers: nb_of_iobuffers
# IBUF: nb_of_ibuf
# OBUF: nb_of_obuf
# IOBUF: nb_of_iobuf
# OBUFE: nb_of_obufe
# OBUFT: nb_of_obuft # Others: nb_of_others
The following tries, in this order, may give successively better results for frequency:
• Obtaining Better Frequency Try 1
• Obtaining Better Frequency Try 2
• Obtaining Better Frequency Try 3
• Obtaining Better Frequency Try 4
The CPU time increases from Try 1 to Try 4.
Select Edit > Preferences > Processes > Property Display Level > Advanced to view the
following options:
• Keep Hierarchy (KEEP_HIERARCHY)
• Cores Search Directories (-sd)
• Cross Clock Analysis (-cross_clock_analysis)
• Hierarchy Separator (-hierarchy_separator)
• Bus Delimiter (-bus_delimiter)
• Case (-case)
• Work Directory (-xsthdpdir)
• HDL Library Mapping File (-xsthdpini)
• Verilog Include Directories (-vlgincdir)
• Slice (LUT-FF Pairs) Utilization Ratio (SLICE_UTILIZATION_RATIO)
Options Precedence
While this property is intended for options not listed in Process > Process Properties, if
an option already listed is entered, precedence is given to that option.
General Rules
• If a constraint can be applied on an entity (VHDL), then it can also be applied on
the component declaration. The ability to apply constraints on components is not
explicitly stated for each individual constraint, since it is a general XST rule.
• Some third party synthesis tools allow you to apply constraints on architectures.
XST allows constraints on architectures only for those third party constraints
automatically supported by XST.
Verilog-2001 Attributes
XST supports Verilog-2001 attribute statements. Attributes are comments that pass
specific information to software tools such as synthesis tools. Verilog-2001 attributes
can be specified anywhere for operators or signals within module declarations and
instantiations. Other attribute declarations may be supported by the compiler, but
are ignored by XST.
where
• attribute precedes the signal, module, or instance declaration to which it refers.
• attribute_value is a string. No integer or scalar values are allowed.
• attribute_value is between quotes.
• The default is 1.
• (* attribute_name *) is the same as (* attribute_name = "1" *).
Verilog-2001 Limitations
Verilog-2001 attributes are not supported for:
• Signal declarations
• Statements
• Port connections
• Expression operators
Syntax
To apply a constraint to the entire entity or module use the following syntax:
Use native UCF syntax, including wildcards and hierarchical names, for native UCF
constraints such as:
• Period (PERIOD)
• Offset (OFFSET)
• Timing Name on a Net (TNM_NET)
• Timegroup (TIMEGRP)
• Timing Ignore (TIG)
• From-To (FROM-TO)
Restriction Do not use these constraints inside the BEGIN MODEL... END construct.
If you do, XST issues an error.
Constraints Priority
Constraints priority depends on the file in which the constraint appears. A constraint in
a file accessed later in the design flow overrides a constraint in a file accessed earlier
in the design flow.
Priority is as follows, from highest to lowest:
1. Synthesis Constraint File
2. Hardware Description Language (HDL) file
3. ISE® Design Suite Process > Process Properties, or the command line
Architecture Support
Architecture independent.
Applicable Elements
Applies to the entire design.
Propagation Rules
Applies to design primary IOs.
Syntax
-iobuf {yes|no|true|false|soft}
• yes (default)
Tells XST to generate IBUF and OBUF primitives and connected them to I/O ports
of the top-level module.
• no
Tells XST not to generate IBUF and OBUF primitives, and must be used when XST is
called to synthesize an internal module that is instantiated later in a larger design.
If I/O buffers are added to a design, this design cannot be used as a submodule
of another design.
• true
• false
• soft
BoxType (BOX_TYPE)
The BoxType (BOX_TYPE) constraint is a synthesis constraint.
If BoxType is applied to at least a single instance of a block of a design, BoxType is
propagated to all other instances of the entire design. This feature was implemented
for Verilog and XST Constraint File (XCF) in order to have a VHDL-like support, where
BoxType can be applied to a component.
Architecture Support
Architecture independent.
Applicable Elements
Applies to the following design elements:
• VHDL
component, entity
• Verilog
module, instance
• XST Constraint File (XCF)
model, instance
Propagation Rules
Applies to the design element to which it is attached.
Syntax
• primitive
• black_box
Equivalent to primitive. Will eventually become obsolete.
• user_black_box
XST reports inference of a black box in the log file unless primitive is specified.
These values instruct XST not to synthesize the behavior of a module.
VHDL
Declare as follows:
attribute box_type: string;
Specify as follows:
attribute box_type of {component_name|entity_name} : {component|entity} is
"{primitive|black_box|user_black_box}";
Verilog
Place immediately before the instantiation:
(* box_type = "{primitive|black_box|user_black_box}" *)
Architecture Support
Architecture independent.
Applicable Elements
Applies to syntax.
Propagation Rules
Not applicable.
Syntax
-bus_delimiter {<>|[]|{}|()}
• <> (default)
• []
• {}
• ()
Case (-case)
The Case (-case) command line option determines if instance and net names are written
in the final netlist using all lowercase or uppercase letters, or if the case is maintained
from the source.
The case can be maintained for either Verilog or VHDL.
Architecture Support
Architecture independent.
Applicable Elements
Applies to syntax.
Propagation Rules
Not applicable.
Syntax
-case {upper|lower|maintain}
• upper
• lower
• maintain (default)
Architecture Support
Architecture independent.
Applicable Elements
Applies to the entire design.
Propagation Rules
Not applicable.
Syntax
-vlgcase {full|parallel|full-parallel}
• full
XST assumes that the case statements are complete, and avoids latch creation.
• parallel
XST assumes that the branches cannot occur in parallel, and does not use a priority
encoder.
• full-parallel
XST assumes that the case statements are complete, and that the branches cannot
occur in parallel, therefore saving latches and priority encoders.
By default, there is no value. If the option is not specified, XST implements the exact
behavior of the case statements.
For instance, if the original flip-flop name is my_ff, and this flip-flop was replicated
three times, XST generates flip-flops with the following names:
• my_ff_1
• my_ff_2
• my_ff_3
Duplication Suffix lets you change the string that is added to the original name.
Architecture Support
Architecture independent.
Applicable Elements
Applies to files.
Propagation Rules
Not applicable.
Syntax
-duplication_suffix string%dstring
The default is %d.
Architecture Support
Architecture independent.
Applicable Elements
Applies to case statements in Verilog meta comments.
Propagation Rules
Not applicable.
Syntax
-vlgcase [full|parallel|full-parallel]
• full
• parallel
• full-parallel
Verilog
The syntax is:
(* full_case *)
Since FULL_CASE does not contain a target reference, the attribute immediately
precedes the selector:
(* full_case *)
casex select
4’b1xxx: res = data1;
4’bx1xx: res = data2;
4’bxx1x: res = data3;
4’bxxx1: res = data4;
endcase
FULL_CASE is also available as a meta comment in the Verilog code. The syntax differs
from the standard meta comment syntax as shown in the following:
// synthesis full_case
Since FULL_CASE does not contain a target reference, the meta comment immediately
follows the selector:
casex select // synthesis full_case
4’b1xxx: res = data1;
4’bx1xx: res = data2;
4’bxx1x: res = data3;
4’bxxx1: res = data4;
endcase
XST Command Line
xst run -vlgcase [full|parallel|full-parallel]
Architecture Support
Architecture independent.
Applicable Elements
Applies to files.
Propagation Rules
Not applicable.
Syntax
-rtlview {yes|no|only}
• yes
Tells XST to generate an RTL view.
• no (default)
Tells XST not to generate the RTL view.
• only
Tells XST to stop the synthesis once the RTL view is generated.
Generics (-generics)
The Generics (-generics) command line option allows you to redefine generics (VHDL)
or parameters (Verilog) values defined in the top-level design block.
This allows you to easily modify the design configuration without any Hardware
Description Language (HDL) source modifications, such as for IP core generation and
testing flows. If the defined value does not correspond to the data type defined in the
VHDL or Verilog code, then XST tries to detect the situation and issues a warning,
ignoring the command line definition.
In some situations, XST may fail to detect a type mismatch. In that case, XST attempts to
apply this value by adopting it to the type defined in the VHDL or Verilog file without
any warning. Be sure that the value you specified corresponds to the type defined in
the VHDL or Verilog code. If a defined generic or parameter name does not exist in the
design, no message is given, and the definition is ignored.
Architecture Support
Architecture independent.
Applicable Elements
Applies to the entire design.
Propagation Rules
Not applicable.
Syntax
-generics {name=valuename=value ...}
where
• name is the name of a generic or parameter of the top level design block
• value is the value of a generic or parameter of the top level design block
The default is an empty definition.
Architecture Support
Architecture independent.
Applicable Elements
Applies to files.
Propagation Rules
Not applicable.
Syntax
-xsthdpini file_name
You can specify only one library mapping file.
Architecture Support
Architecture independent.
Applicable Elements
Applies to files.
Propagation Rules
Not applicable.
Syntax
-hierarchy_separator {/ | _}
The two supported characters are:
• _ (underscore)
• / (forward slash)
The default is / (forward slash) for newly created projects.
Keep (KEEP)
Keep (Keep ) is an advanced mapping constraint.
When a design is mapped, some nets may be absorbed into logic blocks. When a net
is absorbed into a block, it can no longer be seen in the physical design database. This
may happen, for example, if the components connected to each side of a net are mapped
into the same logic block. The net may then be absorbed into the block containing the
components. Keep prevents this from happening.
In addition to true and false values supported by the implementation flow, XST supports
a soft value. If this value is specified XST preserves the designated net as in the case of
the true value, but does not attach the Keep constraint in the final netlist to this net.
Keep preserves the existence of the signal in the final netlist, but not its structure. For
example, if your design has a 2-bit multiplexer selector and you attach Keep to it, this
signal is preserved in the final netlist. But the multiplexer could be automatically
re-encoded by XST using one-hot encoding. As a consequence, this signal in the final
netlist is four bits wide instead of the original two. To preserve the structure of the signal,
in addition to Keep , you must also use Enumerated Encoding (ENUM_ENCODING)’
For more information about this constraint, see the Constraints Guide.
In the following figure, if Keep Hierarchy is set to the entity or module I2, the hierarchy
of I2 is in the final netlist, but its contents I4, I5 are flattened inside I2. I1, I3, I6, and I7
are also flattened.
Architecture Support
Architecture independent.
Applicable Elements
Applies to logical blocks, including blocks of hierarchy or symbols.
Propagation Rules
Applies to the entity or module to which it is attached.
Syntax
-keep_hierarchy {yes|no|soft}
• yes
• no
• true
Allows the preservation of the design hierarchy, as described in the HDL project. If
this value is applied to synthesis, it is also propagated to implementation.
The default is true for CPLD devices.
• false
Hierarchical blocks are merged in the top level module.
The default is false for FPGA devices.
• soft
Allows the preservation of the design hierarchy in synthesis, but KEEP_HIERARCHY
is not propagated to implementation.
VHDL
Declare as follows:
attribute keep_hierarchy : string;
Specify as follows:
attribute keep_hierarchy of architecture_name: architecture is "{yes|no|true|false|soft}";
Verilog
Place immediately before the module declaration or instantiation:
(* keep_hierarchy = "{yes|no|true|false|soft}" *)
XCF
MODEL "entity_name" keep_hierarchy={yes|no|true|false|soft};
Architecture Support
Architecture independent.
Applicable Elements
Applies to files.
Propagation Rules
Not applicable.
Syntax
-lso file_name.lso
There is no default file name. If not specified, XST uses the default search order.
LOC
The LOC constraint defines where a design element can be placed within an FPGA or
CPLD device.
For more information about this constraint, see the Constraints Guide.
Architecture Support
Applies to all FPGA devices. Does not apply to CPLD devices.
Applicable Elements
Applies to the entire design.
Propagation Rules
Not applicable.
Syntax
-netlist_hierarchy {as_optimized|rebuilt}
• as_optimized (default)
XST takes into account the Keep Hierarchy (KEEP_HIERARCHY) constraint, and
generates the NGC netlist in the form in which it was optimized. In this mode, some
hierarchical blocks can be flattened, and some can maintain hierarchy boundaries.
• rebuilt
XST writes a hierarchical NGC netlist, regardless of the Keep Hierarchy
(KEEP_HIERARCHY) constraint.
Architecture Support
Architecture independent.
Applicable Elements
Applies to the entire design, or to an entity or module.
Propagation Rules
Applies to the entity, component, module, or signal to which it is attached.
Syntax
-opt_level {1|2}
• 1 (normal optimization) (default)
Use 1 (normal optimization) for very fast processing, especially for hierarchical
designs. In speed optimization mode, Xilinx® recommends using 1 (normal
optimization) for the majority of designs.
• 2 (higher optimization)
While 2 (higher optimization) is more time consuming, it sometimes gives better
results in the number of slices/macrocells or maximum frequency. Selecting 2
(higher optimization) usually results in increased synthesis run times, and does not
always bring optimization gain.
VHDL
Declare as follows:
attribute opt_level: string;
Specify as follows:
attribute opt_level of entity_name: entity is "{1|2}";
Verilog
Place immediately before the module declaration or instantiation:
(* opt_level = "{1|2}" *)
XCF
MODEL "entity_name" opt_level={1|2};
Architecture Support
Architecture independent.
Applicable Elements
Applies to the entire design, or to an entity or module.
Propagation Rules
Applies to the entity or module to which it is attached.
Syntax
-opt_mode {area|speed}
• speed (default)
The priority of speed is to reduce the number of logic levels and therefore to
increase frequency.
• area
The priority of area is to reduce the total amount of logic used for design
implementation and therefore improve design fitting.
VHDL
Declare as follows:
attribute opt_mode: string;
Specify as follows:
attribute opt_mode of entity_name: entity is "{speed|area}";
Verilog
Place immediately before the module declaration or instantiation:
(* opt_mode = "{speed|area}" *)
XCF
MODEL "entity_name" opt_mode={speed|area};
Architecture Support
Architecture independent.
Applicable Elements
Applies to case statements in Verilog meta comments only.
Propagation Rules
Not applicable.
Syntax
-vlgcase {full|parallel|full-parallel}
• full
• parallel
• full-parallel
Verilog
(* parallel_case *)
Since PARALLEL_CASE does not contain a target reference, the attribute immediately
precedes the selector.
(* parallel_case *)
casex select
4’b1xxx: res = data1;
4’bx1xx: res = data2;
4’bxx1x: res = data3;
4’bxxx1: res = data4;
endcase
PARALLEL_CASE is also available as a meta comment in the Verilog code. The syntax
differs from the standard meta comment syntax as shown in the following:
// synthesis parallel_case
Since PARALLEL_CASE does not contain a target reference, the meta comment
immediately follows the selector:
casex select // synthesis parallel_case
4’b1xxx: res = data1;
4’bx1xx: res = data2;
4’bxx1x: res = data3;
4’bxxx1: res = data4;
endcase
XST Command Line
xst run -vlgcase {full|parallel|full-parallel}
RLOC (RLOC)
The RLOC (RLOC) constraint:
• Is a basic mapping and placement constraint.
• Groups logic elements into discrete sets.
• Allows you to define the location of any element within the set relative to other
elements in the set, regardless of eventual placement in the overall design.
For more information about this constraint, see the Constraints Guide.
Architecture Support
Applies to all FPGA devices. Does not apply to CPLD devices.
Verilog
Assuming an SRL16 instance named srl1 to be placed at location R9C0.S0, you may
specify the following in the Verilog code:
// synthesis attribute RLOC of srl1 : "R9C0.S0";
XCF
You may specify the same attribute in the XST Constraint File (XCF) as follows:
BEGIN MODEL ENTNAME
INST sr11 RLOC=R9C0.SO;
END;
The binary equivalent of the following line is written to the output NGC file:
INST srl1 RLOC=R9C0.S0;
Save (S)
The Save (S) constraint is an advanced mapping constraint.
When the design is mapped, some nets may be absorbed into logic blocks, and some
elements such as LUTs can be optimized away. When a net is absorbed into a block, or a
block is optimized away, it can no longer be seen in the physical design database. Save
(S) prevents this from happening. Several optimization techniques such as nets or blocks
replication and register balancing are also disabled by the Save (S) constraint.
If Save (S) is applied to a net, XST preserves the net with all elements directly connected
to it in the final netlist. This includes nets connected to these elements.
If Save (S) is applied to a block such as a LUT, XST preserves the LUT with all signals
connected to it.
For more information about this constraint, see the Constraints Guide.
Architecture Support
Architecture independent.
Applicable Elements
Applies to files.
Propagation Rules
Not applicable.
Syntax
-uc filename
filename is the only value.
Architecture Support
Architecture independent.
Applicable Elements
Applies locally.
Propagation Rules
Instructs the synthesis tool to enable or disable portions of code
Syntax
The following sections show the syntax for this constraint.
VHDL
-- synthesis translate_off
...code not synthesized...
-- synthesis translate_on
Verilog
The Verilog syntax differs from the standard meta comment syntax presented earlier, as
shown in the following coding example.
// synthesis translate_off
...code not synthesized...
// synthesis translate_on
Architecture Support
Architecture independent.
Applicable Elements
Applies to files.
Propagation Rules
Not applicable.
Syntax
-iuc {yes|no}
• yes
• no (default)
Architecture Support
Architecture independent.
Applicable Elements
Applies to syntax.
Propagation Rules
Not applicable.
Syntax
-verilog2001 {yes|no}
• yes (default)
• no
Architecture Support
Architecture independent.
Applicable Elements
Applies to directories.
Propagation Rules
Not applicable.
Syntax
-vlgincdir { directory_path [directory_path]}
where
directory_path is the name of a directory
For more information, see:
Names With Spaces in Command Line Mode.
Architecture Support
Architecture independent.
Applicable Elements
Applies to the entire design.
Propagation Rules
Not applicable.
Syntax
-define {name[=value] name[=value]}
where
• name is a macro name
• value is the macro text
Architecture Support
Architecture independent.
Applicable Elements
Applies to directories.
Propagation Rules
Not applicable.
Architecture Support
Architecture independent.
Applicable Elements
Applies to the entire design, or to an entity, component, module, or signal.
Propagation Rules
Applies to the entity, component, module, or signal to which it is attached.
Syntax
-fsm_extract {yes|no}
• yes (default)
• no
• true (XCF only)
• false (XCF only)
VHDL
Declare as follows:
attribute fsm_extract: string;
Specify as follows:
attribute fsm_extract of {entity_name|signal_name} : {entity|signal} is "{yes|no}";
Verilog
Place immediately before the module or signal declaration:
(* fsm_extract = "{yes|no}" *)
Architecture Support
Architecture independent.
Applicable Elements
Applies to signals or types.
Because ENUM_ENCODING must preserve the external design interface, XST ignores
ENUM_ENCODING when it is used on a port.
Propagation Rules
Applies to the signal or type to which it is attached.
Syntax
The following sections show the syntax for this constraint.
VHDL
Specify as a VHDL constraint on the considered enumerated type:
...
...
architecture behavior of example is
type statetype is (ST0, ST1, ST2, ST3);
attribute enum_encoding : string;
attribute enum_encoding of statetype : type is "001 010 100 111";
signal state1 : statetype;
signal state2 : statetype;
begin
...
XCF
BEGIN MODEL "entity_name"
NET "signal_name" enum_encoding="string";
END;
Architecture Support
Architecture independent.
Applicable Elements
Applies to the entire design, or to an entity, component, module, or signal.
Propagation Rules
Removes equivalent flip-flops and flip-flops with constant inputs.
Syntax
-equivalent_register_removal {yes|no}
• yes (default)
• no
• true (XCF only)
• false (XCF only)
When the value is set to yes, flip-flop optimization is allowed.
When the value is set to no, flip-flop optimization is inhibited.
Tip The flip-flop optimization algorithm is time consuming. For fast processing, use no.
VHDL
Declare as follows:
attribute equivalent_register_removal: string;
Specify as follows:
attribute equivalent_register_removal of {entity_name|signal_name} : {signal|entity}
is "{yes |no}";
Verilog
Place immediately before the module or signal declaration:
(* equivalent_register_removal="{yes|no}" *)
Architecture Support
Architecture independent.
Applicable Elements
Applies to the entire design, or to an entity, component, module, or signal.
Propagation Rules
Applies to the entity, component, module, or signal to which it is attached.
Syntax
-fsm_encoding {auto|one-hot|compact|sequential|gray|johnson|speed1|user}
• auto (default)
The best coding technique is automatically selected for each individual state
machine.
• one-hot
• compact
• sequential
• gray
• johnson
• speed1
• user
VHDL
Declare as follows:
attribute fsm_encoding: string;
Specify as follows:
attribute fsm_encoding of {entity_name|signal_name}: {entity|signal} is
"{auto|one-hot|compact|sequential|gray|johnson|speed1|user}";
Verilog
Place immediately before the module or signal declaration:
(* fsm_encoding = "{auto|one-hot|compact|sequential|gray|johnson|speed1|user}"
*)
Architecture Support
Architecture independent.
Applicable Elements
Applies to the entire design, or to an entity, component, module, or signal.
Propagation Rules
Applies to the entity, component, module, or signal to which it is attached.
Syntax
-mux_extract {yes|no|force}
• yes (default)
• no
• force
• true (XCF only)
• false (XCF only)
By default, multiplexer inference is enabled with the yes option. For each identified
multiplexer description, based on some internal decision rules, XST actually creates a
macro or optimizes it with the rest of the logic. The force value overrides those decision
rules, and forces XST to create the MUX macro.
VHDL
Declare as follows:
attribute mux_extract: string;
Specify as follows:
attribute mux_extract of {signal_name|entity_name}: {entity|signal} is "{yes|no|force}";
Verilog
Place immediately before the module or signal declaration:
(* mux_extract = "{yes|no|force}" *)
Architecture Support
Architecture independent.
Applicable Elements
Applies to the entire design, or to design elements.
Propagation Rules
Applies to the entity, component, module, or signal to which it is attached.
Syntax
-resource_sharing {yes|no}
• yes (default)
• no
• force
• true (XCF only)
• false (XCF only)
VHDL
Declare as follows:
attribute resource_sharing: string;
Specify as follows:
attribute resource_sharing of entity_name: entity is "{yes|no}";
Verilog
Place immediately before the module declaration or instantiation:
(* resource_sharing = "{yes|no}" *)
Architecture Support
Architecture independent.
Applicable Elements
Applies to:
• An entire design through the XST command line
• A particular block (entity, architecture, component)
• A signal
Propagation Rules
Applies to the entity, component, module, or signal to which it is attached.
Syntax
-safe_implementation {yes|no}
• yes
• no (default)
VHDL
Declare as follows:
attribute safe_implementation: string;
Specify as follows:
attribute safe_implementation of {entity_name|component_name|signal_name} :
{entity|component|signal} is "{yes|no}";
Verilog
Place immediately before the module or signal declaration:
(* safe_implementation = "{yes|no}" *)
Architecture Support
Architecture independent.
Applicable Elements
Applies to the entire design, or to an entity, component, module, or signal.
Propagation Rules
Applies to the entity, component, module, or signal to which it is attached.
Syntax
-signal_encoding {auto|one-hot|user}
• auto (default)
The best coding technique is automatically selected for each individual signal.
• one-hot
Forces the encoding to a one-hot encoding.
• user
Forces XST to keep your encoding.
VHDL
Declare as follows:
attribute signal_encoding: string;
Specify as follows:
attribute signal_encoding of {component_name|signal_name|entity_name|label_name} :
{component|signal|entity|label} is "{auto|one-hot|user}";
Verilog
Place immediately before the signal declaration:
(* signal_encoding = "{auto|one-hot|user}" *)
Architecture Support
Architecture independent.
Applicable Elements
Applies to a signal representing a state register.
Propagation Rules
Applies to the signal to which it is attached.
Syntax
The following sections show the syntax for this constraint.
VHDL
Declare as follows:
attribute safe_recovery_state: string;
Specify as follows:
attribute safe_recovery_state of {signal_name}:signal is "<value>";
Verilog
Place immediately before the signal declaration:
(* safe_recovery_state = "<value>" *)
XCF
BEGIN MODEL "entity_name"
NET "signal_name" safe_recovery_state="<value>";
END;
Architecture Support
Applies to all FPGA devices. Does not apply to CPLD devices.
Applicable Elements
Applies to the entire design.
Propagation Rules
Not applicable.
Syntax
-async_to_sync {yes|no}
• yes
• no (default)
Architecture Support
Applies to all FPGA devices. Does not apply to CPLD devices.
Applicable Elements
Applies to the entire design.
Propagation Rules
Not applicable.
Syntax
-auto_bram_packing {yes|no}
• yes
• no (default)
Architecture Support
Applies to all FPGA devices. Does not apply to CPLD devices.
Applicable Elements
Applies to the entire design.
Propagation Rules
Not applicable.
Syntax
• %
• #
Architecture Support
Applies to all FPGA devices. Does not apply to CPLD devices.
Applicable Elements
Applies to signals.
Propagation Rules
Applies to the signal to which it is attached.
Syntax
• bufgdll
• ibufg
• bufgp
• ibuf
• bufr
• none
VHDL
Declare as follows:
attribute buffer_type: string;
Specify as follows:
attribute buffer_type of signal_name: signal is "
{bufgdll|ibufg|bufgp|ibuf|bufr|none}";
Verilog
Place immediately before the signal declaration:
(* buffer_type = "{bufgdll|ibufg|bufgp|ibuf|bufr|none}" *)
XCF
BEGIN MODEL "entity_name"
NET "signal_name" buffer_type={bufgdll|ibufg|bufgp|ibuf|bufr|none};
END;
Architecture Support
Applies to all FPGA devices. Does not apply to CPLD devices.
Applicable Elements
Applies to:
• An entire design through the XST command line
• A particular block (entity, architecture, component)
• A signal
Propagation Rules
Applies to the entity, component, module, or signal to which it is attached.
Syntax
-tristate2logic {yes|no}
• yes (default)
• no
• true (XCF only)
• false (XCF only)
VHDL
Declare as follows:
attribute tristate2logic: string;
Specify as follows:
attribute tristate2logic of {entity_name|component_name|signal_name} :
{entity|component|signal} is "{yes|no}";
Verilog
Place immediately before the module or signal declaration:
(* tristate2logic = "{yes|no}" *)
Architecture Support
Applies to all FPGA devices. Does not apply to CPLD devices.
Applicable Elements
Applies to the entire design.
Propagation Rules
Not applicable.
Syntax
-sd {directory_path [directory_path]]
The only value is directory_path. There is no default.
Architecture Support
Applies to all FPGA devices. Does not apply to CPLD devices.
Applicable Elements
Applies to the entire design, or to an entity, component, module, or signal.
Propagation Rules
When attached to a net or signal, Decoder Extraction applies to the attached signal.
When attached to an entity or module, Decoder Extraction is propagated to all applicable
elements in the hierarchy within the entity or module.
Syntax
-decoder_extract {yes|no}
• yes (default)
• no
VHDL
Declare as follows:
Verilog
Place immediately before the module or signal declaration:
(* decoder_extract "{yes|no}" *)
Architecture Support
Applies to the following devices only. Does not apply to any other devices.
• Virtex®-4
• Virtex-5
• Spartan®-3A DSP
Applicable Elements
Applies to the entire design.
Propagation Rules
Not applicable.
Syntax
The following sections show the syntax for this constraint.
Architecture Support
Applies to all FPGA devices. Does not apply to CPLD devices.
Applicable Elements
Applies to clock signals.
Propagation Rules
Applies to the signal to which it is attached.
Syntax
• yes
• no
Verilog
Place immediately before the signal declaration:
(* bufgce = "{yes|no}" *)
XCF
BEGIN MODEL "entity_name"
NET "primary_clock_signal" bufgce={yes|no|true|false};
END;
Architecture Support
Applies to all FPGA devices. Does not apply to CPLD devices.
Applicable Elements
Applies to the entire design, or to an entity, component, module, or signal.
Propagation Rules
Applies to the entity, component, module, or signal to which it is attached.
Syntax
• lut (default)
• bram
VHDL
Declare as follows:
attribute fsm_style: string;
Declare as follows:
attribute fsm_style of {entity_name|signal_name} : {entity|signal} is "{lut|bram}";
Verilog
Place immediately before the module or signal declaration:
(* fsm_style = "{lut|bram}" *)
Architecture Support
Applies to all FPGA devices. Does not apply to CPLD devices.
Applicable Elements
Applies to the entire design, or to design elements and nets.
Propagation Rules
Applies to the entity, component, module, or signal to which it is attached.
Syntax
-shift_extract {yes|no}
• yes (default)
• no
• true (XCF only)
• false (XCF only)
VHDL
Declare as follows:
attribute shift_extract: string;
Specify as follows:
attribute shift_extract of {entity_name|signal_name}: {signal|entity} is "{yes|no}";
Verilog
Place immediately before the module declaration or instantiation:
(* shift_extract = "{yes|no}" *)
Architecture Support
Applies to Virtex®-5 devices only. Does not apply to any other devices.
Applicable Elements
Applies to the entire design.
Propagation Rules
Not applicable.
Syntax
-lc {auto|area|off}
• auto
XST tries to make a trade-off between area and speed.
• area
XST performs maximum LUT combining to provide as small an implementation as
possible.
• off (default)
Disables LUT Combining.
Architecture Support
Applies to all FPGA devices. Does not apply to CPLD devices.
Applicable Elements
Applies to a VHDL entity or Verilog module.
Propagation Rules
Applies to the entity or module to which it is attached.
Syntax
• yes (default)
• no
• true (XCF only)
• false (XCF only)
VHDL
Declare as follows:
Verilog
Place immediately before the module declaration or instantiation:
(* lut_map = "{yes|no}" *)
XCF
MODEL "entity_name" lut_map={yes|no|true|false};
Architecture Support
Applies to all FPGA devices. Does not apply to CPLD devices.
Applicable Elements
BRAMs.
Propagation Rules
Isolate the logic (including output register) to be mapped on RAM in a separate
hierarchical level. Logic that does not fit on a single block RAM is not mapped. Ensure
that the whole entity fits, not just part of it.
The attribute BRAM_MAP is set on the instance or entity. If no block RAM can be
inferred, the logic is passed to Global Optimization, where it is optimized. The macros
are not inferred. Be sure that XST has mapped the logic.
Syntax
• yes
• no (default)
VHDL
Declare as follows:
attribute bram_map: string;
Specify as follows:
attribute bram_map of component_name: component is "{yes|no}";
Verilog
Place immediately before the module declaration or instantiation:
(* bram_map = "{yes|no}" *)
Architecture Support
Applies to all FPGA devices. Does not apply to CPLD devices.
Applicable Elements
Applies to the entire design.
Propagation Rules
Applies to the entity, component, module, or signal to which it is attached.
Syntax
-max_fanout integer
The constraint value is an integer. The default value varies depending on the targeted
device family as shown in the following table.
VHDL
Declare as follows:
attribute max_fanout: string;
Specify as follows:
attribute max_fanout of {signal_name|entity_name}: {signal|entity} is "integer";
Verilog
Place immediately before the signal declaration:
(* max_fanout = "integer" *)
Architecture Support
Applies to all FPGA devices. Does not apply to CPLD devices.
Applicable Elements
Applies to the following only:
• Entire design
• Single modules or entities
• Primary clock signal
Propagation Rules
For Move First Stage propagation rules, see the figure above.
Syntax
-move_first_stage {yes|no}
Both Move First Stage and Move Last Stage may have either of two values:
• yes
• no
– MOVE_FIRST_STAGE=no
Prevents the first flip-flop stage from moving
– MOVE_LAST_STAGE=no
Prevents the last flip-flop stage from moving
VHDL
Declare as follows:
attribute move_first_stage : string;
Specify as follows:
attribute move_first_stage of {entity_name|signal_name } : {signal|entity} is "{yes|no}";
Verilog
Place immediately before the module or signal declaration:
(* move_first_stage = "{yes|no}" *)
Architecture Support
Applies to all FPGA devices. Does not apply to CPLD devices.
Applicable Elements
Applies to the following:
• Entire design
• Single modules or entities
• Primary clock signal
Propagation Rules
See Move First Stage (MOVE_FIRST_STAGE).
Syntax
-move_last_stage {yes|no}
• yes (default)
• no
• true (XCF only)
• false (XCF only)
VHDL
Declare as follows:
attribute move_last_stage : string;
Specify as follows:
attribute move_last_stage of {entity_name|signal_name} : {signal|entity} is "{yes|no}";
Verilog
Place immediately before the module or signal declaration:
(* move_last_stage = "{yes|no}" *)
Architecture Support
Applies to all FPGA devices. Does not apply to CPLD devices.
Applicable Elements
Applies to the entire design, or to an entity, component, module, or signal.
Propagation Rules
Applies to the entity, component, module, or signal to which it is attached.
Syntax
-mult_style {auto|block|kcm|csd|lut|pipe_lut}
• auto (default)
Instructs XST to look for the best implementation for each considered macro.
• block
• pipe_block
– Used to pipeline DSP48 based multipliers.
– Available for the following devices only:
♦ Virtex®-4
♦ Virtex-5
♦ Spartan®-3A DSP
• kcm
• csd
• lut
• pipe_lut
For pipeline slice-based multipliers only.
VHDL
Declare as follows:
Verilog
Place immediately before the module or signal declaration:
(* mult_style = "{auto|block|pipe_block|kcm|csd|lut|pipe_lut}" *)
Architecture Support
Applies to all FPGA devices. Does not apply to CPLD devices.
Available Devices
Devices Resources
Spartan®-3 MUXF
Spartan-3E MUXF6
Spartan-3A MUXCY
Spartan-3A DSP MUXF7
Virtex®-4 MUXF8
Virtex-5
Applicable Elements
Applies to the entire design, or to an entity, component, module, or signal.
Propagation Rules
Applies to the entity, component, module, or signal to which it is attached.
Syntax
mux_style {auto|muxf|muxcy}
• auto (default)
XST looks for the best implementation for each considered macro.
• muxf
• muxcy
VHDL
Declare as follows:
attribute mux_style: string;
Specify as follows:
attribute mux_style of {signal_name|entity_name} : {signal|entity} is
"{auto|muxf|muxcy}";
Verilog
Place immediately before the module or signal declaration:
(* mux_style = "{auto|muxf|muxcy}" *)
Architecture Support
Applies to all FPGA devices. Does not apply to CPLD devices.
Applicable Elements
Applies to the entire design.
Propagation Rules
Not applicable.
Syntax
-bufg integer
The value is an integer. The default value depends on the target device, and is equal
to the maximum number of available BUFG components. Defaults for selected
architectures are shown below.
Devices Default Value
Virtex®-4 32
Virtex-5
Spartan®-3 8
Spartan-3E 24
Spartan-3A
Spartan-3A DSP
Architecture Support
• May be used with Virtex®-4 devices only.
• May NOT be used with Virtex-5 devices.
• May NOT be used with Spartan®-3 devices.
• May NOT be used with CPLD devices.
Applicable Elements
Applies to the entire design.
Propagation Rules
Not applicable.
Syntax
-bufr integer
The value is an integer. The default value depends on the target device, and is equal to
the maximum number of available BUFRs.
Architecture Support
Applies to all FPGA devices. Does not apply to CPLD devices.
Applicable Elements
Applies to hierarchical blocks, components, and instances.
Propagation Rules
Applies to the component or instance to which it is attached.
Syntax
• yes
• no (default)
• true (XCF only)
• false (XCF only)
VHDL
Declare as follows:
attribute optimize_primitives: string;
Specify as follows:
attribute optimize_primitives of {component_name|entity_name|label_name} :
{component|entity|label} is "{yes|no}";
Verilog
Place immediately before the module or signal declaration:
(* optimize_primitives = "{yes|no}" *)
XCF
MODEL "entity_name" optimize_primitives = {yes|no|true|false};
In the current release, power optimization done by XST is dedicated to DSP48 and
BRAM blocks.
XST supports two BRAM optimization methods:
• Method One does not significantly impact area and speed. Method One is used by
default when power optimization is enabled.
• Method Two saves more power, but may significantly impact area and speed.
Both methods can be controlled by using the RAM Style (RAM_STYLE) constraint with
block_power1 for Method One and block_power2 for Method Two.
In some situations, XST may issue an HDL Advisor message giving you tips on how
to improve your design. For example, if XST detects that Read First mode is used for
BRAM, XST recommends that you use Write First or No Change modes.
Architecture Support
Applies to Virtex®-4 devices and Virtex-5 devices only. Does not apply to any other
FPGA devices. Does not apply to CPLD devices.
Applicable Elements
Applies to:
• A component or entity (VHDL)
• A model or label (instance) (Verilog)
• A model or INST (in model) (XCF)
• The entire design (XST command line)
Propagation Rules
Applies to the entity, component, module, or signal to which it is attached.
Syntax
-power {yes|no}
• yes
• no (default)
• true (XCF only)
• false (XCF only)
VHDL
Declare as follows:
attribute power: string;
Specify as follows:
attribute power of {component_name|entity_name} : {component_name|entity_name} is
"{yes|no}";
Verilog
Place immediately before the module declaration or instantiation:
(* power = "{yes|no}" *)
XCF
MODEL "entity_name" power = {yes|no|true|false};
The default is false.
Architecture Support
Applies to all FPGA devices. Does not apply to CPLD devices.
Applicable Elements
Applies to the entire design, or to an entity, component, module, or signal.
Propagation Rules
Applies to the entity, component, module, or signal to which it is attached.
Syntax
• yes (default)
• no
• force
• true (XCF only)
• false (XCF only)
For each identified priority encoder description, based on internal decision rules, XST
creates a macro or optimizes it with the rest of the logic. The force value allows you to
override those internal decision rules and force XST to extract the macro.
-priority_extract {yes|no|force}
VHDL
Declare as follows:
attribute priority_extract: string;
Specify as follows:
attribute priority_extract of {signal_name|entity_name} : {signal|entity} is
"{yes|no|force}";
Verilog
Place immediately before the module or signal declaration:
(* priority_extract = "{yes|no|force}" *)
Architecture Support
Applies to all FPGA devices. Does not apply to CPLD devices.
Applicable Elements
Applies to the entire design, or to an entity, component, module, or signal.
Propagation Rules
Applies to the entity, component, module, or signal to which it is attached.
Syntax
-ram_extract {yes|no}
• yes (default)
• no
• true (XCF only)
• false (XCF only)
VHDL
Declare as follows:
attribute ram_extract: string;
Specify as follows:
attribute ram_extract of {signal_name|entity_name} : {signal|entity} is "{yes|no}";
Verilog
Place immediately before the module declaration or instantiation:
(* ram_extract = "{yes|no}" *)
Architecture Support
Applies to all FPGA devices. Does not apply to CPLD devices.
The following are supported for Virtex®-4 devices and Virtex-5 devices only:
• block_power1
• block_power2
Applicable Elements
Applies to the entire design, or to an entity, component, module, or signal.
Propagation Rules
Applies to the entity, component, module, or signal to which it is attached.
Syntax
ram_style {auto|block|distributed}
• auto (default)
• block
• distributed
• pipe_distributed
• block_power1
• block_power2
XST looks for the best implementation for each inferred RAM.
You must use block_power1 and block_power2 in order to achieve power-oriented
BRAM optimization.
For more information, see:
Power Reduction (POWER)
The implementation style can be manually forced to use block RAM or distributed
RAM resources.
You can specify the following only through VHDL, Verilog, or XCF constraints:
• pipe_distributed
• block_power1
• block_power2
VHDL
Declare as follows:
attribute ram_style: string;
Specify as follows:
attribute ram_style of {signal_name|entity_name} : {signal|entity} is
"{auto|block|distributed|pipe_distributed|block_power1|block_power2}";
Verilog
Place immediately before the module or signal declaration:
(* ram_style =
"{auto|block|distributed|pipe_distributed|block_power1|block_power2}" *)
Architecture Support
Applies to all FPGA devices. Does not apply to CPLD devices.
Applicable Elements
Since this constraint can be used with BoxType (BOX_TYPE) the set of objects on which
the both constraints can be applied must be the same.
Apply Read Cores to:
• A component or entity (VHDL)
• A model or label (instance) (Verilog)
• A model or INST (in model) (XCF)
• The entire design (XST command line)
If Read Cores is applied to at least a single instance of a block, then Read Cores is applied
to all other instances of this block for the entire design.
Propagation Rules
Not applicable.
Syntax
-read_cores {yes|no|optimize}
• no (false)
Disables cores processing
• yes (true) (default)
Enables cores processing, but maintains the core as a black box and does not further
incorporate the core into the design
• optimize
Enables cores processing, and merges the cores netlist into the overall design. This
value is available through the XST command line mode only.
VHDL
Declare as follows:
attribute read_cores: string;
Specify as follows:
attribute read_cores of {component_name|entity_name} : {component|entity} is
"{yes|no|optimize}";
Verilog
Place immediately before the module declaration or instantiation:
(* read_cores = "{yes|no|optimize}" *)
Architecture Support
Applies to Virtex®-5 devices only. Does not apply to any other devices.
Applicable Elements
Applies to the entire design.
Propagation Rules
Not applicable.
Syntax
-reduce_control_sets {auto|no}
• auto
XST optimizes automatically, and reduces the existing control sets in the design.
• no (default)
XST performs no control set optimization.
Forward Register Balancing moves a set of flip-flops at the inputs of a LUT to a single
flip-flop at its output.
When replacing several flip-flops with one, select the name based on the name of the
LUT across which the flip-flops are moving as shown in the following:
LutName _FRBId
If applied to the input flip-flop signal, the flip-flop is not moved backward.
Architecture Support
Applies to all FPGA devices. Does not apply to CPLD devices.
Applicable Elements
Applies to:
• The entire design using the command line or ISE® Design Suite
• An entity or module
• A signal corresponding to the flip-flop description (RTL)
• A flip-flop instance
• The Primary Clock Signal
In this case the register balancing is performed only for flip-flops synchronized
by this clock.
Propagation Rules
Applies to the entity, component, module, or signal to which it is attached.
Syntax
-register_balancing {yes|no|forward|backward}
• yes
Both forward and backward retiming are allowed.
• no (default)
Neither forward nor backward retiming is allowed.
• forward
Only forward retiming is allowed
• backward
Only backward retiming is allowed.
• true (XCF only)
• false (XCF only)
VHDL
Declare as follows:
attribute register_balancing: string;
Specify as follows:
attribute register_balancing of {signal_name|entity_name}: {signal|entity} is
"{yes|no|forward|backward}";
Verilog
Place immediately before the module or signal declaration:
(* register_balancing = "{yes|no|forward|backward}" *)
Architecture Support
Applies to all FPGA devices. Does not apply to CPLD devices.
Applicable Elements
Applies to the entire design, or to an entity, component, module, or signal.
Propagation Rules
Applies to the entity or module to which it is attached.
Syntax
• yes (default)
• no
• true (XCF only)
• false (XCF only)
VHDL
Declare as follows:
attribute register_duplication: string;
Specify as follows:
attribute register_duplication of entity_name: entity is "{yes|no}";
Verilog
Place immediately before the module declaration or instantiation:
(* register_duplication = "{yes|no}" *)
Architecture Support
Applies to all FPGA devices. Does not apply to CPLD devices.
Applicable Elements
Applies to the entire design, or to a design element or signal.
Propagation Rules
Applies to the entity, component, module, or signal to which it is attached.
Syntax
-rom_extract {yes|no}
• yes (default)
• no
• true (XCF only)
• false (XCF only)
VHDL
Declare as follows:
Verilog
Place immediately before the module or signal declaration:
(* rom_extract = "{yes|no}" *)
Architecture Support
Applies to all FPGA devices. Does not apply to CPLD devices.
Applicable Elements
Applies to the entire design, or to an entity, component, module, or signal.
Propagation Rules
Applies to the entity, component, module, or signal to which it is attached.
Syntax
-rom_style {auto|block|distributed}
• auto (default)
XST looks for the best implementation for each inferred ROM. The implementation
style can be manually forced to use block ROM or distributed ROM resources.
• block
• distributed
VHDL
Declare as follows:
attribute rom_style: string;
Specify as follows:
attribute rom_style of {signal_name|entity_name} : {signal|entity} is
"{auto|block|distributed}";
Verilog
Declare as follows:
(* rom_style = "{auto|block|distributed}" *)
Architecture Support
Applies to all FPGA devices. Does not apply to CPLD devices.
Applicable Elements
Applies to the entire design, or to a design element or signal.
Propagation Rules
Applies to the entity, component, module, or signal to which it is attached.
Syntax
-shreg_extract {yes|no}
• yes (default)
• no
• true (XCF only)
• false (XCF only)
VHDL
Declare as follows:
attribute shreg_extract : string;
Specify as follows:
attribute shreg_extract of {signal_name|entity_name} : {signal|entity} is "{yes|no}";
Verilog
Place immediately before the module or signal declaration:
(* shreg_extract = "{yes|no}" *)
Architecture Support
Applies to all FPGA devices. Does not apply to CPLD devices.
Applicable Elements
Applies to the entire design, or to an entity, component, module, or signal.
Propagation Rules
Applies to the entity or module to which it is attached.
Syntax
The following sections show the syntax for this constraint.
VHDL
Declare as follows:
attribute slice_utilization_ratio: string;
Specify as follows:
attribute slice_utilization_ratio of entity_name : entity is "integer";
attribute slice_utilization_ratio of entity_name : entity is "integer%";
attribute slice_utilization_ratio of entity_name : entity is "integer#";
XST interprets the integer values in the first two examples above as a percentage and in
the last example as an absolute number of slices or FF-LUT pairs.
The integer value range is 0 to 100 when percent (%) is used or both percent (%) and
pound (#) are omitted.
Verilog
Place immediately before the module declaration or instantiation:
(* slice_utilization_ratio = "integer" *)
(* slice_utilization_ratio = "integer%" *)
(* slice_utilization_ratio = "integer#" *)
XST interprets the integer values in the first two examples above as a percentage and in
the last example as an absolute number of slices or FF-LUT pairs.
The integer value range is 0 to 100 when percent (%) is used or both percent (%) and
pound (#) are omitted.
XCF
MODEL "entity_name" slice_utilization_ratio=integer;
MODEL "entity_name" slice_utilization_ratio=integer%;
MODEL "entity_name" slice_utilization_ratio=integer#;
XST interprets the integer values in the first two examples above as a percentage and in
the last example as an absolute number of slices or FF-LUT pairs.
The integer value range is 0 to 100 when percent (%) is used or both percent (%) and
pound (#) are omitted.
There must be no space between the integer value and the percent (%) or pound (#)
characters.
You must surround the integer value and the percent (%) and pound (#) characters
with double quotes ("...") because the percent (%) and pound (#) characters are special
characters in the XST Constraint File (XCF).
Architecture Support
Applies to all FPGA devices. Does not apply to CPLD devices.
Applicable Elements
Applies to the entire design, or to an entity, component, module, or signal.
Propagation Rules
Applies to the entity or module to which it is attached.
Syntax
The following sections show the syntax for this constraint.
VHDL
Declare as follows:
attribute slice_utilization_ratio_maxmargin: string;
Specify as follows:
attribute slice_utilization_ratio_maxmargin of entity_name : entity is "integer";
attribute slice_utilization_ratio_maxmargin of entity_name : entity is "integer%";
attribute slice_utilization_ratio_maxmargin of entity_name : entity is "integer#";
XST interprets the integer values in the first two examples above as a percentage and in
the last example as an absolute number of slices or FF-LUT pairs.
The integer value range is 0 to 100 when percent (%) is used or both percent (%) and
pound (#) are omitted.
Verilog
Place immediately before the module declaration or instantiation:
(* slice_utilization_ratio_maxmargin = "integer" *)
(* slice_utilization_ratio_maxmargin = "integer%" *)
(* slice_utilization_ratio_maxmargin = "integer#" *)
XST interprets the integer values in the first two examples above as a percentage and in
the last example as an absolute number of slices or FF-LUT pairs.
The integer value range is 0 to 100 when percent (%) is used or both percent (%) and
pound (#) are omitted.
XCF
MODEL "entity_name" slice_utilization_ratio_maxmargin=integer;
MODEL "entity_name" slice_utilization_ratio_maxmargin="integer%";
MODEL "entity_name" slice_utilization_ratio_maxmargin="integer#";
XST interprets the integer values in the first two examples above as a percentage and in
the last example as an absolute number of slices or FF-LUT pairs.
The integer value range is 0 to 100 when percent (%) is used or both percent (%) and
pound (#) are omitted.
There must be no space between the integer value and the percent (%) or pound (#)
characters.
You must surround the integer value and the percent (%) and pound (#) characters
with double quotes ("...") because the percent (%) and pound (#) characters are special
characters in the XST Constraint File (XCF).
Architecture Support
Applies to all FPGA devices. Does not apply to CPLD devices.
Applicable Elements
Applies to the entire design.
Propagation Rules
Not applicable.
Syntax
-slice_packing {yes|no}
• yes
• no
Architecture Support
Applies to all FPGA devices. Does not apply to CPLD devices.
Applicable Elements
Applies to the entire design, or to signals.
Propagation Rules
Applies to the signal to which it is attached.
Syntax
-use_carry_chain {yes|no}
• yes (default)
• no
• true (XCF only)
• false (XCF only)
Schematic
• Attach to a valid instance
• Attribute Name
USE_CARRY_CHAIN
• Attribute Values
See Syntax section above.
VHDL
Declare as follows:
attribute use_carry_chain: string;
Specify as follows:
attribute use_carry_chain of signal_name: signal is "{yes|no}";
Verilog
Place immediately before the signal declaration:
(* use_carry_chain = "{yes|no}" *)
Architecture Support
Applies to all FPGA devices. Does not apply to CPLD devices.
Applicable Elements
Applies to:
• An entire design through the XST command line
• A particular block (entity, architecture, component)
• A signal representing a flip-flop
• An instance representing an instantiated flip-flop
Propagation Rules
Applies to the entity, component, module, or signal to which it is attached.
Syntax
-use_clock_enable {auto|yes|no}
• auto (default)
• yes
• no
• true (XCF only)
• false (XCF only)
VHDL
Declare as follows:
attribute use_clock_enable: string;
Specify as follows:
Verilog
Place immediately before the instance, module, or signal declaration:
(* use_clock_enable = "{auto|yes|no}" *)
Architecture Support
Applies to the following devices only. Does not apply to any other devices.
• Spartan-3A DSP
• Virtex-4
• Virtex-5
Applicable Elements
Applies to:
• An entire design through the XST command line
• A particular block (entity, architecture, component)
• A signal representing a macro described at the RTL level
Propagation Rules
Applies to the entity, component, module, or signal to which it is attached.
Syntax
-use_dsp48 {auto|yes|no}
• auto (default)
• yes
• no
• true (XCF only)
• false (XCF only)
In auto mode you can control the number of available DSP48 resources for synthesis
using DSP Utilization Ratio (DSP_UTILIZATION_RATIO). By default, XST tries to
utilize, as much as possible, all available DSP48 resources.
For more information, see:
DSP48 Block Resources
VHDL
Declare as follows:
attribute use_dsp48: string;
Specify as follows:
attribute use_dsp48 of {"entity_name|component_name|signal_name"} :
{entity|component|signal} is "{auto|yes|no}";
Verilog
Place immediately before the module or signal declaration:
(* use_dsp48 = "{auto|yes|no}" *)
Architecture Support
Applies to all FPGA devices. Does not apply to CPLD devices.
Applicable Elements
Applies to:
• An entire design through the XST command line
• A particular block (entity, architecture, component)
• A signal representing a flip-flop
• An instance representing an instantiated flip-flop
Propagation Rules
Applies to the entity, component, module, or signal to which it is attached.
Syntax
-use_sync_set {auto|yes|no}
• auto (default)
• yes
• no
• true (XCF only)
• false (XCF only)
VHDL
Declare as follows:
attribute use_sync_set: string;
Specify as follows:
attribute use_sync_set of {entity_name|component_name|signal_name|instance_name}:
{entity|component|signal|label} is "{auto|yes|no}";
Verilog
Place immediately before the module or signal declaration:
(* use_sync_set = "{auto|yes|no}" *)
Architecture Support
Applies to all FPGA devices. Does not apply to CPLD devices.
Applicable Elements
Applies to:
• An entire design through the XST command line
• A particular block (entity, architecture, component)
• A signal representing a flip-flop
• An instance representing an instantiated flip-flop
Propagation Rules
Applies to the entity, component, module, or signal to which it is attached.
Syntax
-use_sync_reset {auto|yes|no}
• auto (default)
• yes
• no
• true (XCF only)
• false (XCF only)
When XST detects Use Synchronous Reset with a value of no or false, XST avoids using
synchronous reset resources in the final implementation. For some designs, putting
synchronous reset function on data input of the flip-flop allows better logic optimization
and therefore better quality of results.
In auto mode, XST tries to estimate a trade off between using a dedicated Synchronous
Reset input on a flip-flop input and putting Synchronous Reset logic on the D input of a
flip-flop. When a flip-flop is instantiated by a designer, XST removes the synchronous
reset only if the Optimize Instantiated Primitives option is set to yes.
VHDL
Declare as follows:
attribute use_sync_reset: string;
Specify as follows:
attribute use_sync_reset of {entity_name|component_name|signal_name|instance_name}
: {entity|component|signal|label} is "{auto|yes|no}";
Verilog
Place immediately before the module or signal declaration:
(* use_sync_reset = "{auto|yes|no}" *)
Architecture Support
Applies to all FPGA devices. Does not apply to CPLD devices.
Applicable Elements
Applies to cascaded XORs.
Propagation Rules
Not applicable.
Syntax
-xor_collapse {yes|no}
• yes (default)
• no
• true (XCF only)
• false (XCF only)
VHDL
Declare as follows:
attribute xor_collapse: string;
Specify as follows:
attribute xor_collapse {signal_name|entity_name} : {signal|entity} is "{yes|no}";
Verilog
Place immediately before the module or signal declaration:
(* xor_collapse = "{yes|no}" *)
Architecture Support
Applies to all CPLD devices. Does not apply to FPGA devices.
Applicable Elements
Applies to an entire design through the XST command line.
Propagation Rules
Not applicable.
Syntax
-pld_ce {yes|no}
• yes (default)
The synthesizer implements the clock enable signal of the device.
• no
The clock enable function is implemented through equivalent logic.
Architecture Support
Applies to all CPLD devices. Does not apply to FPGA devices.
Applicable Elements
Applies to the entire design.
Propagation Rules
Not applicable.
Syntax
-pld_mp {yes|no}
• yes (default)
Macros are preserved and generated by Macro+.
• no
Macros are rejected and generated by HDL synthesizer
Depending on the Flatten Hierarchy value, a rejected macro is either merged in the
design logic, or becomes a hierarchical block as shown in the following table.
Flatten Hierarchy Value Disposition
yes Merged in the design logic
no Becomes a hierarchical block
Very small macros such as 2-bit adders and 4-bit multiplexers are always merged,
independent of the Macro Preserve or Flatten Hierarchy options.
No Reduce (NOREDUCE)
The No Reduce (NOREDUCE) constraint:
• Prevents minimization of redundant logic terms that are typically included in a
design to avoid logic hazards or race conditions.
• Identifies the output node of a combinatorial feedback loop to ensure correct
mapping.
For more information about this constraint, see the Constraints Guide.
WYSIWYG (-wysiwyg)
The WYSIWYG (-wysiwyg) command line option makes a netlist reflect the user
specification as closely as possible. That is, all the nodes declared in the Hardware
Description Language (HDL) design are preserved.
If WYSIWYG mode is enabled (yes), XST:
• Preserves all user internal signals (nodes)
• Creates SOURCE_NODE constraints in the NGC file for all these nodes
• Skips design optimization (collapse, factorization)
Architecture Support
Applies to all CPLD devices. Does not apply to FPGA devices.
Applicable Elements
Applies to an entire design through the XST command line.
Propagation Rules
Not applicable.
Syntax
• yes
• no (default)
Architecture Support
Applies to all CPLD devices. Does not apply to FPGA devices.
Applicable Elements
Applies to the entire design.
Propagation Rules
Not applicable.
Syntax
-pld_xp {yes|no}
• yes (default)
• no
yes preserves XOR macros.
no merges XOR macros with surrounded logic.
Select the following options to obtain a completely flattened design:
• Flatten Hierarchy
yes
• Macro Preserve
no
• XOR Preserve
no
The no value does not guarantee the elimination of the XOR operator from the Electronic
Data Interchange Format (EDIF) netlist. During the netlist generation, the netlist
mapper tries to recognize and infer XOR gates in order to decrease the logic complexity.
This process is independent of the XOR preservation done by Hardware Description
Language (HDL) synthesis, and is guided only by the goal of complexity reduction.
Hierarchy Separator
If you specify timing constraints in the XST Constraint File (XCF), Xilinx® recommends
that you use a forward slash (/) as a hierarchy separator instead of an underscore (_).
For more information, see:
Hierarchy Separator (-hierarchy_separator)
In that instance, XST cannot identify which input pin or internal signal is the real clock
signal. You must define it manually
Architecture Support
Applies to all FPGA devices. Does not apply to CPLD devices.
Applicable Elements
Applies to signals.
Propagation Rules
Applies to clock signals.
Syntax
• yes (default)
• no
• true (XCF only)
• false (XCF only)
VHDL
Declare as follows:
attribute clock_signal : string;
Specify as follows:
attribute clock_signal of signal_name : signal is {yes|no};
Verilog
Place immediately before the signal declaration:
(* clock_signal = "{yes|no}" *)
XCF
BEGIN MODEL "entity_name"
NET "primary_clock_signal" clock_signal={yes|no|true|false};
END;
Architecture Support
Applies to all FPGA devices. Does not apply to CPLD devices.
Applicable Elements
Applies to the entire design.
Propagation Rules
Not applicable.
Syntax
-cross_clock_analysis {yes|no}
• yes
• no (default)
From-To (FROM-TO)
The From-To (FROM-TO) constraint defines a timing constraint between two groups.
A group can be user-defined or predefined:
• FF
• PAD
• RAM
For more information about this constraint, see the Constraints Guide.
Syntax Example
TIMESPEC TSname = FROM group1 TO group2 value;
Depending on the Global Optimization Goal, XST can optimize the following design
regions:
• Register to Register
• Inpad to Register
• Register to Outpad
• Inpad to Outpad
For a detailed description of supported timing constraints, see:
Partitions
Apply the following constraints with Global Optimization Goal:
• ALLCLOCKNETS (Register to Register)
Optimizes the period of the entire design.
XST identifies, by default, all paths from register to register on the same clock for all
clocks in a design. To take inter-clock domain delays into account, set Cross Clock
Analysis (-cross_clock_analysis) to yes.
• OFFSET_IN_BEFORE (Inpad to Register)
Optimizes the maximum delay from input pad to clock, either for a specific clock
or for an entire design.
XST identifies all paths from either all sequential elements or the sequential elements
driven by the given clock signal name to all primary output ports.
• OFFSET_OUT_AFTER (Register to Outpad)
Optimizes the maximum delay from clock to output pad, either for a specific clock
or for an entire design.
XST identifies all paths from all primary input ports to either all sequential elements
or the sequential elements driven by the given clock signal name.
• INPAD_TO_OUTPAD (Inpad to Outpad)
Optimizes the maximum delay from input pad to output pad throughout an entire
design.
• MAX_DELAY
Incorporates all previously mentioned constraints
These constraints affect the entire design. They apply only if no timing constraints are
specified in the constraint file.
Syntax
-glob_opt
{allclocknets|offset_in_before|offset_out_after|inpad_to_outpad|max_delay}
You cannot specify a value for Global Optimization Goal. XST optimizes the entire
design for the best performance.
Optimizes the maximum delay from clock to output pad for the entire design
Offset (OFFSET)
The Offset (OFFSET) constraint:
• Is a basic timing constraint.
• Specifies the timing relationship between an external clock and its associated data-in
or data-out pin.
• Is used only for pad-related signals.
• Cannot be used to extend the arrival time specification method to the internal
signals in a design.
• Allows you to:
– Calculate whether a setup time is being violated at a flip-flop whose data and
clock inputs are derived from external nets.
– Specify the delay of an external output net derived from the Q output of an
internal flip-flop being clocked from an external device pin.
For more information about this constraint, see the Constraints Guide.
Syntax
OFFSET = {IN|OUT} offset_time [units] {BEFORE|AFTER} clk_name [TIMEGRP
group_name];
Period (PERIOD)
The Period (PERIOD) constraint is a basic timing constraint and synthesis constraint.
A clock period specification checks timing between all synchronous elements within the
clock domain as defined in the destination element group. The group may contain paths
that pass between clock domains if the clocks are defined as a function of one or the other.
For more information about this constraint, see the Constraints Guide.
Syntax
NET netname PERIOD = value [{HIGH|LOW} value];
Syntax
{INST|NET|PIN} inst_net_or_pin_name TNM = [predefined_group:] identifier;
Syntax
NET netname TNM_NET = [predefined_group:] identifier;
Timegroup (TIMEGRP)
The Timegroup (TIMEGRP) constraint is a basic grouping constraint.
In addition to naming groups using the TNM identifier, you can also define groups in
terms of other groups. You can create a group that is a combination of existing groups
by defining a Timegroup constraint.
Syntax
TIMEGRP newgroup = existing_grp1 existing_grp2 [existing_grp3 ...];
Syntax
NET net_name TIG;
Architecture Support
Architecture independent.
Applicable Elements
Applies to an entire design through the XST command line.
Propagation Rules
Not applicable.
Syntax
-write_timing_constraints {yes|no}
• yes (default)
• no
Method One
MODEL EntityName PropertyName;
Method Two
MODEL EntityName PropertyName=PropertyValue;
Method One
BEGIN MODEL EntityName {NET|INST|PIN} {NetName|InstName|SigName}
PropertyName;
END;
Method Two
BEGIN MODEL EntityName {NET|INST|PIN} {NetName|InstName|SigName}
PropertyName=Propertyvalue;
END;
No Reduce (NOREDUCE)
Applies to all CPLD devices. Does not apply to FPGA devices.
No Reduce (NOREDUCE) prevents the optimization of the Boolean equation generating
a given signal. Assuming a local signal is assigned the arbitrary function below, and No
Reduce attached to the signal s:
signal s : std_logic;
attribute NOREDUCE : boolean;
attribute NOREDUCE of s : signal is "true";
...
s <= a or (a and b);
Specify No Reduce in the XST Constraint File (XCF) as follows:
BEGIN MODEL ENTNAME
NET s NOREDUCE;
NET s KEEP;
END;
XST writes the following statements to the NGC file:
NET s NOREDUCE;
NET s KEEP;
For more information, see the Constraints Guide.
Architecture Support
Applies to all CPLD devices. Does not apply to FPGA devices.
XCF
MODEL ENTNAME
NET s PWR_MODE=LOW;
NET s KEEP;
END;
RLOC (RLOC)
See:
RLOC (RLOC)
Automatic
Name Vendor XST Equivalent Recognition Available For
resource_sharing Synopsys Resource Sharing N/A VHDL, Verilog
directives
set_dont_touch_networkSynopsys not required N/A N/A
set_dont_touch Synopsys not required N/A N/A
set_dont_use_cel_name Synopsys not required N/A N/A
set_prefer Synopsys N/A N/A N/A
state_vector Synopsys N/A N/A N/A
syn_allow_retiming Synopsys Register Balancing N/A VHDL, Verilog
syn_black_box Synopsys BoxType Yes VHDL, Verilog
syn_direct_enable Synopsys N/A N/A N/A
syn_edif_bit_format Synopsys N/A N/A N/A
syn_edif_scalar_format Synopsys N/A N/A N/A
syn_encoding Synopsys FSM Encoding Yes (The value safe VHDL, Verilog
Algorithm is not supported
for automatic
recognition. Use
Safe Implementation
in XST to activate this
mode.)
syn_enum_encoding Synopsys Enumerated Encoding N/A VHDL
syn_hier Synopsys Keep Hierarchy Yes VHDL, Verilog
syn_hier =
hardrecognized
askeep_hierarchy =
soft
syn_hier =
removerecognized
askeep_hierarchy = no
(XST supports only
the values hard
and remove for
syn_hier in automatic
recognition.)
syn_isclock Synopsys N/A N/A N/A
syn_keep Synopsys Keep Yes (XST preserves the VHDL, Verilog
designated net in the
final netlist, but does
not attach any KEEP
constraint to it.)
syn_maxfan Synopsys Max Fanout Yes VHDL, Verilog
syn_netlist_hierarchy Synopsys Netlist Hierarchy N/A VHDL, Verilog
syn_noarrayports Synopsys N/A N/A N/A
syn_noclockbuf Synopsys Buffer Type Yes VHDL, Verilog
syn_noprune Synopsys Optimize Instantiated Yes VHDL, Verilog
Primitives
Automatic
Name Vendor XST Equivalent Recognition Available For
syn_pipeline Synopsys Register Balancing N/A VHDL, Verilog
syn_preserve Synopsys Equivalent Register Yes VHDL, Verilog
Removal
syn_ramstyle Synopsys ram_extract and Yes VHDL, Verilog
ram_style
XST implements
RAMs in
no_rw_check
mode regardless
if no_rw_check is
specified or not
the area value is
ignored
syn_reference_clock Synopsys N/A N/A N/A
syn_replicate Synopsys Register Duplication Yes VHDL, Verilog
syn_romstyle Synopsys rom_extract and Yes VHDL, Verilog
rom_style
syn_sharing Synopsys N/A N/A VHDL, Verilog
syn_state_machine Synopsys Automatic FSM Yes VHDL, Verilog
Extraction
syn_tco <n> Synopsys N/A N/A N/A
syn_tpd <n> Synopsys N/A N/A N/A
syn_tristate Synopsys N/A N/A N/A
syn_tristatetomux Synopsys N/A N/A N/A
syn_tsu <n> Synopsys N/A N/A N/A
syn_useenables Synopsys N/A N/A N/A
syn_useioff Synopsys Pack I/O Registers Into N/A VHDL, Verilog
IOBs
synthesis translate_off Synopsys Translate Off Yes VHDL, Verilog
synthesis translate_on Translate On
xc_alias Synopsys N/A N/A N/A
xc_clockbuftype Synopsys Buffer Type N/A VHDL, Verilog
xc_fast Synopsys FAST N/A VHDL, Verilog
xc_fast_auto Synopsys FAST N/A VHDL, Verilog
xc_global_buffers Synopsys BUFG (XST) N/A VHDL, Verilog
xc_ioff Synopsys Pack I/O Registers Into N/A VHDL, Verilog
IOBs
xc_isgsr Synopsys N/A N/A N/A
xc_loc Synopsys LOC Yes VHDL, Verilog
xc_map Synopsys LUT_MAP Yes (XST supports VHDL, Verilog
only the value
lut for automatic
recognition.)
xc_ncf_auto_relax Synopsys N/A N/A N/A
Automatic
Name Vendor XST Equivalent Recognition Available For
xc_nodelay Synopsys NODELAY N/A VHDL, Verilog
xc_padtype Synopsys I/O Standard N/A VHDL, Verilog
xc_props Synopsys N/A N/A N/A
xc_pullup Synopsys PULLUP N/A VHDL, Verilog
xc_rloc Synopsys RLOC Yes VHDL, Verilog
xc_fast Synopsys FAST N/A VHDL, Verilog
xc_slow Synopsys N/A N/A N/A
xc_uset Synopsys U_SET Yes VHDL, Verilog
you to concentrate on more strategic design decisions, and reduce the overall time to
market for the design.
For more information, see:
• IEEE VHDL Language Reference Manual
• XST Design Constraints
• VHDL Attribute Syntax
Function Package
read (line, character) std.textio
read (line, string, boolean) std.textio
read (line, string) std.textio
write (file, line) std.textio
write (line, bit, boolean) std.textio
write (line, bit) std.textio
write (line, bit_vector, boolean) std.textio
write (line, bit_vector) std.textio
write (line, boolean, boolean) std.textio
write (line, boolean) std.textio
write (line, character, boolean) std.textio
write (line, character) std.textio
write (line, integer, boolean) std.textio
write (line, integer) std.textio
write (line, string, boolean) std.textio
write (line, string) std.textio
read (line, std_ulogic, boolean) ieee.std_logic_textio
read (line, std_ulogic) ieee.std_logic_textio
read (line, std_ulogic_vector), boolean ieee.std_logic_textio
read (line, std_ulogic_vector) ieee.std_logic_textio
read (line, std_logic_vector, boolean) ieee.std_logic_textio
read (line, std_logic_vector) ieee.std_logic_textio
write (line, std_ulogic, boolean) ieee.std_logic_textio
write (line, std_ulogic) ieee.std_logic_textio
write (line, std_ulogic_vector, boolean) ieee.std_logic_textio
write (line, std_ulogic_vector) ieee.std_logic_textio
write (line, std_logic_vector, boolean) ieee.std_logic_textio
write (line, std_logic_vector) ieee.std_logic_textio
hread ieee.std_logic_textio
Coding Example
--
-- Print 2 constants to the output file
--
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_arith.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
use STD.TEXTIO.all;
use IEEE.STD_LOGIC_TEXTIO.all;
entity file_support_1 is
generic (data_width: integer:= 4);
port( clk, sel: in std_logic;
din: in std_logic_vector (data_width - 1 downto 0);
dout: out std_logic_vector (data_width - 1 downto 0));
end file_support_1;
process(clk)
variable txtline : LINE;
begin
write(txtline,string’("--------------------"));
writeline(results, txtline);
write(txtline,string’("Base Const: "));
write(txtline,base_const);
writeline(results, txtline);
end Behavioral;
("00100000","00100001","00101010","10100011","00101100"),
("01000010","01000010","01000100","01000111","01000100"));
Coding Example
type REC1 is record
field1: std_logic;
field2: std_logic_vector (3 downto 0)
end record;
Initializing Registers
In VHDL, you can initialize registers when you declare them.
The value:
• Is a constant
• Cannot depend on earlier initial values
• Cannot be a function or task call
• Can be a parameter value propagated to a register
entity top is
Port (
clk, rst : in std_logic;
a_in : in std_logic;
dout : out std_logic);
end top;
architecture Behavioral of top is
signal arb_onebit : std_logic := ’1’;
begin
process (clk, rst)
begin
if rst=’1’ then
arb_onebit <= ’0’;
elsif (clk’event and clk=’1’) then
arb_onebit <= a_in;
end if;
end process;
Unconnected output ports default to the values shown in the XST column of VHDL
Initial Values. If the output port has an initial condition, XST ties the unconnected
output port to the explicitly defined initial condition. According to the IEEE VHDL
specification, input ports cannot be left unconnected. As a result, XST issues an error
message if an input port is not connected. Even the open keyword is not sufficient
for an unconnected input port.
VHDL Objects
This section discusses VHDL Objects, and include:
• Signals in VHDL
• Variables in VHDL
• Constants in VHDL
Signals in VHDL
Signals in VHDL can be:
• Declared in an architecture declarative part.
• Used anywhere within the architecture.
• Declared in a block.
• Used within that block.
• Assigned by the assignment operator <=.
Coding Example
signal sig1 : std_logic; sig1 <= ’1’;
Variables in VHDL
Variables in VHDL:
• Are declared in a process or a subprogram.
• Are used within that process or that subprogram.
• Can be assigned by the assignment operator:
:=
Coding Example
variable var1 : std_logic_vector (7 downto 0); var1 := "01010011";
Constants in VHDL
Constants in VHDL:
• Can be declared in any declarative region.
• Can be used within that region.
• Cannot have their values be changed once declared.
Coding Example
signal sig1 : std_logic_vector (5 downto 0);
constant init0 : std_logic_vector (5 downto 0) := "010111";
sig1 <= init0;
VHDL Operators
Supported operators are listed in VHDL Expressions. This section provides coding
examples for each shift operator.
Coding Example
Library IEEE;
use IEEE.std_logic_1164.all;
entity EXAMPLE is
port (
A,B,C : in std_logic;
D,E : out std_logic );
end EXAMPLE;
Coding Example
The following coding example shows the structural description of a half adder
composed of four nand2 components:
entity NAND2 is
port (
A,B : in BIT;
Y : out BIT );
end NAND2;
entity HALFADDER is
port (
X,Y : in BIT;
C,S : out BIT );
end HALFADDER;
entity single_stage is
generic (sh_st: integer:=4);
port (
CLK : in std_logic;
DI : in std_logic;
DO : out std_logic );
end entity single_stage;
begin
GEN_FD_LAST: if sh_st=1 generate
inst_fd: FD port map (D=>DI, C=>CLK, Q=>DO);
end generate;
GEN_FD_INTERM: if sh_st /= 1 generate
inst_fd: FD port map (D=>DI, C=>CLK, Q=>tmp);
inst_sstage: single_stage generic map (sh_st => sh_st-1)
port map (DI=>tmp, CLK=>CLK, DO=>DO);
end generate;
end recursive;
Coding Example
The following coding example shows how to use a configuration clause for component
instantiation. The example contains a for all statement.
for all : NAND2 use entity work.NAND2(ARCHI);
This statement indicates that all NAND2 components use the entity NAND2 and
Architecture ARCHI.
When the configuration clause is missing for a component instantiation, XST links the
component to the entity with the same name (and same interface) and the selected
architecture to the most recently compiled architecture. If no entity or architecture is
found, a black box is generated during synthesis.
In command line mode, you may also use a dedicated configuration declaration to link
component instantiations in your design to design entities and architectures. In this case,
the value of the mandatory Top Module Name (-top) option in the run command is the
configuration name instead of the top level entity name.
Coding Example
By describing circuits with generic ports, the same component can be instantiated
repeatedly with different values of generic ports as shown in the following coding
example.
Library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_unsigned.all;
entity addern is
generic (width : integer := 8);
port (
A,B : in std_logic_vector (width-1 downto 0);
Y : out std_logic_vector (width-1 downto 0) );
end addern;
Library IEEE;
use IEEE.std_logic_1164.all;
entity top is
port (
X, Y, Z : in std_logic_vector (12 downto 0);
A, B : in std_logic_vector (4 downto 0);
Precedence in VHDL
Generic on an Instance Generic on a Component
Attribute on an Instance Apply Generic (XST issues Apply Attribute (possible
warning) simulation mismatch)
Attribute on a Component Apply Generic Apply Generic (XST issues
warning)
Attribute in XCF Apply Attribute XST issues Apply Attribute
warning)
Security attributes on the block definition always have higher precedence than any
other attribute or generic.
entity select_bhv is
generic (width: integer := 8);
port (
a, b, c, d : in std_logic_vector (width-1 downto 0);
selector : in std_logic_vector (1 downto 0);
T : out std_logic_vector (width-1 downto 0) );
end select_bhv;
entity ADDSUB is
port (
A,B : in BIT_VECTOR (3 downto 0);
ADD_SUB : in BIT;
S : out BIT_VECTOR (3 downto 0) );
end ADDSUB;
Coding Example
library IEEE;
use IEEE.std_logic_1164.all;
entity mux4 is
port (
a, b, c, d : in std_logic_vector (7 downto 0);
sel1, sel2 : in std_logic;
outmux : out std_logic_vector (7 downto 0));
end mux4;
end if;
else
if (sel2 = ’1’) then
outmux <= c;
else
outmux <= d;
end if;
end if;
end process;
end behavior;
entity mux4 is
port (
a, b, c, d : in std_logic_vector (7 downto 0);
sel : in std_logic_vector (1 downto 0);
outmux : out std_logic_vector (7 downto 0));
end mux4;
architecture behavior of mux4 is
begin
process (a, b, c, d, sel)
begin
case sel is
when "00" => outmux <= a;
when "01" => outmux <= b;
when "10" => outmux <= c;
when others => outmux <= d; -- case statement
-- must be complete
end case;
end process;
end behavior;
entity countzeros is
port (
a : in std_logic_vector (7 downto 0);
Count : out std_logic_vector (2 downto 0) );
end mux4;
Coding Example
Declare asynchronous signals in the sensitivity list. Otherwise, XST issues a warning
and adds them to the sensitivity list. In this case, the behavior of the synthesis result
may be different from the initial specification.
process (CLK, RST) ...
begin
if RST = <’0’ | ’1’> then
-- an asynchronous part may appear here
-- optional part
.......
elsif <CLK’EVENT | not CLK’STABLE>
and CLK = <’0’ | ’1’> then
-- synchronous part
-- sequential statements may appear here
end if;
end process;
process ...
begin
wait until <CLK’EVENT | not CLK’ STABLE> and CLK = <’0’ | ’1’>;
... -- a synchronous part may be specified here.
end process;
XST does not support clock and clock enable descriptions within the same Wait
statement. Instead, code these descriptions as shown in Clock and Clock Enable (Supported)
VHDL Coding Example.
XST does not support Wait statements for latch descriptions.
8-Bit Register With Clock Signal and Asynchronous Reset Signal VHDL
Coding Example
entity EXAMPLE is
port (
DI : in BIT_VECTOR (7 downto 0);
CLK : in BIT;
RST : in BIT;
DO : out BIT_VECTOR (7 downto 0));
end EXAMPLE;
entity EXAMPLE is
port (
CLK : in BIT;
RST : in BIT;
DO : out BIT_VECTOR (7 downto 0));
end EXAMPLE;
Coding Example
The following VHDL coding example uses multiple wait statements. This example
describes a sequential circuit performing four different operations in sequence.
The design cycle is delimited by two successive rising edges of the clock signal. A
synchronous reset is defined providing a way to restart the sequence of operations at
the beginning. The sequence of operations consists of assigning each of the following
four inputs to the output RESULT:
• DATA1
• DATA2
• DATA3
• DATA4
library IEEE;
use IEEE.STD_LOGIC_1164.all;
entity EXAMPLE is
port (
DATA1, DATA2, DATA3, DATA4 : in STD_LOGIC_VECTOR (3 downto 0);
RESULT : out STD_LOGIC_VECTOR (3 downto 0);
CLK : in STD_LOGIC;
RST : in STD_LOGIC );
end EXAMPLE;
use work.PKG.all;
entity EXAMPLE is
port (
A,B : in BIT_VECTOR (3 downto 0);
CIN : in BIT;
S : out BIT_VECTOR (3 downto 0);
COUT : out BIT );
end EXAMPLE;
use work.PKG.all;
entity EXAMPLE is
port (
A,B : in BIT_VECTOR (3 downto 0);
CIN : in BIT;
S : out BIT_VECTOR (3 downto 0);
COUT : out BIT );
end EXAMPLE;
Coding Example
The following coding example contains a block SINGLE_SRL which describes a shift
register. The size of the shift register depends on the SRL_WIDTH generic value. The
Assert statement ensures that the implementation of a single shift register does not
exceed the size of a single Shift Register LUT (SRL).
Since the size of the SRL is 16 bit, and XST implements the last stage of the shift register
using a flip-flop in a slice, then the maximum size of the shift register cannot exceed 17
bits. The SINGLE_SRL block is instantiated twice in the entity named TOP:
• first with SRL_WIDTH equal to 13
• second with SRL_WIDTH equal to 18
library ieee;
use ieee.std_logic_1164.all;
entity SINGLE_SRL is
generic (SRL_WIDTH : integer := 16);
port (
clk : in std_logic;
inp : in std_logic;
outp : out std_logic);
end SINGLE_SRL;
process (clk)
begin
if (clk’event and clk = ’1’) then
shift_reg <= shift_reg (SRL_WIDTH-1 downto 1) & inp;
end if;
end process;
outp <= shift_reg(SRL_WIDTH-1);
end beh;
library ieee;
use ieee.std_logic_1164.all;
entity TOP is
port (
clk : in std_logic;
inp1, inp2 : in std_logic;
outp1, outp2 : out std_logic);
end TOP;
Error Message
If you run the coding example above, XST issues the following error message:
...
================================================================
* HDL Analysis *
================================================================
Analyzing Entity <top> (Architecture <beh>).
Entity <top> analyzed. Unit <top> generated.
Functions and procedures in the math_real packages, as well as the real type, are for
calculations only. They are not supported for synthesis in XST.
Coding Example
library ieee;
use IEEE.std_logic_signed.all;
signal a, b, c : std_logic_vector (5 downto 0);
c <= a + b;
-- this operator "+" is defined in package std_logic_signed.
-- Operands are converted to signed vectors, and function "+"
-- defined in package std_logic_arith is called with signed
-- operands.
VHDL Packages
STANDARD
Type TIME is not supported
VHDL Modes
Linkage
Unsupported
VHDL Declarations
Type
Supported for:
– enumerated types
– types with positive range having constant bounds
– bit vector types
– multi-dimensional arrays
VHDL Objects
• Constant Declaration
Supported except for deferred constant
• Signal Declaration
Supported except for register and bus type signals
• Attribute Declaration
Supported for some attributes, otherwise skipped
For more information, see:
XST Design Constraints
VHDL Specifications
• Attribute
Supported for some predefined attributes only:
– HIGH
– LOW
– LEFT
– RIGHT
– RANGE
– REVERSE_RANGE
– LENGTH
– POS
– ASCENDING
– EVENT
– LAST_VALUE
• Configuration
Supported only with the all clause for instances list. If no clause is added, XST looks
for the entity or architecture compiled in the default library
• Disconnection
Unsupported
VHDL Expressions
XST supports the following expressions:
• VHDL Operators
• VHDL Operands
VHDL Operators
Operator Supported/Unsupported
Logical Operators: Supported
and, or, nand, nor, xor, xnor, not
Relational Operators: Supported
=, /=, <, <=, >, >=
& (concatenation) Supported
Adding Operators: +, - Supported
* Supported
/,rem Supported if the right operand is a constant power of 2
mod Supported if the right operand is a constant power of 2
Shift Operators: Supported
sll, srl, sla, sra, rol, ror
abs Supported
** Only supported if the left operand is 2
Sign: +, - Supported
VHDL Operands
Operand Supported/Unsupported
Abstract Literals Only integer literals are supported
Physical Literals Ignored
Enumeration Literals Supported
String Literals Supported
Bit String Literals Supported
Record Aggregates Supported
Array Aggregates Supported
Function Call Supported
Qualified Expressions Supported for accepted predefined attributes
Types Conversions Supported
Allocators Unsupported
Static Expressions Supported
VHDL Statements
XST supports all VHDL statements except as shown in the following sections:
• VHDL Wait Statements
• VHDL Loop Statements
• VHDL Concurrent Statements
guarded if impure in
inertial inout is label
library linkage literal loop
map mod nand new
next nor not null
of on open or
The Verilog support in XST provides an efficient way to describe both the global circuit
and each block according to the most efficient style. Synthesis is then performed with
the best synthesis flow for each block. Synthesis in this context is the compilation of
high-level behavioral and structural Verilog Hardware Description Language (HDL)
statements into a flattened gate-level netlist, which can then be used to custom program
a programmable logic device such as a Virtex® device. Different synthesis methods are
used for arithmetic blocks, glue logic, and Finite State Machine (FSM) components.
The XST User Guide for Virtex-4, Virtex-5, Spartan-3, and Newer CPLD Devices assumes that
you are familiar with basic Verilog concepts.
For more information, see:
• Verilog design constraints and options
XST Design Constraints
• Verilog attribute syntax
Verilog-2001 Attributes
• Setting Verilog options in the Process window of ISE® Design Suite
XST General Constraints
• General Verilog information
IEEE Verilog HDL Reference Manual
Behavioral Verilog
For information about Behavioral Verilog, see:
XST Behavioral Verilog Language Support
Coding Example
reg [3:0] data;
reg [3:0] select; // a value from 0 to 7
wire [7:0] byte = data[select +: 8];
(* BOX_TYPE="PRIMITIVE" *) // Verilog-2001
module FDC (Q, C, CLR, D);
parameter INIT = 1’b0;
output Q;
input C;
input CLR;
input D;
endmodule
(* BOX_TYPE="PRIMITIVE" *) // Verilog-2001
module BUFG ( O, I);
output O;
input I;
endmodule
Verilog Parameters
Verilog modules allow you to define constants known as parameters. Parameters can be
passed to module instances to define circuits of arbitrary widths. Parameters form the
basis of creating and using parameterized blocks in a design to achieve hierarchy.
Coding Example
The following Verilog coding example shows the use of parameters. Null string
parameters are not supported.
module lpm_reg (out, in, en, reset, clk);
parameter SIZE = 1;
input in, en, reset, clk;
output out;
wire [SIZE-1 : 0] in;
reg [SIZE-1 : 0] out;
always @(posedge clk or negedge reset)
begin
if (!reset)
out <= 1’b0;
else
if (en)
out <= in;
else
out <= out; //redundant assignment
end
endmodule
module top (); //portlist left blank intentionally
...
wire [7:0] sys_in, sys_out;
wire sys_en, sys_reset, sysclk;
lpm_reg #8 buf_373 (sys_out, sys_in, sys_en, sys_reset, sysclk);
...
endmodule
Instantiation of the module lpm_reg with a instantiation width of 8 causes the instance
buf_373 to be 8 bits wide.
The Generics (-generics) command line option allows you to redefine parameters
(Verilog) values defined in the top-level design block. This allows you to easily modify
the design configuration without any Hardware Description Language (HDL) source
modifications, such as for IP core generation and testing flows.
Security attributes on the module definition always have higher precedence than any
other attribute or parameter.
In the following coding example, the case item expression 4 is an unsized integer that
causes unpredictable results. To avoid problems, size the 4 to 3 bits as follows:
reg [2:0] condition1;
always @(condition1)
begin
case(condition1)
4 : data_out = 2; // < will generate bad logic
3’d4 : data_out = 2; // < will work
endcase
end
Verilog-2001 Attributes
XST supports Verilog-2001 attribute statements. Attributes are comments that pass
specific information to software tools such as synthesis tools. Verilog-2001 attributes
can be specified anywhere for operators or signals within module declarations and
instantiations. Other attribute declarations may be supported by the compiler, but
are ignored by XST.
Supported Constraints
XST supports the following constraints:
• Translate Off (TRANSLATE_OFF) and Translate On (TRANSLATE_ON)
// synthesis translate_on
// synthesis translate_off
• Parallel Case (PARALLEL_CASE)
// synthesis parallel_case full_case
// synthesis parallel_case
// synthesis full_case
• Constraints on individual objects
Syntax
// synthesis attribute [of] ObjectName [is] AttributeValue
Coding Example
// synthesis attribute RLOC of u123 is R11C1.S0
// synthesis attribute HUSET u1 MY_SET
// synthesis attribute fsm_extract of State2 is "yes"
// synthesis attribute fsm_encoding of State2 is "gray"
• release
Unsupported
• forever statements
Unsupported
• repeat statements
Supported, but repeat value must be constant
• for statements
Supported, but bounds must be static
• delay (#)
Ignored
• event (@)
Unsupported
• wait
Unsupported
• Named Events
Unsupported
• Parallel Blocks
Unsupported
• Specify Blocks
Ignored
• Disable
Supported except in For and Repeat Loop statements.
Verilog Primitives
This section discusses Verilog Primitives, and includes:
• Supported Primitives
• Unsupported Primitives
• Syntax
Supported Primitives
XST supports the following Verilog gate-level primitives except as indicated:
• Pulldown and Pullup
Unsupported
• Drive strength and delay
Ignored
• Arrays of primitives
Unsupported
Unsupported Primitives
XST does not support:
• Verilog switch-level primitives, such as:
– cmos, nmos, pmos, rcmos, rnmos, rpmos
– rtran, rtranif0, rtranif1, tran, tranif0, tranif1
• Verilog user-defined primitives
Syntax
gate_type instance_name (output, inputs,...);
Coding Example
and U1 (out, in1, in2); bufif1 U2 (triout, data, trienable);
Variables in Verilog
Data Type Variable Given Default Width Verilog-2001
Value In
reg procedural block one bit (scalar) signed or unsigned
wire continuous one bit (scalar) signed or unsigned
assignment
Coding Example
To specify an N-bit width (vectors) for a declared reg or wire, the left and right bit
positions are defined in square brackets separated by a colon.
reg [3:0] arb_priority;
wire [31:0] arb_request;
wire signed [8:0] arb_signed;
where
• arb_request[31] is the MSB
• arb_request[0] is the LSB
Coding Example
module mult(clk, rst, A_IN, B_OUT);
input clk,rst,A_IN;
output B_OUT;
Coding Example
The following Behavioral Verilog coding example shows sample Verilog data types
found in the declaration section of a Verilog module.
wire net1; // single bit net
reg r1; // single bit register
tri [7:0] bus1; // 8 bit tristate bus
reg [15:0] bus1; // 15 bit register
reg [7:0] mem[0:127]; // 8x128 memory register
parameter state1 = 3’b001; // 3 bit constant
parameter component = "TMS380C16"; // string
** || <=
/ ^ >=
% ~ >=
~^ !=
^~ !==
<< >
>>
<<<
>>>
Coding Example
module EXAMPLE (A, B, C, D, E);
input A, B, C;
output D;
inout E;
wire D, E;
...
assign E = oe ? A : 1’bz;
assign D = B & E;
...
endmodule
Coding Example
The following coding example shows how a MUX can be described using an if... else
statement:
module mux4 (sel, a, b, c, d, outmux);
input [1:0] sel;
input [1:0] a, b, c, d;
output [1:0] outmux;
reg [1:0] outmux;
always @(sel or a or b or c or d)
begin
if (sel[1])
if (sel[0])
outmux = d;
else
outmux = c;
else
if (sel[0])
outmux = b;
else
outmux = a;
end
endmodule
The question mark (?) can be used as a dont care in either the casez or casex case
statements.
Coding Example
The following coding example shows how a MUX can be described using a case
statement:
module mux4 (sel, a, b, c, d, outmux);
input [1:0] sel;
input [1:0] a, b, c, d;
output [1:0] outmux;
reg [1:0] outmux;
always @(sel or a or b or c or d)
begin
case (sel)
2’b00: outmux = a;
2’b01: outmux = b;
2’b10: outmux = c;
default: outmux = d;
endcase
end
endmodule
The preceding case statement evaluates the values of the input sel in priority order. To
avoid priority processing, Xilinx® recommends that you use a parallel-case Verilog
attribute to ensure parallel evaluation of the sel inputs as shown in the following:
(* parallel_case *) case(sel)
For Statement
The for statement is supported for:
• Constant bounds
• Stop test condition using one of the following operators:
– <
– <=
– >
– >=
• Next step computation falling in one of the following specifications:
– var = var + step
– var = var - step
where
♦ var is the loop variable
♦ step is a constant value
Repeat Statement
The repeat statement is supported for constant values only.
Disable Statements
Disable statements are not supported.
Coding Example
module countzeros (a, Count);
input [7:0] a;
output [2:0] Count;
reg [2:0] Count;
reg [2:0] Count_Aux;
integer i;
always @(a)
begin
Count_Aux = 3’b0;
for (i = 0; i < 8; i = i+1)
begin
if (!a[i])
Count_Aux = Count_Aux+1;
end
Count = Count_Aux;
end
endmodule
Coding Example
parameter P = 4;
always @(ID_complete)
begin : UNIDENTIFIED
integer i;
reg found;
unidentified = 0;
i = 0;
found = 0;
while (!found && (i < P))
begin
found = !ID_complete[i];
unidentified[i] = !ID_complete[i];
i = i + 1;
end
end
always @ (RST)
if(RST)
begin
assign STATE = 4’b0;
end
else
begin
deassign STATE;
end
reg STATE;
COUT = S3[1];
endmodule
task ADD;
input A, B, CIN;
output [1:0] C;
reg [1:0] C;
reg S, COUT;
begin
S = A ^ B ^ CIN;
COUT = (A&B) | (A&CIN) | (B&CIN);
C = {COUT, S};
end
endtask
Coding Example
function automatic [31:0] fac;
input [15:0] n;
if (n == 1)
fac = 1;
else
fac = n * fac(n-1); //recursive function call
endfunction
Coding Example
endmodule
Coding Example
The following coding example shows how to use a non-blocking procedural assignment.
if (in1) out <= 1’b1; else out <= in2;
Coding Example
‘timescale 1 ns/1 ps
‘include "modules.v"
...
XST issues an error message:
ERROR:Xst:1068 - fifo.v, line 2. Duplicate declarations of
module’RAMB4_S8_S8’
Coding Example
Following is an 8-bit adder using a generate for loop behavioral Verilog coding example.
generate
genvar i;
Coding Example
In the following coding example of a generate if... else statement:
• generate controls the type of multiplier that is instantiated
• The contents of each branch of the if... else statement are enclosed by begin and
end statements.
• The begin statement is named with a unique qualifier.
generate
if (IF_WIDTH < 10)
begin : if_name
adder # (IF_WIDTH) u1 (a, b, sum_if);
end
else
begin : else_name
subtractor # (IF_WIDTH) u2 (a, b, sum_if);
end
endgenerate
Coding Example
In the following coding example of a generate case statement, generate controls the
type of adder that is instantiated:
generate
case (WIDTH)
1:
begin : case1_name
adder #(WIDTH*8) x1 (a, b, ci, sum_case, c0_case);
end
2:
begin : case2_name
adder #(WIDTH*4) x2 (a, b, ci, sum_case, c0_case);
end
default:
begin : d_case_name
adder x3 (a, b, ci, sum_case, c0_case);
end
endcase
endgenerate
The VHDL and Verilog formats can be used for existing designs.
The syntax for invoking a library or any external file in a mixed language project is:
language library file_name.ext
Coding Example
The following example shows how to invoke libraries in a mixed language project.
vhdl work my_vhdl1.vhd
verilog work my_vlg1.v
vhdl my_vhdl_lib my_vhdl2.vhd
verilog my_vlg_lib my_vlg2.v
• Each row specifies a single Hardware Description Language (HDL) design file.
• Each column has the meaning shown in the following table.
Column Syntax Example Specifies
First language vhdl Whether the HDL file
is VHDL or Verilog
Second library work The logic library
where the HDL is
compiled. The default
logic library is work.
Third file_name.ext my_vhdl1.vhd The name of the HDL
file.
The only VHDL construct that can be instantiated in a Verilog design is a VHDL entity.
No other VHDL constructs are visible to Verilog code. When you do this, XST uses the
entity/architecture pair as the Verilog/VHDL boundary.
Binding
XST performs the binding during elaboration.
XST first:
1. Searches for a Verilog module as follows:
• Uses the name of the instantiated module.
• Searches in the user-specified list of unified logical libraries.
• Searches in the user-specified order.
• Ignores any architecture name specified in the module instantiation.
2. Binds the name if found.
If XST cannot find a Verilog module, then XST:
1. Treats the name of the instantiated module as a VHDL entity.
2. Searches for the VHDL entity as follows:
• Performs a case sensitive search
• Searches in the user-specified list of unified logical libraries
• Searches in the user-specified order
Note This assumes that a VHDL design unit was stored with an extended identifier.
3. Selects the first VHDL entity matching the name.
4. Binds the entity.
For more information, see:
Library Search Order (LSO) Files in Mixed Language Projects
Limitations
XST has the following limitations when instantiating a VHDL design unit from a Verilog
module:
• Use explicit port association. Specify formal and effective port names in the port
map.
• All parameters are passed at instantiation, even if they are unchanged.
• The parameter override is named and not ordered. The parameter override occurs
through instantiation, and not through defparams.
LSO Rules
When processing a mixed language project, XST obeys the following search order rules,
depending on the contents of the Library Search Order (LSO) file:
• Library Search Order (LSO) Empty
• DEFAULT_SEARCH_ORDER Keyword Only
• DEFAULT_SEARCH_ORDER Keyword and List of Libraries
• List of Libraries Only
• DEFAULT_SEARCH_ORDER Keyword and Non-Existent Library Name”
Copyright Statement
The XST FPGA log file copyright statement contains:
• ISE® Design Suite release number
• Xilinx® notice of copyright
Table of Contents
The XST FPGA log file table of contents lists the major sections in the log file. These
headings are not linked. Use the Find function in your text editor.
HDL Compilation
For information on Hardware Description Language (HDL) Compilation, see:
XST FPGA Log File HDL Analysis
HDL Analysis
During Hardware Description Language (HDL) Compilation, Design Hierarchy
Analyzer, and HDL Analysis, XST:
• Parses and analyzes VHDL and Verilog files
• Recognizes the design hierarchy
• Gives the names of the libraries into which they are compiled
During this step, XST may report:
• Potential mismatches between synthesis and simulation results
• Potential multi-sources
• Other issues
Partition Report
If the design is partitioned, the XST FPGA log file Partition Report contains information
detailing the design partitions.
Final Report
The XST FPGA log file Final Report includes:
• Final Results, including
– RTL Top Level Output File Name (for example, stopwatch.ngr)
– Top Level Output File Name (for example, stopwatch)
– Output Format (for example, NGC)
– Optimization Goal (for example, Speed)
– Whether the Keep Hierarchy constraint is used (for example, No)
• Cell usage
Cell usage reports on, for example, the number and type of BELS, Clock Buffers,
and IO Buffers.
• Device Utilization Summary
The Device Utilization Summary estimates the number of slices, and gives, for
example, the number of flip-flops, IOBs, and BRAMS. The Device Utilization
Summary closely approximates the report produced by MAP.
• Partition Resource Summary
The Partition Resource Summary estimates the number of slices, and gives, for
example, the number of flip-flops, IOBs, and BRAMS for each partition. The
Partition Resource Summary closely resembles the report produced by MAP.
• Timing Report
At the end of synthesis, XST reports the timing information for the design. The
Timing Report shows the information for all four possible domains of a netlist:
– register to register
– input to register
– register to outpad
– inpad to outpad
For an example, see:
Timing Report section in XST FPGA Log File Example
For more information, see:
FPGA Optimization Report Section
• Encrypted Modules
If a design contains encrypted modules, XST hides the information about these
modules.
silent
Macro Statistics
# ROMs : 3
16x10-bit ROM : 1
16x7-bit ROM : 2
# Counters : 2
4-bit up counter : 2
==============================================================
...
============================================================
Advanced HDL Synthesis Report
Macro Statistics
# FSMs : 1
# ROMs : 3
16x10-bit ROM : 1
16x7-bit ROM : 2
# Counters : 2
4-bit up counter : 2
# Registers : 3
Flip-Flops/Latches : 3
============================================================
...
=============================
* Synthesis Options Summary *
=============================
---- Source Parameters
Input File Name : "stopwatch.prj"
Input Format : mixed
Ignore Synthesis Constraint File : NO
---- Target Parameters
Output File Name : "stopwatch"
Output Format : NGC
Target Device : xc4vlx15-12-sf363
---- Source Options
Top Module Name : stopwatch
Automatic FSM Extraction : YES
FSM Encoding Algorithm : Auto
Safe Implementation : No
FSM Style : lut
RAM Extraction : Yes
RAM Style : Auto
ROM Extraction : Yes
Mux Style : Auto
Decoder Extraction : YES
Priority Encoder Extraction : YES
Shift Register Extraction : YES
Logical Shifter Extraction : YES
XOR Collapsing : YES
ROM Style : Auto
Mux Extraction : YES
Resource Sharing : YES
Asynchronous To Synchronous : NO
Use DSP Block : auto
Automatic Register Balancing : No
---- Target Options
Add IO Buffers : YES
Global Maximum Fanout : 500
Add Generic Clock Buffer(BUFG) : 32
Number of Regional Clock Buffers : 16
Register Duplication : YES
zero = 6’b000010
Module <statmach> is correct for synthesis.
Analyzing module <decode> in library <work>.
Module <decode> is correct for synthesis.
Analyzing module <cnt60> in library <work>.
Module <cnt60> is correct for synthesis.
Analyzing module <smallcntr> in library <work>.
Module <smallcntr> is correct for synthesis.
Analyzing module <hex2led> in library <work>.
Module <hex2led> is correct for synthesis.
===================================================
* HDL Synthesis *
===================================================
Performing bidirectional port resolution...
Synthesizing Unit <statmach>.
Related source file is "statmach.v".
Found finite state machine <FSM_0> for signal <current_state>.
-------------------------------------------------
| States | 6 |
| Transitions | 15 |
| Inputs | 2 |
| Outputs | 2 |
| Clock | CLK (rising_edge) |
| Reset | RESET (positive) |
| Reset type | asynchronous |
| Reset State | 000001 |
| Encoding | automatic |
| Implementation | LUT |
-------------------------------------------------
Found 1-bit register for signal <CLKEN>.
Found 1-bit register for signal <RST>.
Summary:
inferred 1 Finite State Machine(s).
inferred 2 D-type flip-flop(s).
Unit <statmach> synthesized.
Synthesizing Unit <decode>.
Related source file is "decode.v".
Found 16x10-bit ROM for signal <ONE_HOT>.
Summary:
inferred 1 ROM(s).
Unit <decode> synthesized.
Synthesizing Unit <hex2led>.
Related source file is "hex2led.v".
Found 16x7-bit ROM for signal <LED>.
Summary:
inferred 1 ROM(s).
Unit <hex2led> synthesized.
Synthesizing Unit <smallcntr>.
Related source file is "smallcntr.v".
Found 4-bit up counter for signal <QOUT>.
Summary:
inferred 1 Counter(s).
Unit <smallcntr> synthesized.
Synthesizing Unit <dcm1>.
Related source file is "C:/xst/watchver/dcm1.vhd".
Unit <dcm1> synthesized.
Synthesizing Unit <cnt60>.
Related source file is "cnt60.v".
Unit <cnt60> synthesized.
Synthesizing Unit <stopwatch>.
Related source file is "stopwatch.v".
Unit <stopwatch> synthesized.
=======================================
HDL Synthesis Report
Macro Statistics
# ROMs : 3
16x10-bit ROM : 1
16x7-bit ROM : 2
# Counters : 2
4-bit up counter : 2
# Registers : 2
1-bit register : 2
===================================================
===================================================
* Advanced HDL Synthesis *
===================================================
===================================================
Optimizing unit <stopwatch> ...
Mapping all equations...
Building and optimizing final netlist ...
Found area constraint ratio of 100 (+ 5) on block stopwatch,
actual ratio is 0.
Number of LUT replicated for flop-pair packing : 0
Final Macro Processing ...
===================================================
Final Register Report
Macro Statistics
# Registers : 13
Flip-Flops : 13
===================================================
===================================================
* Partition Report *
===================================================
Partition Implementation Status
-------------------------------
No Partitions were found in this design.
-------------------------------
===================================================
* Final Report *
===================================================
Final Results
RTL Top Level Output File Name : stopwatch.ngr
Top Level Output File Name : stopwatch
Output Format : NGC
Optimization Goal : Speed
Keep Hierarchy : NO
Design Statistics
# IOs : 27
Cell Usage :
# BELS : 70
# GND : 2
# INV : 1
# LUT1 : 3
# LUT2 : 1
# LUT2_L : 1
# LUT3 : 8
# LUT3_D : 1
# LUT3_L : 1
# LUT4 : 37
# LUT4_D : 1
# LUT4_L : 4
# MUXCY : 3
# MUXF5 : 2
# VCC : 1
# XORCY : 4
# FlipFlops/Latches : 17
# FDC : 13
# FDCE : 4
# Clock Buffers : 1
# BUFG : 1
# IO Buffers : 27
# IBUF : 2
# IBUFG : 1
# OBUF : 24
# DCM_ADVs : 1
# DCM_ADV : 1
===================================================
Device utilization summary:
---------------------------
Selected Device : 4vlx15sf363-12
Number of Slices: 32 out of 6144 0%
Number of Slice Flip Flops: 17 out of 12288 0%
Number of 4 input LUTs: 58 out of 12288 0%
Number of IOs: 27
Number of bonded IOBs: 27 out of 240 11%
Number of GCLKs: 1 out of 32 3%
Number of DCM_ADVs: 1 out of 4 25%
---------------------------
Partition Resource Summary:
---------------------------
No Partitions were found in this design.
---------------------------
===================================================
TIMING REPORT
NOTE: THESE TIMING NUMBERS ARE ONLY A SYNTHESIS ESTIMATE.
FOR ACCURATE TIMING INFORMATION PLEASE REFER TO THE TRACE REPORT
GENERATED AFTER PLACE-and-ROUTE.
Clock Information:
------------------
-----------------------------------+-----------
Clock Signal | Clock buffer (FF name) | Load |
-----------------------------------+-----------
CLK | Inst_dcm1/DCM_INST:CLK0| 17 |
-----------------------------------+-----------
Asynchronous Control Signals Information:
----------------------------------------
-----------------------------------+---------------
Control Signal | Buffer (FF name) | Load |
-----------------------------------+---------------
MACHINE/RST(MACHINE/RST:Q) | NONE(sixty/lsbcount/QOUT_1)| 8 |
RESET | IBUF | 5 |
sixty/msbclr(sixty/msbclr_f5:O) | NONE(sixty/msbcount/QOUT_0)|
4 |
-----------------------------------+---------------
Timing Summary:
---------------
Speed Grade: -12
Minimum period: 2.282ns (Maximum Frequency: 438.212MHz)
Minimum input arrival time before clock: 1.655ns
Maximum output required time after clock: 4.617ns
Maximum combinational path delay: No path found
Timing Detail:
--------------
All values displayed in nanoseconds (ns)
===================================================
Timing constraint: Default period analysis for Clock ’CLK’
Clock period: 2.282ns (frequency: 438.212MHz)
Total number of paths / destination ports: 134 / 21
---------------------------------------------------
Delay: 2.282ns (Levels of Logic = 4)
Source: xcounter/BU2/U0/q_i_1 (FF)
Destination: sixty/msbcount/QOUT_1 (FF)
# Counters : 3
4-bit up counter : 3
# Registers : 6
Flip-Flops : 6
======================================================
======================================================
* Low Level Synthesis *
======================================================
Optimizing unit <stopwatch> ...
Optimizing unit <statmach> ...
Optimizing unit <decode> ...
Optimizing unit <hex2led> ...
Optimizing unit <tenths> ...
Optimizing unit <smallcntr> ...
Optimizing unit <cnt60> ...
============================================
* Partition Report *
======================================================
Partition Implementation Status
-------------------------------
No Partitions were found in this design.
-------------------------------
======================================================
* Final Report *
======================================================
Final Results
RTL Top Level Output File Name : stopwatch.ngr
Top Level Output File Name : stopwatch
Output Format : NGC
Optimization Goal : Speed
Keep Hierarchy : YES
Target Technology : CoolRunner2 CPLDs
Macro Preserve : YES
XOR Preserve : YES
Clock Enable : YES
wysiwyg : NO
Design Statistics
# IOs : 28
Cell Usage :
# BELS : 413
# AND2 : 120
# AND3 : 10
# AND4 : 6
# INV : 174
# OR2 : 93
# OR3 : 1
# XOR2 : 9
# FlipFlops/Latches : 18
# FD : 1
# FDC : 5
# FDCE : 12
# IO Buffers : 28
# IBUF : 4
# OBUF : 24
======================================================
Total REAL time to Xst completion: 7.00 secs
Total CPU time to Xst completion: 6.83 secs
-->
Total memory usage is 196636 kilobytes
Number of errors : 0 ( 0 filtered)
Number of warnings : 0 ( 0 filtered)
Number of infos : 0 ( 0 filtered)
run -ifn tt1.prj -top tt1 -ifmt MIXED -opt_mode SPEED -opt_level 1 -ofn tt1.ngc -p
<parttype>
This script file can be executed under XST using the following command:
xst -ifn foo.scr
You can also generate a log file with the following command:
xst -ifn foo.scr -ofn foo.log
A script file can be run either using xst -ifn script name, or executed under the XST
prompt, by using the script script_name command.
script foo.scr
If you make a mistake in an XST command option, or its value, XST issues an error
message and stops execution. For example, if in the previous script example VHDL is
incorrectly spelled (“VHDLL”), XST gives the following error message:
--> ERROR:Xst:1361 - Syntax error in command run for option
"-ifmt" : parameter "VHDLL" is not allowed.
If you created your project using ISE Design Suite, and have run XST at least once from
ISE Design Suite, you can switch to XST command line mode and use the script and
project files that were created by ISE Design Suite.
To run XST from the command line, run the following command from project directory:
xst -ifn <top_level_block>.xst -ofn <top_level_block>.syr
Online Help
XST provides online Help from the command line. The following information is
available by typing help at the command line. The XST help function provides a list of
supported families, available commands, options and their values for each supported
device family.
To see a detailed explanation of an XST command, use the following syntax.
help -arch family_name -command command_name
where:
• family_name is a list of supported Xilinx® families in the current version of XST
• command_name is one of the following XST commands:
– run
– set
– elaborate
– time
Supported Families
To see a list of supported families, type help at the command line prompt with no
argument. XST issues the following message.
--> help
ERROR:Xst:1356 - Help : Missing "-arch <family>".
Please specify what family you want to target
available families:
acr2
aspartan3
aspartan3a
aspartan3adsp
aspartan3e
avirtex4
fpgacore
qrvirtex4
qvirtex4
spartan3
spartan3a
spartan3adsp
spartan3e
virtex4
virtex5
xa9500xl
xbr
xc9500
xc9500xl
xpla3
-ifn : *
-ifmt : Mixed / VHDL / Verilog
-ofn : *
-ofmt : NGC / NCD
-p : *
-ent : *
-top : *
-opt_mode : AREA / SPEED
-opt_level : 1 / 2
-keep_hierarchy : YES / NO
-vlgincdir : *
-verilog2001 : YES / NO
-vlgcase : Full / Parallel / Full-Parallel
....
-vlgpath Verilog Search Paths Any valid path to directories separated by spaces, and
enclosed in double quotes ("...")
-vlgincdir Verilog Include Directories Any valid path to directories separated by spaces, and
enclosed in braces ({...})
3. From the tcsh or other shell, enter the following command to begin synthesis:
xst -ifn stopwatch.xst
Library Names
During VHDL compilation, XST uses the library work as the default. If some VHDL files
are to be compiled to different libraries, add the library name before the file name. For
example, to compile hexl2led into the library my_lib, write the project file as follows:
vhdl work statmach.vhd vhdl work decode.vhd vhdl work
stopwatch.vhd vhdl work cnt60.vhd vhdl work smallcntr.vhd vhdl
work tenths.vhd vhdl my_lib hex2led.vhd
Synthesizing HEX2LED
To synthesize just HEX2LED and check its performance independently of the other
blocks, specify the top-level module to synthesize in the command line, using the -top
option.
run -ifn watchver.v -ifmt Verilog -ofn watchver.ngc -ofmt NGC -p
xc5vfx30t-2-ff324 -opt_mode Speed -opt_level 1 -top HEX2LED
For more information, see:
XST Specific Non-Timing Options
File Order
The order of the files is not important. XST recognizes the hierarchy and compiles
Hardware Description Language (HDL) files in the correct order.