vlog95 - Add output file code and basic header.

This commit is contained in:
Cary R 2010-03-25 11:09:50 -07:00 committed by Stephen Williams
parent 96dab230f6
commit c7e6de6fa4
3 changed files with 70 additions and 7 deletions

View File

@ -34,7 +34,7 @@ INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
CPPFLAGS = -I.. -I$(srcdir)/.. -I$(srcdir) @CPPFLAGS@ @DEFS@ @PICFLAG@
CPPFLAGS = -I. -I.. -I$(srcdir)/.. -I$(srcdir) @CPPFLAGS@ @DEFS@ @PICFLAG@
CFLAGS = -Wall @CFLAGS@
LDFLAGS = @LDFLAGS@
@ -51,7 +51,7 @@ dep:
O = vlog95.o
ifeq (@CYGWIN@,yes)
ifeq (@WIN32@,yes)
TGTLDFLAGS=-L.. -livl
TGTDEPLIBS=../libivl.a
else

View File

@ -24,8 +24,8 @@
# include "version_base.h"
# include "version_tag.h"
# include "config.h"
# include "ivl_target.h"
# include <string.h>
# include "vlog95_priv.h"
# include <string.h>
static const char*version_string =
"Icarus Verilog VLOG95 Code Generator " VERSION " (" VERSION_TAG ")\n\n"
@ -43,17 +43,39 @@ static const char*version_string =
" 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\n"
;
FILE*vlog_out;
int vlog_errors = 0;
int target_design(ivl_design_t des)
{
return 0;
const char*path = ivl_design_flag(des, "-o");
assert(path);
#ifdef HAVE_FOPEN64
vlog_out = fopen64(path, "w");
#else
vlog_out = fopen(path, "w");
#endif
if (vlog_out == 0) {
perror(path);
return -1;
}
fprintf(vlog_out, "/*\n");
fprintf(vlog_out, " * 1364-1995 Verilog generated by Icarus Verilog "
"VLOG95 Code Generator,\n");
fprintf(vlog_out, " * Version: " VERSION " (" VERSION_TAG ")\n");
fprintf(vlog_out, " */\n");
fclose(vlog_out);
return vlog_errors;
}
const char* target_query(const char*key)
{
if (strcmp(key,"version") == 0)
return version_string;
if (strcmp(key,"version") == 0) return version_string;
return 0;
}

41
tgt-vlog95/vlog95_priv.h Normal file
View File

@ -0,0 +1,41 @@
#ifndef __vlog95_priv_H
#define __vlog95_priv_H
/*
* Copyright (C) 2010 Cary R. (cygcary@yahoo.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*
* This is the vlog95 target module. It generates a 1364-1995 compliant
* netlist from the input netlist. The generated netlist is expected to
* be simulation equivalent to the original.
*/
# include "config.h"
# include "ivl_target.h"
# include <stdio.h>
# include <assert.h>
/*
* This is the file that the converted design is written to.
*/
extern FILE*vlog_out;
/*
* Keep a count of the fatal errors that happen during code generation.
*/
extern int vlog_errors;
#endif /* __vlog95_priv_H */