R
XST User Guide
10.1
XST User Guide www.xilinx.com 10.1
Xilinx is disclosing this user guide, manual, release note, and/or specification (the "Documentation") to you solely for use in the development
of designs to operate with Xilinx hardware devices. You may not reproduce, distribute, republish, download, display, post, or transmit the
Documentation in any form or by any means including, but not limited to, electronic, mechanical, photocopying, recording, or otherwise,
without the prior written consent of Xilinx. Xilinx expressly disclaims any liability arising out of your use of the Documentation. Xilinx reserves
the right, at its sole discretion, to change the Documentation without notice at any time. Xilinx assumes no obligation to correct any errors
contained in the Documentation, or to advise you of any corrections or updates. Xilinx expressly disclaims any liability in connection with
technical support or assistance that may be provided to you in connection with the Information.
THE DOCUMENTATION IS DISCLOSED TO YOU “AS-IS” WITH NO WARRANTY OF ANY KIND. XILINX MAKES NO OTHER
WARRANTIES, WHETHER EXPRESS, IMPLIED, OR STATUTORY, REGARDING THE DOCUMENTATION, INCLUDING ANY
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NONINFRINGEMENT OF THIRD-PARTY
RIGHTS. IN NO EVENT WILL XILINX BE LIABLE FOR ANY CONSEQUENTIAL, INDIRECT, EXEMPLARY, SPECIAL, OR INCIDENTAL
DAMAGES, INCLUDING ANY LOSS OF DATA OR LOST PROFITS, ARISING FROM YOUR USE OF THE DOCUMENTATION.
© 2002–2008 Xilinx, Inc. All rights reserved.
XILINX, the Xilinx logo, the Brand Window, and other designated brands included herein are trademarks of Xilinx, Inc. All other trademarks
are the property of their respective owners
R
XST User Guide www.xilinx.com 3
10.1
Preface: About the XST User Guide
XST User Guide Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Additional Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Typographical. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Online Document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Chapter 1: Introduction to the XST User Guide
About XST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
What’s New in Release 10.1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Macro Inference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Libraries Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Setting XST Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Chapter 2: XST HDL Coding Techniques
Signed and Unsigned Support in XST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Registers HDL Coding Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
About Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Registers Log File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Registers Related Constraints. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Registers Coding Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Latches HDL Coding Techniques. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
About Latches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Latches Log File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Latches Related Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Latches Coding Examples. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Tristates HDL Coding Techniques. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
About Tristates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Tristates Log File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Tristates Related Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Tristates Coding Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Counters HDL Coding Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
About Counters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Counters Log File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Counters Related Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Counters Coding Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Accumulators HDL Coding Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
About Accumulators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Accumulators in Virtex-4 and Virtex-5 Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Accumulators Log File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Accumulators Related Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Accumulators Coding Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Table of Contents
4 www.xilinx.com XST User Guide
10.1
R
Shift Registers HDL Coding Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
About Shift Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
Describing Shift Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
Implementing Shift Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
Shift Registers Log File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
Shift Registers Related Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Shift Registers Coding Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Dynamic Shift Registers HDL Coding Techniques. . . . . . . . . . . . . . . . . . . . . . . . . . . 83
About Dynamic Shift Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
Dynamic Shift Registers Log File. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
Dynamic Shift Registers Related Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
Dynamic Shift Registers Coding Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
Multiplexers HDL Coding Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
About Multiplexers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
Multiplexers Case Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
Multiplexers Log File. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
Multiplexers Related Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
Multiplexers Coding Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
Decoders HDL Coding Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
About Decoders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
Decoders Log File. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
Decoders Related Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
Decoders Coding Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
Priority Encoders HDL Coding Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
About Priority Encoders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
Priority Encoders Log File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
Priority Encoders Related Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
Priority Encoders Coding Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
Logical Shifters HDL Coding Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
About Logical Shifters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
Logical Shifters Log File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
Logical Shifters Related Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
Logical Shifters Coding Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
Arithmetic Operators HDL Coding Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
About Arithmetic Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
Arithmetic Operators Log File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
Arithmetic Operators Related Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
Arithmetic Operators Coding Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
Adders, Subtractors, and Adders/Subtractors HDL Coding Techniques . . . . . 112
About Adders, Subtractors, and Adders/Subtractors . . . . . . . . . . . . . . . . . . . . . . . . . 112
Adders, Subtractors, and Adders/Subtractors Log File . . . . . . . . . . . . . . . . . . . . . . . 113
Adders, Subtractors, and Adders/Subtractors Related Constraints . . . . . . . . . . . . . 113
Adders, Subtractors, and Adders/Subtractors Coding Examples . . . . . . . . . . . . . . . 113
Comparators HDL Coding Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
About Comparators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Comparators Log File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Comparators Related Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
Comparators Coding Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
Multipliers HDL Coding Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
About Multipliers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
Large Multipliers Using Block Multipliers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
XST User Guide www.xilinx.com 5
10.1
R
Registered Multipliers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
Multipliers (Virtex-4, Virtex-5, and Spartan-3A D Devices) . . . . . . . . . . . . . . . . . . . . 128
Multiplication with Constant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
Multipliers Log File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
Multipliers Related Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
Multipliers Coding Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
Sequential Complex Multipliers HDL Coding Techniques. . . . . . . . . . . . . . . . . . 131
About Sequential Complex Multipliers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
Sequential Complex Multipliers Log File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
Sequential Complex Multipliers Related Constraints . . . . . . . . . . . . . . . . . . . . . . . . . 132
Sequential Complex Multipliers Coding Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
Pipelined Multipliers HDL Coding Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
About Pipelined Multipliers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
Pipelined Multipliers Log File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
Pipelined Multipliers Related Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
Pipelined Multipliers Coding Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
Multiply Adder/Subtractors HDL Coding Techniques . . . . . . . . . . . . . . . . . . . . . . 143
About Multiply Adder/Subtractors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
Multiply Adder/Subtractors in Virtex-4 and Virtex- 5 Devices . . . . . . . . . . . . . . . . . 143
Multiply Adder/Subtractors Log File. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
Multiply Adder/Subtractors Related Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
Multiply Adder/Subtractors Coding Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
Multiply Accumulate HDL Coding Techniques. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
About Multiply Accumulate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
Multiply Accumulate in Virtex-4 and Virtex-5 Devices . . . . . . . . . . . . . . . . . . . . . . . . 149
Multiply Accumulate Log File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
Multiply Accumulate Related Constraints. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
Multiply Accumulate Coding Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
Dividers HDL Coding Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
About Dividers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
Dividers Log File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
Dividers Related Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
Dividers Coding Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
Resource Sharing HDL Coding Techniques. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
About Resource Sharing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
Resource Sharing Log File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
Resource Sharing Related Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
Resource Sharing Coding Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
RAMs and ROMs HDL Coding Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
About RAMs and ROMs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
RAMs and ROMs Log File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
RAMs and ROMs Related Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
RAMs and ROMs Coding Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
Initializing RAM Coding Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
ROMs Using Block RAM Resources HDL Coding Techniques . . . . . . . . . . . . . . 227
About ROMs Using Block RAM Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
ROMs Using Block RAM Resources Log File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
ROMs Using Block RAM Resources Related Constraints . . . . . . . . . . . . . . . . . . . . . . 228
ROMs Using Block RAM Resources Coding Examples . . . . . . . . . . . . . . . . . . . . . . . . 228
Pipelined Distributed RAM HDL Coding Techniques . . . . . . . . . . . . . . . . . . . . . . 235
About Pipelined Distributed RAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235