SpecC Reference Compiler from UC Irvine to simulate

Hardware Description in C-based language of SpecC.
(scrc-2.1 for now)
This commit is contained in:
Makoto Fujiwara 2010-08-31 11:53:59 +00:00 committed by Thomas Klausner
parent 0be4515214
commit 32ce9c3a46
11 changed files with 387 additions and 0 deletions

3
scrc/DESCR Normal file
View file

@ -0,0 +1,3 @@
SpecC Reference Compiler (scrc) for Hardware description
language. SpecC is Originated by Daniel Gajski at UC
Irvine. Developed by adding HDL Syntax elements onto C.

6
scrc/MESSAGE Normal file
View file

@ -0,0 +1,6 @@
===========================================================================
$NetBSD: MESSAGE,v 1.1.1.1 2010/08/31 11:53:59 makoto Exp $
For help, type
${PREFIX}/scrc-2.1/bin/scrc -h
===========================================================================

54
scrc/Makefile Normal file
View file

@ -0,0 +1,54 @@
# $NetBSD: Makefile,v 1.1.1.1 2010/08/31 11:53:59 makoto Exp $
#
DISTNAME= scrc-2.1
CATEGORIES= cad
MASTER_SITES= ftp://ftp.cecs.uci.edu/pub/specc/reference/
MAINTAINER= makoto@ki.nu
HOMEPAGE= http://www.cecs.uci.edu/~specc/reference/
COMMENT= SpecC Reference Compiler
USE_LANGUAGES+= c++
USE_LANGUAGES+= c
PKG_DESTDIR_SUPPORT= user-destdir
# mkdir etc is hardcoded, not so easy to make it.
USE_TOOLS+= gmake gtar
DEPENDS+= bison>=1.35:../../devel/bison
DEPENDS+= unix2dos:../../converters/unix2dos
#ONLY_FOR_PLATFORM= NetBSD-*-i386
#ONLY_FOR_PLATFORM+= Linux-*-i[3-6]86
PLIST_SUBST+= SCRCPREF=${DISTNAME}
CHECK_SHLIBS= NO
#SPECIAL_PERMS=
.include "../../mk/bsd.prefs.mk"
do-build:
cd ${WRKSRC} && ${GMAKE} all
do-install:
cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${INSTALL_ENV} ${GMAKE} install
# post-install:
# (cd ${WRKSRC}; ${GMAKE} install)
# echo test
pre-configure:
${ECHO} \*\*\* pre-configure is running
(cd ${WRKSRC} ; \
for i in Makefile.macros src/Compiler/Makefile; do \
mv $$i $$i.bak ;\
sed -e 's|@@SPECC@@|${WRKSRC}|g' \
-e 's|@@PREFIX@@|${PREFIX}|g' \
-e 's|@@PKGNAME@@|${PKGNAME}|g' \
${WRKSRC}/$${i}.bak \
> ${WRKSRC}/$${i}; \
done; )
.include "../../mk/bsd.pkg.mk"

106
scrc/PLIST Normal file
View file

@ -0,0 +1,106 @@
@comment $NetBSD: PLIST,v 1.1.1.1 2010/08/31 11:53:59 makoto Exp $
${SCRCPREF}/bin/scrc
${SCRCPREF}/bin/setup.csh
${SCRCPREF}/bin/setup.sh
${SCRCPREF}/inc/sys/bit.h
${SCRCPREF}/inc/longlong.h
${SCRCPREF}/inc/bit.h
${SCRCPREF}/inc/sim.h
${SCRCPREF}/inc/sim.sh
${SCRCPREF}/inc/specc.h
${SCRCPREF}/inc/piped.h
${SCRCPREF}/inc/signals.h
${SCRCPREF}/inc/c_typed_double_handshake.sh
${SCRCPREF}/inc/c_typed_queue.sh
${SCRCPREF}/inc/i_typed_receiver.sh
${SCRCPREF}/inc/i_typed_sender.sh
${SCRCPREF}/inc/i_typed_tranceiver.sh
${SCRCPREF}/import/i_critical_section.sc
${SCRCPREF}/import/c_critical_section.sc
${SCRCPREF}/import/c_mutex.sc
${SCRCPREF}/import/i_semaphore.sc
${SCRCPREF}/import/c_semaphore.sc
${SCRCPREF}/import/i_barrier.sc
${SCRCPREF}/import/c_barrier.sc
${SCRCPREF}/import/i_producer.sc
${SCRCPREF}/import/i_consumer.sc
${SCRCPREF}/import/i_token.sc
${SCRCPREF}/import/c_token.sc
${SCRCPREF}/import/i_sender.sc
${SCRCPREF}/import/i_receiver.sc
${SCRCPREF}/import/i_tranceiver.sc
${SCRCPREF}/import/i_send.sc
${SCRCPREF}/import/i_receive.sc
${SCRCPREF}/import/c_queue.sc
${SCRCPREF}/import/c_handshake.sc
${SCRCPREF}/import/c_double_handshake.sc
${SCRCPREF}/lib/liblonglong.so
${SCRCPREF}/lib/liblonglong.so.2.1
${SCRCPREF}/lib/libbit.so
${SCRCPREF}/lib/libbit.so.2.1
${SCRCPREF}/lib/libsim.so
${SCRCPREF}/lib/libsim.so.2.1
${SCRCPREF}/lib/libGlobal.so
${SCRCPREF}/lib/libGlobal.so.2.1
${SCRCPREF}/lib/libCcDriver.so
${SCRCPREF}/lib/libCcDriver.so.2.1
${SCRCPREF}/lib/libIntRep.so
${SCRCPREF}/lib/libIntRep.so.2.1
${SCRCPREF}/lib/libParser.so
${SCRCPREF}/lib/libParser.so.2.1
${SCRCPREF}/man/catl/scrc.l
${SCRCPREF}/man/manl/scrc.l
${SCRCPREF}/examples/simple/Makefile
${SCRCPREF}/examples/simple/README
${SCRCPREF}/examples/simple/Adder.sc
${SCRCPREF}/examples/simple/Pipeline2.sc
${SCRCPREF}/examples/simple/Pipeline.sc
${SCRCPREF}/examples/simple/Notes.sc
${SCRCPREF}/examples/simple/HelloWorld.sc
${SCRCPREF}/examples/simple/Handshaking2.sc
${SCRCPREF}/examples/simple/Handshaking1.sc
${SCRCPREF}/examples/simple/FSM.sc
${SCRCPREF}/examples/simple/Exception.sc
${SCRCPREF}/examples/simple/DataTypes.sc
${SCRCPREF}/examples/simple/Callback.sc
${SCRCPREF}/examples/simple/BitVectors.sc
${SCRCPREF}/examples/simple/Behaviors.sc
${SCRCPREF}/examples/simple/Timing.sc
${SCRCPREF}/examples/sync/Makefile
${SCRCPREF}/examples/sync/README
${SCRCPREF}/examples/sync/barrier.sc
${SCRCPREF}/examples/sync/typed_double_handshake.sc
${SCRCPREF}/examples/sync/token.sc
${SCRCPREF}/examples/sync/semaphore.sc
${SCRCPREF}/examples/sync/queue.sc
${SCRCPREF}/examples/sync/mutex.sc
${SCRCPREF}/examples/sync/handshake.sc
${SCRCPREF}/examples/sync/double_handshake.sc
${SCRCPREF}/examples/sync/critical_section.sc
${SCRCPREF}/examples/sync/c_packet_double_handshake.sc
${SCRCPREF}/examples/sync/c_bit64_queue.sc
${SCRCPREF}/examples/sync/typed_queue.sc
${SCRCPREF}/examples/import/Adder/ADD16_2.sc
${SCRCPREF}/examples/import/Adder/ADD32_2.sc
${SCRCPREF}/examples/import/Adder/ADD32_1.sc
${SCRCPREF}/examples/import/Adder/AddLib.sc
${SCRCPREF}/examples/import/Adder/ADD16_1.sc
${SCRCPREF}/examples/import/Adder/ADD08_2.sc
${SCRCPREF}/examples/import/Adder/ADD08_1.sc
${SCRCPREF}/examples/import/Gate/NOR2.sc
${SCRCPREF}/examples/import/Gate/OR2.sc
${SCRCPREF}/examples/import/Gate/NOT1.sc
${SCRCPREF}/examples/import/Gate/XOR2.sc
${SCRCPREF}/examples/import/Gate/NAND2.sc
${SCRCPREF}/examples/import/Gate/GatesLib.sc
${SCRCPREF}/examples/import/Gate/AND2.sc
${SCRCPREF}/examples/import/README
${SCRCPREF}/examples/import/Makefile
${SCRCPREF}/examples/import/Testbench.sc
${SCRCPREF}/doc/SpecC_LRM.pdf
${SCRCPREF}/README
${SCRCPREF}/INSTALL
${SCRCPREF}/BUGS
${SCRCPREF}/TODO
${SCRCPREF}/HISTORY
${SCRCPREF}/COPYRIGHT

14
scrc/TODO Normal file
View file

@ -0,0 +1,14 @@
(1) Adjust scrc-2.1/Makefile.macros to support Linux and other OS.
(2) Fix the runtime problem
ERROR #3105: Semantic error in line 221
in file "/usr/include/stdio.h":
Declaration of symbol '__restrict'
does not match former declaration:
type mismatch (#2039).
(on NetBSD/{i386,amd64} 5.x, probably gcc-4.1.x)
(3) See patches/patch-ag,
-Wl,rpath ${SPECC_SLIB} doesn't seem to work so the work around
is on pathces/patch-ag
to set LD_RUN_PATH at compile time, may not be hurtful, but rpath
may be better

10
scrc/distinfo Normal file
View file

@ -0,0 +1,10 @@
$NetBSD: distinfo,v 1.1.1.1 2010/08/31 11:53:59 makoto Exp $
SHA1 (scrc-2.1.tar.gz) = cf36b72463b217d832dc0b930a748204c2a45461
RMD160 (scrc-2.1.tar.gz) = 78012c744fdab78f0f84ab5afe5644efbee72f60
Size (scrc-2.1.tar.gz) = 966739 bytes
SHA1 (patch-aa) = 7dd6b2c006fc615492bb152d7277bbbf9512643d
SHA1 (patch-ab) = 89f4b3958928544e1af4d8d99f34850b48ce72ce
SHA1 (patch-ac) = 31952c14dae6e10046f117b9843254d77358ece9
SHA1 (patch-af) = bf85ab19c2caf2ede57cae875e9058da9fb003ef
SHA1 (patch-ag) = ea6653c9513c57169897cf6dee333d5fbb6a11bc

120
scrc/patches/patch-aa Normal file
View file

@ -0,0 +1,120 @@
$NetBSD: patch-aa,v 1.1.1.1 2010/08/31 11:53:59 makoto Exp $
--- work/scrc-2.1/Makefile.macros.orig 2006-09-29 02:48:26.000000000 +0900
+++ Makefile.macros 2010-08-31 10:34:22.000000000 +0900
@@ -64,8 +64,7 @@
LLONG_LIB_NAME = longlong
# --- paths
-#SPECC = /home/doemer/project/SpecC/chkout/scrc
-SPECC = /home/specc/scrc/current/
+SPECC = @@SPECC@@
SPECC_HOME = $(SPECC)
SPECC_BIN = $(SPECC)/bin
SPECC_SRC = $(SPECC)/src
@@ -74,12 +73,9 @@
SPECC_IMP = $(SPECC)/import
SPECC_DOC = $(SPECC)/doc
SPECC_MAN = $(SPECC)/man
+SPECC_INSTALL = ${DESTDIR}@@PREFIX@@/$(PROJECT)
-SPECC_INSTALL = $(SPECC)/installed
-#SPECC_INSTALL = /usr/local/$(PROJECT)
-
-#SPECC_SLIB = $(SPECC_LIB)
-SPECC_SLIB = $(SPECC_INSTALL)/lib
+SPECC_SLIB = ${DESTDIR}@@PREFIX@@/$(PROJECT)/lib
TMP = /tmp
@@ -92,23 +88,38 @@
INSTALL_PERM = u+rwX,g-sw+rX,o-w+rX
# --- target platform
+
+ifeq ($(OPSYS),SunOS)
TARGET = SOLARIS
+SYSTEM = -DSPARC -DSOLARIS
+SCPP = $(CPP) -x c -D__attribute__\(x\)= $(GCC296) # SOLARIS
+
#TARGET = SUNOS4
-#TARGET = NETBSD
+#SYSTEM = -DSPARC -DSUNOS4
+endif
+
+ifeq ($(OPSYS),NetBSD)
+TARGET = NETBSD
+SYSTEM = -DNETBSD
+SO_SUFFIX = $(VERSION_MAJOR).$(VERSION_MINOR) # NETBSD
+SCPP = $(CPP) -x c -D__attribute__\(x\)= # NETBSD
+SHARED = -shared -nodefaultlibs -Xlinker -shared -Wl,-rpath @@PREFIX@@/$(PROJECT)/lib -Wl,-rpath-link @@PREFIX@@/$(PROJECT)/lib
+STDLIB = -ll # NETBSD
+endif
#TARGET = LINUX
#TARGET = GNUWIN32
# --- target system, operating system
-SYSTEM = -DSPARC -DSOLARIS
-#SYSTEM = -DSPARC -DSUNOS4
#SYSTEM = -DAMIGA -DNETBSD
#SYSTEM = -DX86 -DLINUX
#SYSTEM = -DX86 -DGNUWIN32
#SYSTEM = -DX86 -DGNUWIN32 -DWIN_NT
# --- target architecture (CPU)
-ARCH = -mv8 -mfpu
-#ARCH = -m68030 -m68881
+#ARCH = -mv8 -mfpu
+ifeq (${MACHINE_ARCH},m68k)
+ARCH = -m68030 -m68881
+endif
#ARCH = -m32
#ARCH =
@@ -117,7 +128,7 @@
#EXE_SUFFIX = .exe # GNUWIN32
# --- shared library version suffix
-SO_SUFFIX = $(VERSION_MAJOR) # SOLARIS
+#SO_SUFFIX = $(VERSION_MAJOR) # SOLARIS
#SO_SUFFIX = $(VERSION_MAJOR).$(VERSION_MINOR) # SUNOS4
#SO_SUFFIX = $(VERSION_MAJOR).$(VERSION_MINOR) # NETBSD
#SO_SUFFIX = $(VERSION_MAJOR) # LINUX
@@ -132,17 +143,17 @@
# --- preprocessor call for SpecC source code (see also CcDriver.h!!!)
GCC296 = "-D__builtin_va_list=void*"
-SCPP = $(CPP) -x c -D__attribute__\(x\)= $(GCC296) # SOLARIS
+#SCPP = $(CPP) -x c -D__attribute__\(x\)= $(GCC296) # SOLARIS
#SCPP = $(CPP) -x c -D__USE_FIXED_PROTOTYPES__ -D__attribute__\(x\)= # SUNOS4
#SCPP = $(CPP) -x c -D__attribute__\(x\)= -D__inline= $(GCC296) # NETBSD
-SCPP = $(CPP) -x c -U__GNUC__ -D__attribute__\(x\)= $(GCC296) # LINUX
+#SCPP = $(CPP) -x c -U__GNUC__ -D__attribute__\(x\)= $(GCC296) # LINUX
#SCPP = $(CPP) -x c -U__CYGWIN__ -D__attribute__\(x\)= \
# -D__extension__= $(GCC296) # GNUWIN32
# --- shared library flags
-SHARED = -shared -nodefaultlibs # SOLARIS
+#SHARED = -shared -nodefaultlibs # SOLARIS
#SHARED = -shared -nodefaultlibs # SUNOS4
-#SHARED = -shared -nodefaultlibs -Xlinker -shared # NETBSD
+
#SHARED = -shared # LINUX
#SHARED = -shared # GNUWIN32
@@ -163,13 +174,13 @@
LNDBG = -s
# --- shared vs. static libraries
-DYNLIB = -DDYNLIB
+#DYNLIB = -DDYNLIB
#DYNLIB =
LIBSFX = so
#LIBSFX = a
CCSLIB = -fpic
#CCSLIB =
-LNSLIB = -Xlinker -R -Xlinker $(SPECC_SLIB)
+LNSLIB = -Wl,-rpath $(SPECC_SLIB)
#LNSLIB =
#ADDLIB = a
#ADDLIB = so

21
scrc/patches/patch-ab Normal file
View file

@ -0,0 +1,21 @@
$NetBSD: patch-ab,v 1.1.1.1 2010/08/31 11:53:59 makoto Exp $
--- work/scrc-2.1/src/IntRep/Alignment.cc.orig 2006-09-29 02:47:25.000000000 +0900
+++ src/IntRep/Alignment.cc 2010-04-16 09:06:30.000000000 +0900
@@ -259,14 +259,14 @@
{
char x1;
_specc::buffered<char> x2;
-BufferStruct::BufferStruct() : x2(event(&clk)) { }
+BufferStruct() : x2(event(&clk)) { }
};
struct BufferStruct2
{
_specc::buffered<char> x2;
char x1;
-BufferStruct2::BufferStruct2() : x2(event(&clk)) { }
+BufferStruct2() : x2(event(&clk)) { }
};
int x;

15
scrc/patches/patch-ac Normal file
View file

@ -0,0 +1,15 @@
$NetBSD: patch-ac,v 1.1.1.1 2010/08/31 11:53:59 makoto Exp $
--- scrc-2.1/src/bit/bit.in.h~ 2006-09-29 02:47:30.000000000 +0900
+++ src/bit/bit.in.h 2010-04-17 01:08:58.000000000 +0900
@@ -12,8 +12,8 @@
//
// ----------------------------------------------------------------------------
-#ifndef __BIT
-#define __BIT
+#ifndef __BIT_H
+#define __BIT_H
#include <sys/bit.h>

22
scrc/patches/patch-af Normal file
View file

@ -0,0 +1,22 @@
$NetBSD: patch-af,v 1.1.1.1 2010/08/31 11:53:59 makoto Exp $
--- src/IntRep/Expression.cc-orig 2006-09-29 02:47:26.000000000 +0900
+++ src/IntRep/Expression.cc 2010-04-19 12:15:49.000000000 +0900
@@ -5170,7 +5170,7 @@
assert( (0 == strcmp(EOL, "\n")) /* (bug fix RD, 09/15/05) */
||(0 == strcmp(EOL, "\r\n")));
if (0 == strcmp(EOL, "\n"))
- { while(PrintBuffer[LeadingNL] == '\n')
+ { while(PrintBuffer.at(LeadingNL) == '\n')
{ LeadingNL++;
} /* elihw */
} /* fi */
@@ -5179,7 +5179,7 @@
{ LeadingNL += 2;
} /* elihw */
} /* esle */
-return(&PrintBuffer[LeadingNL]);
+ return((const char*) &PrintBuffer.at(LeadingNL));
} /* end of SIR_Expression::Print */

16
scrc/patches/patch-ag Normal file
View file

@ -0,0 +1,16 @@
$NetBSD: patch-ag,v 1.1.1.1 2010/08/31 11:53:59 makoto Exp $
-Wl,rpath ${SPECC_SLIB} doesn't seem to work so the work around
(so, to be reviewed)
--- scrc-2.1/src/Compiler/Makefile.bak 2004-06-16 05:19:47.000000000 +0900
+++ src/Compiler/Makefile 2010-08-31 10:36:07.000000000 +0900
@@ -115,7 +115,7 @@
$(BINFILE): $(BINARY).o $(OBJECTS) $(LIBDEP)
- $(LN) -o $(BINFILE) $(BINARY).o $(OBJECTS) $(LIBS) $(STDLIB)
+ env LD_RUN_PATH=${SPECC_SLIB} $(LN) -o $(BINFILE) $(BINARY).o $(OBJECTS) $(LIBS) $(STDLIB)
$(BINARY)_pure: $(BINARY).o $(OBJECTS) $(LIBDEP)
$(LNPURE) -o $(BINARY)_pure $(BINARY).o $(OBJECTS) $(LIBS) $(STDLIB)