2 * Copyright (c) 2001 Stephen Williams (steve@icarus.com)
4 * This source code is free software; you can redistribute it
5 * and/or modify it in source code form under the terms of the GNU
6 * General Public License as published by the Free Software
7 * Foundation; either version 2 of the License, or (at your option)
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
20 #ident "$Id: vvp.c,v 1.17 2004/10/04 01:10:57 steve Exp $"
26 # include "vvp_priv.h"
29 # include <sys/types.h>
30 # include <sys/stat.h>
34 inline static void draw_execute_header(ivl_design_t des
)
36 #if !defined(__MINGW32__)
37 const char*cp
= ivl_design_flag(des
, "VVP_EXECUTABLE");
39 fprintf(vvp_out
, "#! %s\n", cp
);
40 fchmod(fileno(vvp_out
), 0755);
45 inline static void draw_module_declarations(ivl_design_t des
)
47 const char*cp
= ivl_design_flag(des
, "VPI_MODULE_LIST");
51 const char*comma
= strchr(cp
, ',');
54 comma
= cp
+ strlen(cp
);
56 strncpy(buffer
, cp
, comma
-cp
);
58 fprintf(vvp_out
, ":vpi_module \"%s\";\n", buffer
);
66 int target_design(ivl_design_t des
)
72 const char*path
= ivl_design_flag(des
, "-o");
76 vvp_out
= fopen64(path
, "w");
78 vvp_out
= fopen(path
, "w");
85 draw_execute_header(des
);
87 { int pre
= ivl_design_time_precision(des
);
93 fprintf(vvp_out
, ":vpi_time_precision %c %d;\n", sign
, pre
);
96 draw_module_declarations(des
);
98 ivl_design_roots(des
, &roots
, &nroots
);
99 for (i
= 0; i
< nroots
; i
++)
100 draw_scope(roots
[i
], 0);
102 rc
= ivl_design_process(des
, draw_process
, 0);
111 * Revision 1.17 2004/10/04 01:10:57 steve
112 * Clean up spurious trailing white space.
114 * Revision 1.16 2003/05/16 03:22:52 steve
115 * Use fopen64 to open output file.
117 * Revision 1.15 2002/08/12 01:35:03 steve
118 * conditional ident string using autoconfig.
120 * Revision 1.14 2002/08/11 23:47:04 steve
121 * Add missing Log and Ident strings.