18 #define LINELENGTH 1024
25 static void print_string(
const char *str_ptr,
int *column, FILE * fpout) {
33 len = strlen(str_ptr);
35 vpr_printf(TIO_MESSAGE_ERROR,
"in print_string: String %s is too long for desired maximum line length.\n", str_ptr);
40 fprintf(fpout,
"\\ \n");
44 fprintf(fpout,
"%s ", str_ptr);
69 t_pb *parent, *sibling, *child;
70 int net_num, irr_node;
71 int i, j, k, ichild_type, ichild_inst;
72 int hack_empty_route_through;
75 hack_empty_route_through =
OPEN;
81 if (net_num ==
OPEN) {
91 if (
rr_node[irr_node].net_num == net_num) {
103 hack_empty_route_through = irr_node;
105 if (
rr_node[irr_node].edges[k] == rr_node_index) {
117 if (
rr_node[irr_node].net_num == net_num) {
119 if (
rr_node[irr_node].edges[k] == rr_node_index) {
128 for (ichild_type = 0;
132 for (ichild_inst = 0;
139 sibling = &parent->
child_pbs[ichild_type][ichild_inst];
149 if (
rr_node[irr_node].net_num == net_num) {
162 hack_empty_pb_graph_node =
173 if (
rr_node[irr_node].net_num == net_num) {
192 for (ichild_type = 0;
196 for (ichild_inst = 0;
203 child = &cur_pb->
child_pbs[ichild_type][ichild_inst];
211 if (
rr_node[irr_node].net_num == net_num) {
219 hack_empty_route_through = irr_node;
232 if (
rr_node[irr_node].net_num == net_num) {
233 hack_empty_route_through = irr_node;
235 if (
rr_node[irr_node].edges[k] == rr_node_index) {
245 vpr_printf(TIO_MESSAGE_INFO,
"Use hack in blif dumper (do properly later): connecting net %s #%d for pb %s type %s\n",
249 assert(hack_empty_route_through !=
OPEN);
250 return hack_empty_route_through;
256 int i, j, k, node_index;
257 int in_port_index, out_port_index, clock_port_index;
269 fprintf(fpout,
".latch ");
273 clock_port_index = 0;
274 for (i = 0; i < pb_type->
num_ports; i++) {
281 fprintf(fpout,
"clb_%d_rr_node_%d ", clb_index,
287 for (i = 0; i < pb_type->
num_ports; i++) {
289 assert(pb_type->
ports[i].
num_pins == 1 && out_port_index == 0);
292 fprintf(fpout,
"clb_%d_rr_node_%d re ", clb_index, node_index);
296 for (i = 0; i < pb_type->
num_ports; i++) {
302 fprintf(fpout,
"clb_%d_rr_node_%d 2", clb_index,
308 fprintf(fpout,
"\n");
311 fprintf(fpout,
".names ");
314 for (i = 0; i < pb_type->
num_ports; i++) {
327 fprintf(fpout,
"clb_%d_rr_node_%d ", clb_index,
337 vpr_printf(TIO_MESSAGE_ERROR,
"LUT %s missing input %s post packing. This is a VPR internal error, report to vpr@eecg.utoronto.ca\n",
346 for (i = 0; i < pb_type->
num_ports; i++) {
351 fprintf(fpout,
"clb_%d_rr_node_%d\n", clb_index,
358 while (truth_table) {
359 fprintf(fpout,
"%s\n", (
char *) truth_table->
data_vptr);
360 truth_table = truth_table->
next;
374 int in_port_index, out_port_index, node_index;
384 for (i = 0; i < pb_type->
num_ports; i++) {
393 fprintf(fpout,
".names clb_%d_rr_node_%d ",
399 fprintf(fpout,
"clb_%d_rr_node_%d ", clb_index,
405 fprintf(fpout,
"\n1 1\n");
420 ".names clb_%d_rr_node_%d %s",
427 fprintf(fpout,
"\n1 1\n");
438 fprintf(fpout,
".names ");
440 fprintf(fpout,
"clb_%d_rr_node_%d ", clb_index,
448 fprintf(fpout,
"clb_%d_rr_node_%d", clb_index,
450 fprintf(fpout,
"\n1 1\n");
482 for (icluster = 0; icluster < num_clusters; icluster++) {
484 if (clb[icluster].type !=
IO_TYPE)
485 print_pb(fpout, clb[icluster].pb, icluster);
490 boolean * is_clock,
const char *out_fname,
boolean skip_clustering) {
502 fpout =
my_fopen(out_fname,
"w", 0);
508 fprintf(fpout,
"\n.inputs ");
515 while (p_io_removed) {
517 p_io_removed = p_io_removed->
next;
521 fprintf(fpout,
"\n.outputs ");
531 fprintf(fpout,
"\n\n");
545 fprintf(fpout,
".names ");
549 + 4, &column, fpout);
550 fprintf(fpout,
"\n1 1\n");
556 fprintf(fpout,
"\n.end\n");
t_pb_graph_pin ** clock_pins
FILE * my_fopen(const char *fname, const char *flag, int prompt)
struct s_pb_type * pb_type_children
struct s_linked_vptr * circuit_p_io_removed
struct s_rr_node * rr_graph
struct s_linked_vptr * truth_table
t_pb_graph_pin ** output_pins
void output_blif(t_block *clb, int num_clusters, boolean global_clocks, boolean *is_clock, const char *out_fname, boolean skip_clustering)
static void print_net_name(int inet, int *column, FILE *fpout)
static void print_pb(FILE *fpout, t_pb *pb, int clb_index)
static void print_clusters(t_block *clb, int num_clusters, FILE *fpout)
static void print_string(const char *str_ptr, int *column, FILE *fpout)
struct s_pb_graph_node *** child_pb_graph_nodes
struct s_linked_vptr * next
struct s_pb_type * pb_type
static void print_primitive(FILE *fpout, int iblk)
static int find_fanin_rr_node(t_pb *cur_pb, enum PORTS type, int rr_node_index)
t_pb_graph_node * pb_graph_node
t_pb_graph_pin ** input_pins
struct s_logical_block * logical_block