Makefile and autoconf changes to build VHDL code generator
This commit is contained in:
parent
3575f68c9f
commit
bfa2bfc8ae
|
|
@ -9,7 +9,7 @@
|
||||||
echo "Autoconf in root..."
|
echo "Autoconf in root..."
|
||||||
autoconf -f
|
autoconf -f
|
||||||
|
|
||||||
for dir in vpip vpi vvp tgt-vvp tgt-fpga tgt-stub libveriuser cadpli
|
for dir in vpip vpi vvp tgt-vvp tgt-fpga tgt-stub tgt-vhdl libveriuser cadpli
|
||||||
do
|
do
|
||||||
echo "Autoconf in $dir..."
|
echo "Autoconf in $dir..."
|
||||||
( cd ./$dir ; autoconf -f --include=.. )
|
( cd ./$dir ; autoconf -f --include=.. )
|
||||||
|
|
|
||||||
|
|
@ -122,6 +122,6 @@ AX_C_UNDERSCORES_TRAILING
|
||||||
AX_CPP_IDENT
|
AX_CPP_IDENT
|
||||||
|
|
||||||
# XXX disable tgt-fpga for the moment
|
# XXX disable tgt-fpga for the moment
|
||||||
AC_CONFIG_SUBDIRS(vvp vpi tgt-stub tgt-null tgt-vvp libveriuser cadpli)
|
AC_CONFIG_SUBDIRS(vvp vpi tgt-stub tgt-null tgt-vvp tgt-vhdl libveriuser cadpli)
|
||||||
|
|
||||||
AC_OUTPUT(Makefile ivlpp/Makefile driver/Makefile driver-vpi/Makefile tgt-null/Makefile tgt-verilog/Makefile tgt-pal/Makefile)
|
AC_OUTPUT(Makefile ivlpp/Makefile driver/Makefile driver-vpi/Makefile tgt-null/Makefile tgt-verilog/Makefile tgt-pal/Makefile tgt-vhdl/Makefile)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,91 @@
|
||||||
|
#
|
||||||
|
# This source code is free software; you can redistribute it
|
||||||
|
# and/or modify it in source code form under the terms of the GNU
|
||||||
|
# Library 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 Library General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Library General Public
|
||||||
|
# License along with this program; if not, write to the Free
|
||||||
|
# Software Foundation, Inc.,
|
||||||
|
# 59 Temple Place - Suite 330
|
||||||
|
# Boston, MA 02111-1307, USA
|
||||||
|
#
|
||||||
|
SHELL = /bin/sh
|
||||||
|
|
||||||
|
VERSION = 0.0
|
||||||
|
|
||||||
|
prefix = @prefix@
|
||||||
|
prefix = @prefix@
|
||||||
|
exec_prefix = @exec_prefix@
|
||||||
|
srcdir = @srcdir@
|
||||||
|
|
||||||
|
VPATH = $(srcdir)
|
||||||
|
|
||||||
|
bindir = @bindir@
|
||||||
|
libdir = @libdir@
|
||||||
|
includedir = $(prefix)/include
|
||||||
|
|
||||||
|
CXX = @CXX@
|
||||||
|
INSTALL = @INSTALL@
|
||||||
|
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||||
|
INSTALL_DATA = @INSTALL_DATA@
|
||||||
|
|
||||||
|
CPPFLAGS = @ident_support@ -I. -I$(srcdir)/.. @CPPFLAGS@ @DEFS@ @PICFLAG@
|
||||||
|
CXXFLAGS = -Wall @CXXFLAGS@
|
||||||
|
LDFLAGS = @LDFLAGS@
|
||||||
|
|
||||||
|
all: dep vhdl.tgt vhdl.conf
|
||||||
|
|
||||||
|
dep:
|
||||||
|
mkdir dep
|
||||||
|
|
||||||
|
%.o: %.cc
|
||||||
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -MD -c $< -o $*.o
|
||||||
|
mv $*.d dep
|
||||||
|
|
||||||
|
O = vhdl.o vhdl_element.o
|
||||||
|
|
||||||
|
ifeq (@WIN32@,yes)
|
||||||
|
TGTLDFLAGS=-L.. -livl
|
||||||
|
TGTDEPLIBS=../libivl.a
|
||||||
|
else
|
||||||
|
TGTLDFLAGS=
|
||||||
|
TGTDEPLIBS=
|
||||||
|
endif
|
||||||
|
|
||||||
|
vhdl.tgt: $O $(TGTDEPLIBS)
|
||||||
|
$(CXX) @shared@ -o $@ $O $(TGTLDFLAGS)
|
||||||
|
|
||||||
|
Makefile: Makefile.in config.status
|
||||||
|
./config.status
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf $(O) dep vhdl.tgt
|
||||||
|
|
||||||
|
distclean: clean
|
||||||
|
rm -f Makefile config.status config.log config.cache vhdl_config.h
|
||||||
|
|
||||||
|
check: all
|
||||||
|
|
||||||
|
install: all installdirs $(libdir)/ivl/vhdl.tgt $(libdir)/ivl/vhdl.conf
|
||||||
|
|
||||||
|
$(libdir)/ivl/vhdl.tgt: ./vhdl.tgt
|
||||||
|
$(INSTALL_PROGRAM) ./vhdl.tgt $(libdir)/ivl/vhdl.tgt
|
||||||
|
|
||||||
|
$(libdir)/ivl/vhdl.conf: vhdl.conf
|
||||||
|
$(INSTALL_DATA) $< $(libdir)/ivl/vhdl.conf
|
||||||
|
|
||||||
|
installdirs: ../mkinstalldirs
|
||||||
|
$(srcdir)/../mkinstalldirs $(libdir)/ivl
|
||||||
|
|
||||||
|
uninstall:
|
||||||
|
rm -f $(libdir)/ivl/vhdl.tgt $(libdir)/ivl/vhdl.conf
|
||||||
|
|
||||||
|
|
||||||
|
-include $(patsubst %.o, dep/%.d, $O)
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
dnl Process this file with autoconf to produce a configure script.
|
||||||
|
AC_INIT(vhdl.cc)
|
||||||
|
AC_CONFIG_HEADER(vhdl_config.h)
|
||||||
|
|
||||||
|
dnl Checks for programs.
|
||||||
|
AC_PROG_CC
|
||||||
|
AC_PROG_CXX
|
||||||
|
|
||||||
|
AC_PROG_INSTALL
|
||||||
|
|
||||||
|
AC_CANONICAL_HOST
|
||||||
|
# $host
|
||||||
|
|
||||||
|
# Combined check for Microsoft-related bogosities; sets WIN32 if found
|
||||||
|
AX_WIN32
|
||||||
|
|
||||||
|
AC_CHECK_HEADERS(malloc.h stdint.h inttypes.h)
|
||||||
|
|
||||||
|
# may modify CPPFLAGS and CFLAGS
|
||||||
|
AX_CPP_PRECOMP
|
||||||
|
|
||||||
|
# Compiler option for position independent code, needed when making shared objects.
|
||||||
|
AX_C_PICFLAG
|
||||||
|
|
||||||
|
# linker options when building a shared library
|
||||||
|
AX_LD_SHAREDLIB_OPTS
|
||||||
|
|
||||||
|
AX_CPP_IDENT
|
||||||
|
|
||||||
|
AC_OUTPUT(Makefile)
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
/*
|
||||||
|
* VHDL code generator for Icarus Verilog.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2008 Nick Gasson (nick@nickg.me.uk)
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "vhdl_target.h"
|
||||||
|
#include "vhdl_element.hh"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
|
extern "C" int target_design(ivl_design_t des)
|
||||||
|
{
|
||||||
|
ivl_scope_t *roots;
|
||||||
|
unsigned int nroots;
|
||||||
|
ivl_design_roots(des, &roots, &nroots);
|
||||||
|
|
||||||
|
const char *ofname = ivl_design_flag(des, "-o");
|
||||||
|
std::ofstream outfile(ofname);
|
||||||
|
|
||||||
|
for (unsigned int i = 0; i < nroots; i++) {
|
||||||
|
ivl_scope_t scope = roots[i];
|
||||||
|
const char *scope_name = ivl_scope_basename(scope);
|
||||||
|
|
||||||
|
// Dummy output to test regression script
|
||||||
|
vhdl_entity test_ent(scope_name);
|
||||||
|
vhdl_arch test_arch(scope_name);
|
||||||
|
test_ent.emit(outfile);
|
||||||
|
test_arch.emit(outfile);
|
||||||
|
}
|
||||||
|
|
||||||
|
outfile.close();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
functor:cprop
|
||||||
|
functor:nodangle
|
||||||
|
-t:dll
|
||||||
|
flag:DLL=vhdl.tgt
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
/* vhdl_config.h.in. Generated from configure.in by autoheader. */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||||
|
#undef HAVE_INTTYPES_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <malloc.h> header file. */
|
||||||
|
#undef HAVE_MALLOC_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <memory.h> header file. */
|
||||||
|
#undef HAVE_MEMORY_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <stdint.h> header file. */
|
||||||
|
#undef HAVE_STDINT_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||||
|
#undef HAVE_STDLIB_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <strings.h> header file. */
|
||||||
|
#undef HAVE_STRINGS_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <string.h> header file. */
|
||||||
|
#undef HAVE_STRING_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||||
|
#undef HAVE_SYS_STAT_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||||
|
#undef HAVE_SYS_TYPES_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <unistd.h> header file. */
|
||||||
|
#undef HAVE_UNISTD_H
|
||||||
|
|
||||||
|
/* Define to the address where bug reports for this package should be sent. */
|
||||||
|
#undef PACKAGE_BUGREPORT
|
||||||
|
|
||||||
|
/* Define to the full name of this package. */
|
||||||
|
#undef PACKAGE_NAME
|
||||||
|
|
||||||
|
/* Define to the full name and version of this package. */
|
||||||
|
#undef PACKAGE_STRING
|
||||||
|
|
||||||
|
/* Define to the one symbol short name of this package. */
|
||||||
|
#undef PACKAGE_TARNAME
|
||||||
|
|
||||||
|
/* Define to the version of this package. */
|
||||||
|
#undef PACKAGE_VERSION
|
||||||
|
|
||||||
|
/* Define to 1 if you have the ANSI C header files. */
|
||||||
|
#undef STDC_HEADERS
|
||||||
|
|
@ -0,0 +1,56 @@
|
||||||
|
/*
|
||||||
|
* VHDL abstract syntax elements.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2008 Nick Gasson (nick@nickg.me.uk)
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "vhdl_element.hh"
|
||||||
|
|
||||||
|
|
||||||
|
//////// ENTITY ////////
|
||||||
|
|
||||||
|
vhdl_entity::vhdl_entity(const char *name)
|
||||||
|
: name_(name)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void vhdl_entity::emit(std::ofstream &of)
|
||||||
|
{
|
||||||
|
of << "entity " << name_ << " is" << std::endl;
|
||||||
|
// ...ports...
|
||||||
|
of << "end entity; " << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////// ARCHITECTURE ////////
|
||||||
|
|
||||||
|
vhdl_arch::vhdl_arch(const char *entity, const char *name)
|
||||||
|
: name_(name), entity_(entity)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void vhdl_arch::emit(std::ofstream &of)
|
||||||
|
{
|
||||||
|
of << "architecture " << name_ << " of " << entity_;
|
||||||
|
of << " is" << std::endl;
|
||||||
|
// ...declarations...
|
||||||
|
of << "begin" << std::endl;
|
||||||
|
// ...statements...
|
||||||
|
of << "end architecture;" << std::endl;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
/*
|
||||||
|
* VHDL abstract syntax elements.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2008 Nick Gasson (nick@nickg.me.uk)
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef INC_VHDL_ELEMENT_HH
|
||||||
|
#define INC_VHDL_ELEMENT_HH
|
||||||
|
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
|
class vhdl_element {
|
||||||
|
public:
|
||||||
|
virtual void emit(std::ofstream &of) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
class vhdl_entity : public vhdl_element {
|
||||||
|
public:
|
||||||
|
vhdl_entity(const char *name);
|
||||||
|
|
||||||
|
void emit(std::ofstream &of);
|
||||||
|
private:
|
||||||
|
const char *name_;
|
||||||
|
};
|
||||||
|
|
||||||
|
class vhdl_arch : public vhdl_element {
|
||||||
|
public:
|
||||||
|
vhdl_arch(const char *entity, const char *name="Behavioural");
|
||||||
|
|
||||||
|
void emit(std::ofstream &of);
|
||||||
|
private:
|
||||||
|
const char *name_, *entity_;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
#ifndef INC_VHDL_TARGET_H
|
||||||
|
#define INC_VHDL_TARGET_H
|
||||||
|
|
||||||
|
#include "vhdl_config.h"
|
||||||
|
#include "ivl_target.h"
|
||||||
|
|
||||||
|
#endif /* #ifndef INC_VHDL_TARGET_H */
|
||||||
|
|
||||||
Loading…
Reference in New Issue