VPR-7.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
place_macro.h
Go to the documentation of this file.
1 /****************************************************************************************
2  Y.G.THIEN
3  29 AUG 2012
4 
5  This file contains functions related to placement macros. The term "placement macros"
6  refers to a structure that contains information on blocks that need special treatment
7  during placement and possibly routing.
8 
9  An example of placement macros is a carry chain. Blocks in a carry chain have to be
10  placed in a specific orientation or relative placement so that the carry_in's and the
11  carry_out's are properly aligned. With that, the carry chains would be able to use the
12  direct connections specified in the arch file. Direct connections with the pin's
13  fc_value 0 would be treated specially in routing where the whole carry chain would be
14  treated as a unit and regular routing would not be used to connect the carry_in's and
15  carry_out's. Floorplanning constraints may also be an example of placement macros.
16 
17  The function alloc_and_load_placement_macros allocates and loads the placement
18  macros in the following steps:
19  (1) First, go through all the block types and mark down the pins that could possibly
20  be part of a placement macros.
21  (2) Then, go through the netlist of all the pins marked in (1) to find out all the
22  heads of the placement macros using criteria depending on the type of placement
23  macros. For carry chains, the heads of the placement macros are blocks with
24  carry_in's not connected to any nets (OPEN) while the carry_out's connected to the
25  netlist with only 1 SINK.
26  (3) Traverse from the heads to the tails of the placement macros and load the
27  information in the t_pl_macro data structure. Similar to (2), tails are identified
28  with criteria depending on the type of placement macros. For carry chains, the
29  tails are blocks with carry_out's not connected to any nets (OPEN) while the
30  carry_in's is connected to the netlist which has only 1 SINK.
31 
32  The only placement macros supported at the moment are the carry chains with limited
33  functionality.
34 
35  Current support for placement macros are:
36  (1) The arch parser for direct connections is working. The specifications of the direct
37  connections are specified in sample_adder_arch.xml and also in the
38  VPR_User_Manual.doc
39  (2) The placement macros allocator and loader is working.
40  (3) The initial placement of placement macros that respects the restrictions of the
41  placement macros is working.
42  (4) The post-placement legality check for placement macros is working.
43 
44  Current limitations on placement macros are:
45  (1) One block could only be a part of a carry chain. In the future, if a block is part
46  of multiple placement macros, we should load 1 huge placement macro instead of
47  multiple placement macros that contain the same block.
48  (2) Bus direct connections (direct connections with multiple bits) are supported.
49  However, a 2-bit carry chain when loaded would become 2 1-bit carry chains.
50  And because of (1), only 1 1-bit carry chain would be loaded. In the future,
51  placement macros with multiple-bit connections or multiple 1-bit connections
52  should be allowed.
53  (3) Placement macros that span longer or wider than the chip would cause an error.
54  In the future, we *might* expand the size of the chip to accommodate such
55  placement macros that are crucial.
56 
57  In order for the carry chain support to work, two changes are required in the
58  arch file.
59  (1) For carry chain support, added in a new child in <layout> called <directlist>.
60  <directlist> specifies a list of available direct connections on the FPGA chip
61  that are necessary for direct carry chain connections. These direct connections
62  would be treated specially in routing if the fc_value for the pins is specified
63  as 0. Note that only direct connections that has fc_value 0 could be used as a
64  carry chain.
65 
66  A <directlist> may have 0 or more children called <direct>. For each <direct>,
67  there are the following fields:
68  1) name: This specifies the name given to this particular direct connection.
69  2) from_pin: This specifies the SOURCEs for this direct connection. The format
70  could be as following:
71  a) type_name.port_name, for all the pins in this port.
72  b) type_name.port_name [end_pin_index:start_pin_index], for a
73  single pin, the end_pin_index and start_pin_index could be
74  the same.
75  3) to_pin: This specifies the SINKs for this direct connection. The format is
76  the same as from_pin.
77  Note that the width of the from_pin and to_pin has to match.
78  4) x_offset: This specifies the x direction that this connection is going from
79  SOURCEs to SINKs.
80  5) y_offset: This specifies the y direction that this connection is going from
81  SOURCEs to SINKs.
82  Note that the x_offset and y_offset could not both be 0.
83  6) z_offset: This specifies the z sublocations that all the blocks in this
84  direct connection to be at.
85 
86  The example of a direct connection specification below shows a possible carry chain
87  connection going north on the FPGA chip:
88  _______________________________________________________________________________
89  | <directlist> |
90  | <direct name="adder_carry" from_pin="adder.cout" to_pin="adder.cin" |
91  | x_offset="0" y_offset="1" z_offset="0"/> |
92  | </directlist> |
93  |_______________________________________________________________________________|
94  A corresponding arch file that has this direct connection is sample_adder_arch.xml
95  A corresponding blif file that uses this direct connection is adder.blif
96 
97  (2) As mentioned in (1), carry chain connections using the directs would only be
98  recognized if the pin's fc_value is 0. In order to achieve this, pin-based fc_value
99  is required. Hence, the new <fc> tag replaces both <fc_in> and <fc_out> tags.
100 
101  A <fc> tag may have 0 or more children called <pin>. For each <fc>, there are the
102  following fields:
103  1) default_in_type: This specifies the default fc_type for input pins. They could
104  be "frac", "abs" or "full".
105  2) default_in_val: This specifies the default fc_value for input pins.
106  3) default_out_type: This specifies the default fc_type for output pins. They could
107  be "frac", "abs" or "full".
108  4) default_out_val: This specifies the default fc_value for output pins.
109 
110  As for the <pin> children, there are the following fields:
111  1) name: This specifies the name of the port/pin that the fc_type and fc_value
112  apply to. The name have to be in the format "port_name" or
113  "port_name [end_pin_index:start_pin_index]" where port_name is the name
114  of the port it apply to while end_pin_index and start_pin_index could
115  be specified to apply the fc_type and fc_value that follows to part of
116  a bus (multi-pin) port.
117  2) fc_type: This specifies the fc_type that would be applied to the specified pins.
118  3) fc_val: This specifies the fc_value that would be applied to the specified pins.
119 
120  The example of a pin-based fc_value specification below shows that the fc_values for
121  the cout and the cin ports are 0:
122  _______________________________________________________________________________
123  | <fc default_in_type="frac" default_in_val="0.15" default_out_type="frac" |
124  | default_out_val="0.15"> |
125  | <pin name="cin" fc_type="frac" fc_val="0"/> |
126  | <pin name="cout" fc_type="frac" fc_val="0"/> |
127  | </fc> |
128  |_______________________________________________________________________________|
129  A corresponding arch file that has this direct connection is sample_adder_arch.xml
130  A corresponding blif file that uses this direct connection is adder.blif
131 
132 ****************************************************************************************/
133 
134 
135 #ifndef PLACE_MACRO_H
136 #define PALCE_MACRO_H
137 
138 /* These are the placement macro structure.
139  * It is in the form of array of structs instead of
140  * structs of arrays for cache efficiency.
141  * Could have more data members for other macro type.
142  * blk_index: The block index of this block.
143  * x_offset: The x_offset of the previous block to this block.
144  * y_offset: The y_offset of the previous block to this block.
145  */
146 typedef struct s_pl_macro_member{
148  int x_offset;
149  int y_offset;
150  int z_offset;
152 
153 /* num_blocks: The number of blocks this macro contains.
154  * members: An array of blocks in this macro [0ˇ­num_macro-1].
155  * idirect: The direct index as specified in the arch file
156  */
157 typedef struct s_pl_macro{
160 } t_pl_macro;
161 
162 /* These are the function declarations. */
163 int alloc_and_load_placement_macros(t_direct_inf* directs, int num_directs, t_pl_macro ** chains);
164 void get_imacro_from_iblk(int * imacro, int iblk, t_pl_macro * macros, int num_macros);
166 
167 #endif
int alloc_and_load_placement_macros(t_direct_inf *directs, int num_directs, t_pl_macro **chains)
Definition: place_macro.c:281
int num_blocks
Definition: place_macro.h:158
t_pl_macro_member * members
Definition: place_macro.h:159
struct s_pl_macro_member t_pl_macro_member
struct s_pl_macro t_pl_macro
void free_placement_macros_structs(void)
Definition: place_macro.c:421
void get_imacro_from_iblk(int *imacro, int iblk, t_pl_macro *macros, int num_macros)
Definition: place_macro.c:362