diff --git a/Attrib.h b/Attrib.h index 67e65372b..63691ecc5 100644 --- a/Attrib.h +++ b/Attrib.h @@ -1,7 +1,7 @@ #ifndef __Attrib_H #define __Attrib_H /* - * Copyright (c) 2000 Stephen Williams (steve@icarus.com) + * Copyright (c) 2000-2009 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -30,7 +30,7 @@ class Attrib { public: Attrib(); - ~Attrib(); + virtual ~Attrib(); const verinum&attribute(perm_string key) const; void attribute(perm_string key, const verinum&value); diff --git a/LineInfo.h b/LineInfo.h index f9b0b9dd8..f2262b568 100644 --- a/LineInfo.h +++ b/LineInfo.h @@ -1,7 +1,7 @@ #ifndef __LineInfo_H #define __LineInfo_H /* - * Copyright (c) 1999 Stephen Williams (steve@icarus.com) + * Copyright (c) 1999-2009 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -36,7 +36,7 @@ using namespace std; class LineInfo { public: LineInfo(); - ~LineInfo(); + virtual ~LineInfo(); // Get a fully formatted file/lineno string get_fileline() const; diff --git a/Module.cc b/Module.cc index 774dfdbf7..6fa6fcdf9 100644 --- a/Module.cc +++ b/Module.cc @@ -24,6 +24,8 @@ # include "PWire.h" # include +list Module::user_defparms; + /* n is a permallocated string. */ Module::Module(perm_string n) : PScope(n) diff --git a/Module.h b/Module.h index 80d43031a..b9f179d17 100644 --- a/Module.h +++ b/Module.h @@ -92,6 +92,7 @@ class Module : public PScope, public LineInfo { instantiated modules. */ typedef pair named_expr_t; listdefparms; + static listuser_defparms; /* Parameters may be overridden at instantiation time; the overrides do not contain explicit parameter names, diff --git a/PExpr.h b/PExpr.h index 3cef1cee8..00c3c2fee 100644 --- a/PExpr.h +++ b/PExpr.h @@ -339,6 +339,12 @@ class PEIdent : public PExpr { NetScope*found, const NetExpr*par_msb, const NetExpr*par_lsb) const; + NetExpr*elaborate_expr_param_idx_do_(Design*des, + NetScope*scope, + const NetExpr*par, + NetScope*found, + const NetExpr*par_msb, + const NetExpr*par_lsb) const; NetExpr*elaborate_expr_net(Design*des, NetScope*scope, NetNet*net, diff --git a/PGenerate.cc b/PGenerate.cc index 539eeba12..3deebe6a2 100644 --- a/PGenerate.cc +++ b/PGenerate.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006 Stephen Williams (steve@icarus.com) + * Copyright (c) 2006,2009 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -55,6 +55,7 @@ void PGenerate::probe_for_direct_nesting_(void) if (localparams.size() > 0) return; if (events.size() > 0) return; if (wires.size() > 0) return; + if (genvars.size() > 0) return; if (behaviors.size() > 0) return; if (analog_behaviors.size() > 0) return; diff --git a/PGenerate.h b/PGenerate.h index 7f8cecefc..8a8dce377 100644 --- a/PGenerate.h +++ b/PGenerate.h @@ -1,7 +1,7 @@ #ifndef __PGenerate_H #define __PGenerate_H /* - * Copyright (c) 2006-2008 Stephen Williams (steve@icarus.com) + * Copyright (c) 2006-2009 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -87,6 +87,9 @@ class PGenerate : public LineInfo, public LexicalScope { map tasks; mapfuncs; + // genvars declared within this scheme. + map genvars; + // Generate schemes can contain further generate schemes. list generate_schemes; PGenerate*parent; @@ -109,8 +112,8 @@ class PGenerate : public LineInfo, public LexicalScope { bool generate_scope_case_(Design*des, NetScope*container); bool generate_scope_nblock_(Design*des, NetScope*container); - // Call probe during elaborate_scope to calulate the - // directed_nested_ flag. It is OK to store the direct_nested_ + // Call probe during elaborate_scope to calculate the + // direct_nested_ flag. It is OK to store the direct_nested_ // information here because "direct nested" is a property of // the lexical generate code. void probe_for_direct_nesting_(void); diff --git a/compiler.h b/compiler.h index 94bf37c2c..a9922baf9 100644 --- a/compiler.h +++ b/compiler.h @@ -82,6 +82,9 @@ extern bool warn_timescale; /* Warn about legal but questionable module port bindings. */ extern bool warn_portbinding; +/* Warn about constant out of bound selects. */ +extern bool warn_ob_select; + /* Warn about structures that may have infinite loops. */ extern bool warn_inf_loop; diff --git a/config.guess b/config.guess index e38e3d54a..da8331460 100755 --- a/config.guess +++ b/config.guess @@ -1,9 +1,10 @@ #! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002 Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 +# Free Software Foundation, Inc. -timestamp='2002-07-23' +timestamp='2009-04-27' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -17,13 +18,15 @@ timestamp='2002-07-23' # # 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. + # Originally written by Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. @@ -53,8 +56,8 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 -Free Software Foundation, Inc. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -66,11 +69,11 @@ Try \`$me --help' for more information." while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) - echo "$timestamp" ; exit 0 ;; + echo "$timestamp" ; exit ;; --version | -v ) - echo "$version" ; exit 0 ;; + echo "$version" ; exit ;; --help | --h* | -h ) - echo "$usage"; exit 0 ;; + echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. @@ -98,30 +101,32 @@ trap 'exit 1' 1 2 15 # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. -# This shell variable is my proudest work .. or something. --bje +# Portable tmp directory creation inspired by the Autoconf team. -set_cc_for_build='tmpdir=${TMPDIR-/tmp}/config-guess-$$ ; -(old=`umask` && umask 077 && mkdir $tmpdir && umask $old && unset old) - || (echo "$me: cannot create $tmpdir" >&2 && exit 1) ; -dummy=$tmpdir/dummy ; -files="$dummy.c $dummy.o $dummy.rel $dummy" ; -trap '"'"'rm -f $files; rmdir $tmpdir; exit 1'"'"' 1 2 15 ; +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do - if ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ; then + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; - rm -f $files ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac ; -unset files' +esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) @@ -134,16 +139,6 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown -case "${UNAME_MACHINE}" in - i?86) - test -z "$VENDOR" && VENDOR=pc - ;; - *) - test -z "$VENDOR" && VENDOR=unknown - ;; -esac -test -f /etc/SuSE-release && VENDOR=suse - # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in @@ -166,6 +161,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched @@ -188,144 +184,128 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in ;; esac # The OS release - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" - exit 0 ;; - amiga:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - arc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - hp300:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mac68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - macppc:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme88k:OpenBSD:*:*) - echo m88k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvmeppc:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - pmax:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sgi:OpenBSD:*:*) - echo mipseb-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sun3:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - wgrisc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; + exit ;; *:OpenBSD:*:*) - echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + exit ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit ;; + *:SolidBSD:*:*) + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} + exit ;; + macppc:MirBSD:*:*) + echo powerpc-unknown-mirbsd${UNAME_RELEASE} + exit ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit ;; alpha:OSF1:*:*) - if test $UNAME_RELEASE = "V4.0"; then + case $UNAME_RELEASE in + *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - fi + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE="alpha" ;; + "EV4.5 (21064)") + UNAME_MACHINE="alpha" ;; + "LCA4 (21066/21068)") + UNAME_MACHINE="alpha" ;; + "EV5 (21164)") + UNAME_MACHINE="alphaev5" ;; + "EV5.6 (21164A)") + UNAME_MACHINE="alphaev56" ;; + "EV5.6 (21164PC)") + UNAME_MACHINE="alphapca56" ;; + "EV5.7 (21164PC)") + UNAME_MACHINE="alphapca57" ;; + "EV6 (21264)") + UNAME_MACHINE="alphaev6" ;; + "EV6.7 (21264A)") + UNAME_MACHINE="alphaev67" ;; + "EV6.8CB (21264C)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8AL (21264B)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8CX (21264D)") + UNAME_MACHINE="alphaev68" ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE="alphaev69" ;; + "EV7 (21364)") + UNAME_MACHINE="alphaev7" ;; + "EV7.9 (21364A)") + UNAME_MACHINE="alphaev79" ;; + esac + # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. - eval $set_cc_for_build - cat <$dummy.s - .data -\$Lformat: - .byte 37,100,45,37,120,10,0 # "%d-%x\n" - - .text - .globl main - .align 4 - .ent main -main: - .frame \$30,16,\$26,0 - ldgp \$29,0(\$27) - .prologue 1 - .long 0x47e03d80 # implver \$0 - lda \$2,-1 - .long 0x47e20c21 # amask \$2,\$1 - lda \$16,\$Lformat - mov \$0,\$17 - not \$1,\$18 - jsr \$26,printf - ldgp \$29,0(\$26) - mov 0,\$16 - jsr \$26,exit - .end main -EOF - $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null - if test "$?" = 0 ; then - case `$dummy` in - 0-0) - UNAME_MACHINE="alpha" - ;; - 1-0) - UNAME_MACHINE="alphaev5" - ;; - 1-1) - UNAME_MACHINE="alphaev56" - ;; - 1-101) - UNAME_MACHINE="alphapca56" - ;; - 2-303) - UNAME_MACHINE="alphaev6" - ;; - 2-307) - UNAME_MACHINE="alphaev67" - ;; - 2-1307) - UNAME_MACHINE="alphaev68" - ;; - 3-1307) - UNAME_MACHINE="alphaev7" - ;; - esac - fi - rm -f $dummy.s $dummy && rmdir $tmpdir - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - exit 0 ;; + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix - exit 0 ;; + exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 - exit 0 ;; + exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 - exit 0;; + exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos - exit 0 ;; + exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos - exit 0 ;; + exit ;; *:OS/390:*:*) echo i370-ibm-openedition - exit 0 ;; + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} - exit 0;; + exit ;; + arm:riscos:*:*|arm:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp - exit 0;; + exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then @@ -333,29 +313,48 @@ EOF else echo pyramid-pyramid-bsd fi - exit 0 ;; + exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 - exit 0 ;; - DRS?6000:UNIX_SV:4.2*:7*) + exit ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in - sparc) echo sparc-icl-nx7 && exit 0 ;; + sparc) echo sparc-icl-nx7; exit ;; esac ;; + s390x:SunOS:*:*) + echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - i86pc:SunOS:5.*:*) - echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) + eval $set_cc_for_build + SUN_ARCH="i386" + # If there is a compiler, see if it is configured for 64-bit objects. + # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. + # This test works for both compilers. + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + SUN_ARCH="x86_64" + fi + fi + echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) @@ -364,10 +363,10 @@ EOF esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit 0 ;; + exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} - exit 0 ;; + exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 @@ -379,10 +378,10 @@ EOF echo sparc-sun-sunos${UNAME_RELEASE} ;; esac - exit 0 ;; + exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} - exit 0 ;; + exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor @@ -393,37 +392,40 @@ EOF # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} - exit 0 ;; + exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 - exit 0 ;; + exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} - exit 0 ;; + exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} - exit 0 ;; + exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} - exit 0 ;; + exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c @@ -447,30 +449,33 @@ EOF exit (-1); } EOF - $CC_FOR_BUILD $dummy.c -o $dummy \ - && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ - && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 - rm -f $dummy.c $dummy && rmdir $tmpdir + $CC_FOR_BUILD -o $dummy $dummy.c && + dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`$dummy $dummyarg` && + { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} - exit 0 ;; + exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax - exit 0 ;; - Night_Hawk:*:*:PowerMAX_OS) + exit ;; + Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax - exit 0 ;; + exit ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix - exit 0 ;; + exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 - exit 0 ;; + exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 - exit 0 ;; + exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 - exit 0 ;; + exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` @@ -486,29 +491,29 @@ EOF else echo i586-dg-dgux${UNAME_RELEASE} fi - exit 0 ;; + exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 - exit 0 ;; + exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 - exit 0 ;; + exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 - exit 0 ;; + exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd - exit 0 ;; + exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit 0 ;; + exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix - exit 0 ;; + exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` @@ -516,7 +521,7 @@ EOF IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} - exit 0 ;; + exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build @@ -531,16 +536,19 @@ EOF exit(0); } EOF - $CC_FOR_BUILD $dummy.c -o $dummy && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 - rm -f $dummy.c $dummy && rmdir $tmpdir - echo rs6000-ibm-aix3.2.5 + if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi - exit 0 ;; - *:AIX:*:[45]) + exit ;; + *:AIX:*:[456]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 @@ -553,28 +561,28 @@ EOF IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit 0 ;; + exit ;; *:AIX:*:*) echo rs6000-ibm-aix - exit 0 ;; + exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 - exit 0 ;; + exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to - exit 0 ;; # report: romp-ibm BSD 4.3 + exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx - exit 0 ;; + exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 - exit 0 ;; + exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd - exit 0 ;; + exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 - exit 0 ;; + exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in @@ -630,17 +638,37 @@ EOF exit (0); } EOF - (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null) && HP_ARCH=`$dummy` - if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi - rm -f $dummy.c $dummy && rmdir $tmpdir + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac + if [ ${HP_ARCH} = "hppa2.0w" ] + then + eval $set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + grep __LP64__ >/dev/null + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit 0 ;; + exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} - exit 0 ;; + exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c @@ -668,146 +696,192 @@ EOF exit (0); } EOF - $CC_FOR_BUILD $dummy.c -o $dummy && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 - rm -f $dummy.c $dummy && rmdir $tmpdir + $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 - exit 0 ;; + exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd - exit 0 ;; + exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd - exit 0 ;; + exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix - exit 0 ;; + exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf - exit 0 ;; + exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf - exit 0 ;; + exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi - exit 0 ;; + exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites - exit 0 ;; + exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd - exit 0 ;; + exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi - exit 0 ;; + exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd - exit 0 ;; + exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd - exit 0 ;; + exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd - exit 0 ;; + exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY*T3D:*:*:*) - echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; + *:UNICOS/mp:*:*) + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit 0 ;; + exit ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit 0 ;; + exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; + exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; + exit ;; *:FreeBSD:*:*) - # Determine whether the default compiler uses glibc. - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - #if __GLIBC__ >= 2 - LIBC=gnu - #else - LIBC= - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - rm -f $dummy.c && rmdir $tmpdir - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} - exit 0 ;; + case ${UNAME_MACHINE} in + pc98) + echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + amd64) + echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac + exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin - exit 0 ;; - i*:MINGW*:*) + exit ;; + *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 - exit 0 ;; + exit ;; + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 + exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 - exit 0 ;; - x86:Interix*:3*) - echo i386-pc-interix3 - exit 0 ;; + exit ;; + *:Interix*:[3456]*) + case ${UNAME_MACHINE} in + x86) + echo i586-pc-interix${UNAME_RELEASE} + exit ;; + EM64T | authenticamd | genuineintel) + echo x86_64-unknown-interix${UNAME_RELEASE} + exit ;; + IA64) + echo ia64-unknown-interix${UNAME_RELEASE} + exit ;; + esac ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? - echo i386-pc-interix - exit 0 ;; + echo i586-pc-interix + exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin - exit 0 ;; + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin - exit 0 ;; + exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; *:GNU:*:*) + # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit 0 ;; + exit ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix - exit 0 ;; + exit ;; arm*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux - exit 0 ;; + eval $set_cc_for_build + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_EABI__ + then + echo ${UNAME_MACHINE}-unknown-linux-gnu + else + echo ${UNAME_MACHINE}-unknown-linux-gnueabi + fi + exit ;; + avr32*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + cris:Linux:*:*) + echo cris-axis-linux-gnu + exit ;; + crisv32:Linux:*:*) + echo crisv32-axis-linux-gnu + exit ;; + frv:Linux:*:*) + echo frv-unknown-linux-gnu + exit ;; ia64:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux - exit 0 ;; + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; m68*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux - exit 0 ;; + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c @@ -824,16 +898,45 @@ EOF #endif #endif EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - rm -f $dummy.c && rmdir $tmpdir - test x"${CPU}" != x && echo "${CPU}-${VENDOR}-linux" && exit 0 + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^CPU/{ + s: ::g + p + }'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; + mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips64 + #undef mips64el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mips64el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips64 + #else + CPU= + #endif + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^CPU/{ + s: ::g + p + }'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + or32:Linux:*:*) + echo or32-unknown-linux-gnu + exit ;; ppc:Linux:*:*) - echo powerpc-${VENDOR}-linux - exit 0 ;; + echo powerpc-unknown-linux-gnu + exit ;; ppc64:Linux:*:*) - echo powerpc64-${VENDOR}-linux - exit 0 ;; + echo powerpc64-unknown-linux-gnu + exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; @@ -846,31 +949,43 @@ EOF esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-${VENDOR}-linux${LIBC} - exit 0 ;; + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit ;; + padre:Linux:*:*) + echo sparc-unknown-linux-gnu + exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-${VENDOR}-linux ;; - PA8*) echo hppa2.0-${VENDOR}-linux ;; - *) echo hppa-${VENDOR}-linux ;; + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; esac - exit 0 ;; + exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-${VENDOR}-linux - exit 0 ;; + echo hppa64-unknown-linux-gnu + exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux - exit 0 ;; + exit ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; sh*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux - exit 0 ;; + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux - exit 0 ;; + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux-gnu + exit ;; x86_64:Linux:*:*) - echo x86_64-${VENDOR}-linux - exit 0 ;; + echo x86_64-unknown-linux-gnu + exit ;; + xtensa*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent @@ -884,19 +999,16 @@ EOF p'` case "$ld_supported_targets" in elf32-i386) - TENTATIVE="${UNAME_MACHINE}-${VENDOR}-linux" + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) - echo "${UNAME_MACHINE}-${VENDOR}-linuxaout" - exit 0 ;; - coff-i386) - echo "${UNAME_MACHINE}-${VENDOR}-linuxcoff" - exit 0 ;; + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit ;; "") - # Either a pre-BFD a.out linker (linuxoldld) or + # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. - echo "${UNAME_MACHINE}-${VENDOR}-linuxoldld" - exit 0 ;; + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build @@ -913,24 +1025,33 @@ EOF LIBC=gnulibc1 # endif #else - #ifdef __INTEL_COMPILER + #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) LIBC=gnu #else LIBC=gnuaout #endif #endif + #ifdef __dietlibc__ + LIBC=dietlibc + #endif EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - rm -f $dummy.c && rmdir $tmpdir - test x"${LIBC}" != x && echo "${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}" | sed 's/linux-gnu/linux/' && exit 0 - test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^LIBC/{ + s: ::g + p + }'`" + test x"${LIBC}" != x && { + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit + } + test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 - exit 0 ;; + exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... @@ -938,7 +1059,27 @@ EOF # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - exit 0 ;; + exit ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then @@ -946,15 +1087,16 @@ EOF else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi - exit 0 ;; - i*86:*:5:[78]*) + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} - exit 0 ;; + exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi - exit 0 ;; + exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv - exit 0 ;; - M68*:*:R3V[567]*:*) - test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; - 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0) + exit ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4.3${OS_REL} && exit 0 + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4 && exit 0 ;; + && { echo i486-ncr-sysv4; exit; } ;; + NCR*:*:4.2:* | MPRAS*:*:4.2:*) + OS_REL='.3' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 - exit 0 ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} - exit 0 ;; + exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 - exit 0 ;; + exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 - exit 0 ;; + exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` @@ -1046,61 +1201,84 @@ EOF else echo ns32k-sni-sysv fi - exit 0 ;; + exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 - exit 0 ;; + exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 - exit 0 ;; + exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 - exit 0 ;; + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo ${UNAME_MACHINE}-stratus-vos + exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos - exit 0 ;; + exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} - exit 0 ;; + exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 - exit 0 ;; + exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi - exit 0 ;; + exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos - exit 0 ;; + exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos - exit 0 ;; + exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos - exit 0 ;; + exit ;; + BePC:Haiku:*:*) # Haiku running on Intel PC compatible. + echo i586-pc-haiku + exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} - exit 0 ;; + exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} - exit 0 ;; + exit ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit ;; + SX-7:SUPER-UX:*:*) + echo sx7-nec-superux${UNAME_RELEASE} + exit ;; + SX-8:SUPER-UX:*:*) + echo sx8-nec-superux${UNAME_RELEASE} + exit ;; + SX-8R:SUPER-UX:*:*) + echo sx8r-nec-superux${UNAME_RELEASE} + exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; + exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; + exit ;; *:Darwin:*:*) - echo `uname -p`-apple-darwin${UNAME_RELEASE} - exit 0 ;; + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + case $UNAME_PROCESSOR in + unknown) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then @@ -1108,22 +1286,25 @@ EOF UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} - exit 0 ;; + exit ;; *:QNX:*:4*) echo i386-pc-qnx - exit 0 ;; - NSR-[GKLNPTVW]:NONSTOP_KERNEL:*:*) + exit ;; + NSE-?:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; + NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} - exit 0 ;; + exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux - exit 0 ;; + exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv - exit 0 ;; + exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} - exit 0 ;; + exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 @@ -1134,36 +1315,50 @@ EOF UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 - exit 0 ;; - i*86:OS/2:*:*) - # If we were able to find `uname', then EMX Unix compatibility - # is probably installed. - echo ${UNAME_MACHINE}-pc-os2-emx - exit 0 ;; + exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 - exit 0 ;; + exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex - exit 0 ;; + exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 - exit 0 ;; + exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 - exit 0 ;; + exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 - exit 0 ;; + exit ;; *:ITS:*:*) echo pdp10-unknown-its - exit 0 ;; - i*86:XTS-300:*:STOP) - echo ${UNAME_MACHINE}-unknown-stop - exit 0 ;; - i*86:atheos:*:*) - echo ${UNAME_MACHINE}-unknown-atheos - exit 0 ;; + exit ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + exit ;; + i*86:rdos:*:*) + echo ${UNAME_MACHINE}-pc-rdos + exit ;; + i*86:AROS:*:*) + echo ${UNAME_MACHINE}-pc-aros + exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 @@ -1195,7 +1390,7 @@ main () #endif #if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix"); exit (0); + printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) @@ -1284,12 +1479,12 @@ main () } EOF -$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 -rm -f $dummy.c $dummy && rmdir $tmpdir +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) @@ -1298,22 +1493,22 @@ then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd - exit 0 ;; + exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi - exit 0 ;; + exit ;; c34*) echo c34-convex-bsd - exit 0 ;; + exit ;; c38*) echo c38-convex-bsd - exit 0 ;; + exit ;; c4*) echo c4-convex-bsd - exit 0 ;; + exit ;; esac fi @@ -1324,7 +1519,9 @@ This script, last modified $timestamp, has failed to recognize the operating system you are using. It is advised that you download the most up to date version of the config scripts from - ftp://ftp.gnu.org/pub/gnu/config/ + http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD +and + http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD If the version you run ($0) is already up to date, please send the following data and any information you think might be diff --git a/config.sub b/config.sub index 09de79bf0..a39437d01 100755 --- a/config.sub +++ b/config.sub @@ -1,9 +1,10 @@ #! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002 Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 +# Free Software Foundation, Inc. -timestamp='2002-07-03' +timestamp='2009-04-17' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -21,14 +22,15 @@ timestamp='2002-07-03' # # 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., 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. - +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. + # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # @@ -70,8 +72,8 @@ Report bugs and patches to ." version="\ GNU config.sub ($timestamp) -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 -Free Software Foundation, Inc. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -83,11 +85,11 @@ Try \`$me --help' for more information." while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) - echo "$timestamp" ; exit 0 ;; + echo "$timestamp" ; exit ;; --version | -v ) - echo "$version" ; exit 0 ;; + echo "$version" ; exit ;; --help | --h* | -h ) - echo "$usage"; exit 0 ;; + echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. @@ -99,7 +101,7 @@ while test $# -gt 0 ; do *local*) # First pass through any local machine types. echo $1 - exit 0;; + exit ;; * ) break ;; @@ -118,7 +120,10 @@ esac # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in - nto-qnx* | linux-gnu* | freebsd*-gnu* | storm-chaos* | os2-emx* | windows32-* | rtmk-nova*) + nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ + uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ + kopensolaris*-gnu* | \ + storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; @@ -144,7 +149,7 @@ case $os in -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis) + -apple | -axis | -knuth | -cray) os= basic_machine=$1 ;; @@ -169,6 +174,10 @@ case $os in -hiux*) os=-hiuxwe2 ;; + -sco6) + os=-sco5v6 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` @@ -185,6 +194,10 @@ case $os in # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; + -sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` @@ -228,40 +241,57 @@ case $basic_machine in | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ + | am33_2.0 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ + | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ - | fr30 | frv \ + | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ - | ip2k \ - | m32r | m68000 | m68k | m88k | mcore \ + | ip2k | iq2000 \ + | lm32 \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ + | maxq | mb | microblaze | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ + | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ + | mips64r5900 | mips64r5900el \ + | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ + | moxie \ + | mt \ + | msp430 \ + | nios | nios2 \ | ns16k | ns32k \ - | openrisc | or32 \ + | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ - | sh | sh[1234] | sh3e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ + | score \ + | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ - | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ - | strongarm \ - | tahoe | thumb | tic80 | tron \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ + | spu | strongarm \ + | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ - | x86 | xscale | xstormy16 | xtensa \ - | z8k) + | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ + | z8k | z80) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) @@ -271,6 +301,9 @@ case $basic_machine in ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; + ms1) + basic_machine=mt-unknown + ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and @@ -290,48 +323,67 @@ case $basic_machine in | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | avr-* \ - | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c54x-* \ - | clipper-* | cydra-* \ + | avr-* | avr32-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ + | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ - | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ + | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ - | ip2k-* \ - | m32r-* \ + | ip2k-* | iq2000-* \ + | lm32-* \ + | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | mcore-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ + | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ + | mips64r5900-* | mips64r5900el-* \ + | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ - | mipstx39 | mipstx39el \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | mt-* \ + | msp430-* \ + | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ - | sh-* | sh[1234]-* | sh3e-* | sh[34]eb-* | shbe-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ - | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ - | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ + | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \ + | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ - | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ - | xtensa-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ + | xstormy16-* | xtensa*-* \ | ymp-* \ - | z8k-*) + | z8k-* | z80-*) + ;; + # Recognize the basic CPU types without company name, with glob match. + xtensa*) + basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. @@ -349,6 +401,9 @@ case $basic_machine in basic_machine=a29k-amd os=-udi ;; + abacus) + basic_machine=abacus-unknown + ;; adobe68k) basic_machine=m68010-adobe os=-scout @@ -363,6 +418,12 @@ case $basic_machine in basic_machine=a29k-none os=-bsd ;; + amd64) + basic_machine=x86_64-pc + ;; + amd64-*) + basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; amdahl) basic_machine=580-amdahl os=-sysv @@ -386,6 +447,10 @@ case $basic_machine in basic_machine=m68k-apollo os=-bsd ;; + aros) + basic_machine=i386-pc + os=-aros + ;; aux) basic_machine=m68k-apple os=-aux @@ -394,10 +459,22 @@ case $basic_machine in basic_machine=ns32k-sequent os=-dynix ;; + blackfin) + basic_machine=bfin-unknown + os=-linux + ;; + blackfin-*) + basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; c90) basic_machine=c90-cray os=-unicos ;; + cegcc) + basic_machine=arm-unknown + os=-cegcc + ;; convex-c1) basic_machine=c1-convex os=-bsd @@ -422,12 +499,27 @@ case $basic_machine in basic_machine=j90-cray os=-unicos ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16) + basic_machine=cr16-unknown + os=-elf + ;; crds | unos) basic_machine=m68k-crds ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; da30 | da30-*) basic_machine=m68k-da30 ;; @@ -450,6 +542,14 @@ case $basic_machine in basic_machine=m88k-motorola os=-sysv3 ;; + dicos) + basic_machine=i686-pc + os=-dicos + ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx @@ -600,6 +700,14 @@ case $basic_machine in basic_machine=m68k-isi os=-sysv ;; + m68knommu) + basic_machine=m68k-unknown + os=-linux + ;; + m68knommu-*) + basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; m88k-omron*) basic_machine=m88k-omron ;; @@ -615,6 +723,10 @@ case $basic_machine in basic_machine=i386-pc os=-mingw32 ;; + mingw32ce) + basic_machine=arm-unknown + os=-mingw32ce + ;; miniframe) basic_machine=m68000-convergent ;; @@ -628,10 +740,6 @@ case $basic_machine in mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; - mmix*) - basic_machine=mmix-knuth - os=-mmixware - ;; monitor) basic_machine=m68k-rom68k os=-coff @@ -644,6 +752,9 @@ case $basic_machine in basic_machine=i386-pc os=-msdos ;; + ms1-*) + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; mvs) basic_machine=i370-ibm os=-mvs @@ -719,9 +830,12 @@ case $basic_machine in basic_machine=hppa1.1-oki os=-proelf ;; - or32 | or32-*) + openrisc | openrisc-*) basic_machine=or32-unknown - os=-coff + ;; + os400) + basic_machine=powerpc-ibm + os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson @@ -739,55 +853,75 @@ case $basic_machine in basic_machine=i860-intel os=-osf ;; + parisc) + basic_machine=hppa-unknown + os=-linux + ;; + parisc-*) + basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; - pc532 | pc532-*) + pc532 | pc532-*) basic_machine=ns32k-pc532 ;; + pc98) + basic_machine=i386-pc + ;; + pc98-*) + basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; - pentiumpro | p6 | 6x86 | athlon) + pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; - pentiumii | pentium2) + pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; + pentium4) + basic_machine=i786-pc + ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - pentiumii-* | pentium2-*) + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown - ;; + ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown - ;; + ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown - ;; + ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown - ;; + ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; @@ -798,6 +932,10 @@ case $basic_machine in basic_machine=i586-unknown os=-pw32 ;; + rdos) + basic_machine=i386-pc + os=-rdos + ;; rom68k) basic_machine=m68k-rom68k os=-coff @@ -818,6 +956,20 @@ case $basic_machine in basic_machine=a29k-amd os=-udi ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sde) + basic_machine=mipsisa32-sde + os=-elf + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; sequent) basic_machine=i386-sequent ;; @@ -825,6 +977,12 @@ case $basic_machine in basic_machine=sh-hitachi os=-hms ;; + sh5el) + basic_machine=sh5le-unknown + ;; + sh64) + basic_machine=sh64-unknown + ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks @@ -883,7 +1041,7 @@ case $basic_machine in sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; - sv1) + sv1) basic_machine=sv1-cray os=-unicos ;; @@ -891,10 +1049,6 @@ case $basic_machine in basic_machine=i386-sequent os=-dynix ;; - t3d) - basic_machine=alpha-cray - os=-unicos - ;; t3e) basic_machine=alphaev5-cray os=-unicos @@ -907,6 +1061,18 @@ case $basic_machine in basic_machine=tic54x-unknown os=-coff ;; + tic55x | c55x*) + basic_machine=tic55x-unknown + os=-coff + ;; + tic6x | c6x*) + basic_machine=tic6x-unknown + os=-coff + ;; + tile*) + basic_machine=tile-unknown + os=-linux-gnu + ;; tx39) basic_machine=mipstx39-unknown ;; @@ -920,6 +1086,10 @@ case $basic_machine in tower | tower-32) basic_machine=m68k-ncr ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; udi29k) basic_machine=a29k-amd os=-udi @@ -941,8 +1111,8 @@ case $basic_machine in os=-vms ;; vpp*|vx|vx-*) - basic_machine=f301-fujitsu - ;; + basic_machine=f301-fujitsu + ;; vxworks960) basic_machine=i960-wrs os=-vxworks @@ -963,11 +1133,11 @@ case $basic_machine in basic_machine=hppa1.1-winbond os=-proelf ;; - windows32) - basic_machine=i386-pc - os=-windows32-msvcrt + xbox) + basic_machine=i686-pc + os=-mingw32 ;; - xps | xps100) + xps | xps100) basic_machine=xps100-honeywell ;; ymp) @@ -978,6 +1148,10 @@ case $basic_machine in basic_machine=z8k-unknown os=-sim ;; + z80-*-coff) + basic_machine=z80-unknown + os=-sim + ;; none) basic_machine=none-none os=-none @@ -997,6 +1171,9 @@ case $basic_machine in romp) basic_machine=romp-ibm ;; + mmix) + basic_machine=mmix-knuth + ;; rs6000) basic_machine=rs6000-ibm ;; @@ -1013,16 +1190,13 @@ case $basic_machine in we32k) basic_machine=we32k-att ;; - sh3 | sh4 | sh3eb | sh4eb | sh[1234]le | sh3ele) + sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; - sh64) - basic_machine=sh64-unknown - ;; - sparc | sparcv9 | sparcv9b) + sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; - cydra) + cydra) basic_machine=cydra-cydrome ;; orion) @@ -1037,10 +1211,6 @@ case $basic_machine in pmac | pmac-mpw) basic_machine=powerpc-apple ;; - c4x*) - basic_machine=c4x-none - os=-coff - ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; @@ -1092,22 +1262,28 @@ case $os in -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -kopensolaris* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* \ + | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ - | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ + | -openbsd* | -solidbsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* \ + | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux* | -uxpv* | -beos* | -mpeix* | -udk* \ - | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ + | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ - | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* | -powermax*) + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku* | -rdos* | -toppers* | -drops*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1119,16 +1295,24 @@ case $os in ;; esac ;; + -nto-qnx*) + ;; -nto*) - os=-nto-qnx + os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; @@ -1138,6 +1322,9 @@ case $os in -opened*) os=-openedition ;; + -os400*) + os=-os400 + ;; -wince*) os=-wince ;; @@ -1159,6 +1346,9 @@ case $os in -atheos*) os=-atheos ;; + -syllable*) + os=-syllable + ;; -386bsd) os=-bsd ;; @@ -1169,7 +1359,7 @@ case $os in os=-rtmk-nova ;; -ns2 ) - os=-nextstep2 + os=-nextstep2 ;; -nsk*) os=-nsk @@ -1181,6 +1371,9 @@ case $os in -sinix*) os=-sysv4 ;; + -tpf*) + os=-tpf + ;; -triton*) os=-sysv3 ;; @@ -1208,8 +1401,20 @@ case $os in -xenix) os=-xenix ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - os=-mint + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -aros*) + os=-aros + ;; + -kaos*) + os=-kaos + ;; + -zvmoe) + os=-zvmoe + ;; + -dicos*) + os=-dicos ;; -none) ;; @@ -1233,6 +1438,12 @@ else # system, and we'll never get to this point. case $basic_machine in + score-*) + os=-elf + ;; + spu-*) + os=-elf + ;; *-acorn) os=-riscix1.2 ;; @@ -1242,11 +1453,14 @@ case $basic_machine in arm*-semi) os=-aout ;; + c4x-* | tic4x-*) + os=-coff + ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; - pdp11-*) + pdp11-*) os=-none ;; *-dec | vax-*) @@ -1267,6 +1481,9 @@ case $basic_machine in m68*-cisco) os=-aout ;; + mep-*) + os=-elf + ;; mips*-cisco) os=-elf ;; @@ -1285,9 +1502,15 @@ case $basic_machine in *-be) os=-beos ;; + *-haiku) + os=-haiku + ;; *-ibm) os=-aix ;; + *-knuth) + os=-mmixware + ;; *-wec) os=-proelf ;; @@ -1339,19 +1562,19 @@ case $basic_machine in *-next) os=-nextstep3 ;; - *-gould) + *-gould) os=-sysv ;; - *-highlevel) + *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; - *-sgi) + *-sgi) os=-irix ;; - *-siemens) + *-siemens) os=-sysv4 ;; *-masscomp) @@ -1420,9 +1643,15 @@ case $basic_machine in -mvs* | -opened*) vendor=ibm ;; + -os400*) + vendor=ibm + ;; -ptx*) vendor=sequent ;; + -tpf*) + vendor=ibm + ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; @@ -1447,7 +1676,7 @@ case $basic_machine in esac echo $basic_machine$os -exit 0 +exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) diff --git a/driver/cflexor.lex b/driver/cflexor.lex index 526f8eaed..8e3277d22 100644 --- a/driver/cflexor.lex +++ b/driver/cflexor.lex @@ -72,6 +72,8 @@ int cmdfile_stack_ptr = 0; \n { cflloc.first_line += 1; } +"+parameter+" { BEGIN(PLUS_ARGS); return TOK_PARAMETER; } + "+define+" { BEGIN(PLUS_ARGS); return TOK_DEFINE; } "+incdir+" { BEGIN(PLUS_ARGS); return TOK_INCDIR; } diff --git a/driver/cfparse.y b/driver/cfparse.y index 9ee38e7d3..9572484d1 100644 --- a/driver/cfparse.y +++ b/driver/cfparse.y @@ -57,7 +57,7 @@ static void translate_file_name(char*text) }; %token TOK_Da TOK_Dc TOK_Dv TOK_Dy -%token TOK_DEFINE TOK_INCDIR TOK_LIBDIR TOK_LIBDIR_NOCASE TOK_LIBEXT +%token TOK_DEFINE TOK_INCDIR TOK_LIBDIR TOK_LIBDIR_NOCASE TOK_LIBEXT TOK_PARAMETER %token TOK_INTEGER_WIDTH %token TOK_PLUSARG TOK_PLUSWORD TOK_STRING @@ -135,6 +135,13 @@ item free(tmp); } + | TOK_PARAMETER TOK_PLUSARG + { char*tmp = substitutions($2); + process_parameter(tmp); + free($2); + free(tmp); + } + | TOK_DEFINE TOK_PLUSARG { process_define($2); free($2); diff --git a/driver/globals.h b/driver/globals.h index 0cc16728b..e78f00e83 100644 --- a/driver/globals.h +++ b/driver/globals.h @@ -65,7 +65,10 @@ extern void process_include_dir(const char*name); /* Add a new -D define. */ extern void process_define(const char*name); - + + /* Add a new parameter definition */ +extern void process_parameter(const char*name); + /* -v */ extern int verbose_flag; diff --git a/driver/iverilog.man b/driver/iverilog.man index e739aed2f..c81d463eb 100644 --- a/driver/iverilog.man +++ b/driver/iverilog.man @@ -4,10 +4,10 @@ iverilog - Icarus Verilog compiler .SH SYNOPSIS .B iverilog -[-ESVv] [-Bpath] [-ccmdfile|-fcmdfile] [-Dmacro[=defn]] [-pflag=value] -[-dname] [-g1995|-g2001|-g2005|-g] -[-Iincludedir] [-mmodule] [-Mfile] [-Nfile] [-ooutputfilename] -[-stopmodule] [-ttype] [-Tmin/typ/max] [-Wclass] [-ypath] sourcefile +[\-ESVv] [\-Bpath] [\-ccmdfile|\-fcmdfile] [\-Dmacro[=defn]] [\-pflag=value] +[\-dname] [\-g1995|\-g2001|\-g2005|\-g] +[\-Iincludedir] [\-mmodule] [\-Mfile] [\-Nfile] [\-ooutputfilename] +[\-stopmodule] [\-ttype] [\-Tmin/typ/max] [\-Wclass] [\-ypath] sourcefile .SH DESCRIPTION .PP @@ -18,7 +18,6 @@ simulation, and \fIfpga\fP for synthesis. Other target types are added as code generators are implemented. .SH OPTIONS -.l \fIiverilog\fP accepts the following options: .TP 8 .B -B\fIbase\fP @@ -260,7 +259,8 @@ after a \fB-Wall\fP argument to suppress isolated warning types. .TP 8 .B all -This enables the implicit, portbind and timescale warning categories. +This enables the implicit, portbind, select-range and timescale warning +categories. .TP 8 .B implicit @@ -274,6 +274,12 @@ This enables warnings for ports of module instantiations that are not connected but probably should be. Dangling input ports, for example, will generate a warning. +.TP 8 +.B select-range +This enables warnings for constant out of bound selects. This includes +partial or fully out of bound selects as well as a select using 'bx as +an index. + .TP 8 .B timescale This enables warnings for inconsistent use of the timescale @@ -369,7 +375,7 @@ on to the next library directory. .TP 8 .B +libdir+\fIdir\fP -This is another way to specify library directories. See the -y flag. +This is another way to specify library directories. See the \-y flag. .TP 8 .B +libdir-nocase+\fIdir\fP @@ -434,11 +440,11 @@ To compile hello.v to an executable file called a.out: To compile hello.v to an executable file called hello: - iverilog -o hello hello.v + iverilog \-o hello hello.v To compile and run explicitly using the vvp runtime: - iverilog -ohello.vvp -tvvp hello.v + iverilog \-ohello.vvp \-tvvp hello.v .SH "AUTHOR" .nf diff --git a/driver/main.c b/driver/main.c index f7a7574d0..c75eb09c2 100644 --- a/driver/main.c +++ b/driver/main.c @@ -167,6 +167,12 @@ typedef struct t_command_file { p_command_file cmd_file_head = NULL; /* The FIFO head */ p_command_file cmd_file_tail = NULL; /* The FIFO tail */ +/* Temprarily store parameter definition from command line and + * parse it after we have delt with command file + */ +static const char** defparm_base = 0; +static int defparm_size = 0; + /* Function to add a command file name to the FIFO. */ void add_cmd_file(const char* filename) { @@ -469,6 +475,7 @@ static void process_warning_switch(const char*name) if (strcmp(name,"all") == 0) { process_warning_switch("implicit"); process_warning_switch("portbind"); + process_warning_switch("select-range"); process_warning_switch("timescale"); } else if (strcmp(name,"implicit") == 0) { if (! strchr(warning_flags, 'i')) @@ -476,6 +483,9 @@ static void process_warning_switch(const char*name) } else if (strcmp(name,"portbind") == 0) { if (! strchr(warning_flags, 'p')) strcat(warning_flags, "p"); + } else if (strcmp(name,"select-range") == 0) { + if (! strchr(warning_flags, 's')) + strcat(warning_flags, "s"); } else if (strcmp(name,"timescale") == 0) { if (! strchr(warning_flags, 't')) strcat(warning_flags, "t"); @@ -496,6 +506,12 @@ static void process_warning_switch(const char*name) cp[0] = cp[1]; cp += 1; } + } else if (strcmp(name,"no-select-range") == 0) { + char*cp = strchr(warning_flags, 's'); + if (cp) while (*cp) { + cp[0] = cp[1]; + cp += 1; + } } else if (strcmp(name,"no-timescale") == 0) { char*cp = strchr(warning_flags, 't'); if (cp) while (*cp) { @@ -530,6 +546,11 @@ void process_define(const char*name) fprintf(defines_file,"D:%s\n", name); } +void process_parameter(const char*name) +{ + fprintf(iconfig_file,"defparam:%s\n", name); +} + /* * This function is called while processing a file name in a command * file, or a file name on the command line. Look to see if there is a @@ -774,7 +795,7 @@ int main(int argc, char **argv) } } - while ((opt = getopt(argc, argv, "B:c:D:d:Ef:g:hI:M:m:N::o:p:Ss:T:t:vVW:y:Y:")) != EOF) { + while ((opt = getopt(argc, argv, "B:c:D:d:Ef:g:hI:M:m:N::o:P:p:Ss:T:t:vVW:y:Y:")) != EOF) { switch (opt) { case 'B': @@ -798,6 +819,11 @@ int main(int argc, char **argv) case 'E': e_flag = 1; break; + case 'P': + defparm_size += 1; + defparm_base = (const char**)realloc(defparm_base, defparm_size*sizeof(char*)); + defparm_base[defparm_size-1] = optarg; + break; case 'p': fprintf(iconfig_file, "flag:%s\n", optarg); break; @@ -966,6 +992,15 @@ int main(int argc, char **argv) fprintf(defines_file, "M:%s\n", depfile); } + /* Process parameter definition from command line. The last + defined would override previous ones. */ + int pitr; + for (pitr = 0; pitr < defparm_size; pitr++) + process_parameter(defparm_base[pitr]); + free(defparm_base); + defparm_base = 0; + defparm_size = 0; + /* Finally, process all the remaining words on the command line as file names. */ for (idx = optind ; idx < argc ; idx += 1) diff --git a/elab_expr.cc b/elab_expr.cc index b40044af5..261539812 100644 --- a/elab_expr.cc +++ b/elab_expr.cc @@ -2210,12 +2210,12 @@ NetExpr* PEIdent::elaborate_expr(Design*des, NetScope*scope, } static verinum param_part_select_bits(const verinum&par_val, long wid, - long lsv, long par_lsv) + long lsv) { verinum result (verinum::Vx, wid, true); for (long idx = 0 ; idx < wid ; idx += 1) { - long off = idx + lsv - par_lsv; + long off = idx + lsv; if (off < 0) result.set(idx, verinum::Vx); else if (off < (long)par_val.len()) @@ -2230,7 +2230,7 @@ static verinum param_part_select_bits(const verinum&par_val, long wid, // If the input is a string, and the part select is working on // byte boundaries, then make the result into a string. - if (par_val.is_string() && (labs(lsv-par_lsv)%8 == 0) && (wid%8 == 0)) + if (par_val.is_string() && (labs(lsv)%8 == 0) && (wid%8 == 0)) return result.as_string(); return result; @@ -2286,28 +2286,56 @@ NetExpr* PEIdent::elaborate_expr_param_part_(Design*des, NetScope*scope, const NetEConst*par_ex = dynamic_cast (par); ivl_assert(*this, par_ex); - verinum result = param_part_select_bits(par_ex->value(), wid, lsv, par_lsv); + verinum result = param_part_select_bits(par_ex->value(), wid, lsv-par_lsv); NetEConst*result_ex = new NetEConst(result); result_ex->set_line(*this); return result_ex; } +static void warn_param_ob(long par_msv, long par_lsv, bool defined, + long par_base, unsigned long wid, long pwid, + const LineInfo *info, perm_string name, bool up) +{ + long par_max; + + if (defined) { + if (par_msv < par_lsv) par_max = par_lsv-par_msv; + else par_max = par_msv-par_lsv; + } else { + if (pwid < 0) par_max = integer_width; + else par_max = pwid; + } + + /* Is this a select before the start of the parameter? */ + if (par_base < 0) { + cerr << info->get_fileline() << ": warning: " << name << "[" + << par_base; + if (up) cerr << "+:"; + else cerr << "-:"; + cerr << wid << "] is selecting before vector." << endl; + } + + /* Is this a select after the end of the parameter? */ + if (par_base + (long)wid - 1 > par_max) { + cerr << info->get_fileline() << ": warning: " << name << "[" + << par_base << "+:" << wid << "] is selecting after vector." + << endl; + } +} + NetExpr* PEIdent::elaborate_expr_param_idx_up_(Design*des, NetScope*scope, const NetExpr*par, NetScope*found_in, const NetExpr*par_msb, const NetExpr*par_lsb) const { - long par_msv, par_lsv; - bool flag = calculate_param_range_(des, scope, par_msb, par_msv, par_lsb, par_lsv); - if (!flag) - return 0; + if(! calculate_param_range_(des, scope, par_msb, par_msv, + par_lsb, par_lsv)) return 0; NetExpr*base = calculate_up_do_base_(des, scope); - if (base == 0) - return 0; + if (base == 0) return 0; unsigned long wid = 0; calculate_up_do_width_(des, scope, wid); @@ -2323,22 +2351,139 @@ NetExpr* PEIdent::elaborate_expr_param_idx_up_(Design*des, NetScope*scope, // Handle the special case that the base is constant. In this // case, just precalculate the entire constant result. if (NetEConst*base_c = dynamic_cast (base)) { + if (! base_c->value().is_defined()) { + NetEConst *ex; + ex = new NetEConst(verinum(verinum::Vx, wid, true)); + ex->set_line(*this); + if (warn_ob_select) { + perm_string name = peek_tail_name(path_); + cerr << get_fileline() << ": warning: " << name + << "['bx+:" << wid + << "] is always outside vector." << endl; + } + return ex; + } long lsv = base_c->value().as_long(); + long par_base = par_lsv; // Watch out for reversed bit numbering. We're making // the part select from LSB to MSB. - if (par_msv < par_lsv) - lsv = lsv - wid + 1; + if (par_msv < par_lsv) { + par_base = lsv; + lsv = par_lsv - wid + 1; + } + if (warn_ob_select) { + bool defined = true; + // Check to see if the parameter has a defined range. + if (par_msb == 0) { + assert(par_lsb == 0); + defined = false; + } + // Get the parameter values width. + long pwid = -1; + if (par_ex->has_width()) pwid = par_ex->expr_width()-1; + perm_string name = peek_tail_name(path_); + warn_param_ob(par_msv, par_lsv, defined, lsv-par_base, wid, + pwid, this, name, true); + } verinum result = param_part_select_bits(par_ex->value(), wid, - lsv, par_lsv); + lsv-par_base); NetEConst*result_ex = new NetEConst(result); result_ex->set_line(*this); return result_ex; } - if ((par_msv < par_lsv) && (wid>1)) - base = make_add_expr(base, 1-(long)wid); + if (par_msv >= par_lsv) { + if (par_lsv != 0) base = make_add_expr(base, -par_lsv); + } else { + base = make_sub_expr(par_lsv-wid+1, base); + } + + NetExpr*tmp = par->dup_expr(); + tmp = new NetESelect(tmp, base, wid); + tmp->set_line(*this); + return tmp; +} + +NetExpr* PEIdent::elaborate_expr_param_idx_do_(Design*des, NetScope*scope, + const NetExpr*par, + NetScope*found_in, + const NetExpr*par_msb, + const NetExpr*par_lsb) const +{ + long par_msv, par_lsv; + if(! calculate_param_range_(des, scope, par_msb, par_msv, + par_lsb, par_lsv)) return 0; + + NetExpr*base = calculate_up_do_base_(des, scope); + if (base == 0) return 0; + + unsigned long wid = 0; + calculate_up_do_width_(des, scope, wid); + + const NetEConst*par_ex = dynamic_cast (par); + ivl_assert(*this, par_ex); + + if (debug_elaborate) + cerr << get_fileline() << ": debug: Calculate part select " + << "[" << *base << "-:" << wid << "] from range " + << "[" << par_msv << ":" << par_lsv << "]." << endl; + + // Handle the special case that the base is constant. In this + // case, just precalculate the entire constant result. + if (NetEConst*base_c = dynamic_cast (base)) { + if (! base_c->value().is_defined()) { + NetEConst *ex; + ex = new NetEConst(verinum(verinum::Vx, wid, true)); + ex->set_line(*this); + if (warn_ob_select) { + perm_string name = peek_tail_name(path_); + cerr << get_fileline() << ": warning: " << name + << "['bx-:" << wid + << "] is always outside vector." << endl; + } + return ex; + } + long lsv = base_c->value().as_long(); + long par_base = par_lsv + wid - 1; + + // Watch out for reversed bit numbering. We're making + // the part select from LSB to MSB. + if (par_msv < par_lsv) { + par_base = lsv; + lsv = par_lsv; + } + + if (warn_ob_select) { + bool defined = true; + // Check to see if the parameter has a defined range. + if (par_msb == 0) { + assert(par_lsb == 0); + defined = false; + } + // Get the parameter values width. + long pwid = -1; + if (par_ex->has_width()) pwid = par_ex->expr_width()-1; + perm_string name = peek_tail_name(path_); + warn_param_ob(par_msv, par_lsv, defined, lsv-par_base, wid, + pwid, this, name, false); + } + + verinum result = param_part_select_bits(par_ex->value(), wid, + lsv-par_base); + NetEConst*result_ex = new NetEConst(result); + result_ex->set_line(*this); + return result_ex; + } + + if (par_msv >= par_lsv) { + if (long offset = par_lsv+wid-1) { + base = make_add_expr(base, -offset); + } + } else { + base = make_sub_expr(par_lsv, base); + } NetExpr*tmp = par->dup_expr(); tmp = new NetESelect(tmp, base, wid); @@ -2385,49 +2530,16 @@ NetExpr* PEIdent::elaborate_expr_param_(Design*des, return elaborate_expr_param_idx_up_(des, scope, par, found_in, par_msb, par_lsb); + if (use_sel == index_component_t::SEL_IDX_DO) + return elaborate_expr_param_idx_do_(des, scope, par, found_in, + par_msb, par_lsb); + // NOTE TO SELF (continued): The code below should be // rewritten in the above format, as I get to it. NetExpr*tmp = par->dup_expr(); - if (use_sel == index_component_t::SEL_IDX_DO) { - - ivl_assert(*this, !name_tail.index.empty()); - const index_component_t&index_tail = name_tail.index.back(); - ivl_assert(*this, index_tail.msb); - ivl_assert(*this, index_tail.lsb); - - /* Get and evaluate the width of the index - select. This must be constant. */ - need_constant_expr = true; - NetExpr*wid_ex = elab_and_eval(des, scope, index_tail.lsb, -1); - need_constant_expr = false; - NetEConst*wid_ec = dynamic_cast (wid_ex); - if (wid_ec == 0) { - cerr << index_tail.lsb->get_fileline() << ": error: " - << "Second expression of indexed part select " - << "most be constant." << endl; - des->errors += 1; - return 0; - } - - unsigned wid = wid_ec->value().as_ulong(); - - NetExpr*idx_ex = elab_and_eval(des, scope, index_tail.msb, -1); - if (idx_ex == 0) { - return 0; - } - - if (use_sel == index_component_t::SEL_IDX_DO && wid > 1) { - idx_ex = make_add_expr(idx_ex, 1-(long)wid); - } - - - /* Wrap the param expression with a part select. */ - tmp = new NetESelect(tmp, idx_ex, wid); - - - } else if (use_sel == index_component_t::SEL_BIT) { + if (use_sel == index_component_t::SEL_BIT) { ivl_assert(*this, !name_tail.index.empty()); const index_component_t&index_tail = name_tail.index.back(); ivl_assert(*this, index_tail.msb); @@ -2768,15 +2880,47 @@ NetExpr* PEIdent::elaborate_expr_net_idx_up_(Design*des, NetScope*scope, if (net->sig()->sb_to_idx(lsv) == 0 && wid == net->vector_width()) { delete base; + net->cast_signed(false); return net; } + long offset = 0; + if (net->msi() < net->lsi()) { + offset = -wid + 1; + } // Otherwise, make a part select that covers the right // range. - ex = new NetEConst(verinum(net->sig()->sb_to_idx(lsv))); + ex = new NetEConst(verinum(net->sig()->sb_to_idx(lsv) + + offset)); + if (warn_ob_select) { + long rel_base = net->sig()->sb_to_idx(lsv) + offset; + if (rel_base < 0) { + cerr << get_fileline() << ": warning: " + << net->name(); + if (net->word_index()) cerr << "[]"; + cerr << "[" << lsv << "+:" << wid + << "] is selecting before vector." << endl; + } + if (rel_base + wid > net->vector_width()) { + cerr << get_fileline() << ": warning: " + << net->name(); + if (net->word_index()) cerr << "[]"; + cerr << "[" << lsv << "+:" << wid + << "] is selecting after vector." << endl; + } + } } else { // Return 'bx for an undefined base. - ex = new NetEConst(verinum(verinum::Vx, 1, false)); + ex = new NetEConst(verinum(verinum::Vx, wid, true)); + ex->set_line(*this); + delete base; + if (warn_ob_select) { + cerr << get_fileline() << ": warning: " << net->name(); + if (net->word_index()) cerr << "[]"; + cerr << "['bx+:" << wid + << "] is always outside vector." << endl; + } + return ex; } NetESelect*ss = new NetESelect(net, ex, wid); ss->set_line(*this); @@ -2787,11 +2931,9 @@ NetExpr* PEIdent::elaborate_expr_net_idx_up_(Design*des, NetScope*scope, if (net->msi() > net->lsi()) { if (long offset = net->lsi()) - base = make_add_expr(base, 0-offset); + base = make_add_expr(base, -offset); } else { - long vwid = net->lsi() - net->msi() + 1; - long offset = net->msi(); - base = make_sub_expr(vwid-offset-wid, base); + base = make_sub_expr(net->lsi()-wid+1, base); } NetESelect*ss = new NetESelect(net, base, wid); @@ -2830,15 +2972,47 @@ NetExpr* PEIdent::elaborate_expr_net_idx_do_(Design*des, NetScope*scope, if (net->sig()->sb_to_idx(lsv) == (signed) (wid-1) && wid == net->vector_width()) { delete base; + net->cast_signed(false); return net; } + long offset = 0; + if (net->msi() > net->lsi()) { + offset = -wid + 1; + } // Otherwise, make a part select that covers the right // range. - ex = new NetEConst(verinum(net->sig()->sb_to_idx(lsv)-wid+1)); + ex = new NetEConst(verinum(net->sig()->sb_to_idx(lsv) + + offset)); + if (warn_ob_select) { + long rel_base = net->sig()->sb_to_idx(lsv) + offset; + if (rel_base < 0) { + cerr << get_fileline() << ": warning: " + << net->name(); + if (net->word_index()) cerr << "[]"; + cerr << "[" << lsv << "+:" << wid + << "] is selecting before vector." << endl; + } + if (rel_base + wid > net->vector_width()) { + cerr << get_fileline() << ": warning: " + << net->name(); + if (net->word_index()) cerr << "[]"; + cerr << "[" << lsv << "-:" << wid + << "] is selecting after vector." << endl; + } + } } else { // Return 'bx for an undefined base. - ex = new NetEConst(verinum(verinum::Vx, 1, false)); + ex = new NetEConst(verinum(verinum::Vx, wid, true)); + ex->set_line(*this); + delete base; + if (warn_ob_select) { + cerr << get_fileline() << ": warning: " << net->name(); + if (net->word_index()) cerr << "[]"; + cerr << "['bx-:" << wid + << "] is always outside vector." << endl; + } + return ex; } NetESelect*ss = new NetESelect(net, ex, wid); ss->set_line(*this); @@ -2847,16 +3021,19 @@ NetExpr* PEIdent::elaborate_expr_net_idx_do_(Design*des, NetScope*scope, return ss; } - long offset = net->lsi(); - NetExpr*base_adjusted = wid > 1 - ? make_add_expr(base,1-(long)wid-offset) - : (offset == 0? base : make_add_expr(base, 0-offset)); - NetESelect*ss = new NetESelect(net, base_adjusted, wid); + if (net->msi() > net->lsi()) { + if (long offset = net->lsi()+wid-1) + base = make_add_expr(base, -offset); + } else { + base = make_sub_expr(net->lsi(), base); + } + + NetESelect*ss = new NetESelect(net, base, wid); ss->set_line(*this); if (debug_elaborate) { cerr << get_fileline() << ": debug: Elaborate part " - << "select base="<< *base_adjusted << ", wid="<< wid << endl; + << "select base="<< *base << ", wid="<< wid << endl; } return ss; diff --git a/elab_lval.cc b/elab_lval.cc index c421e1243..95808a208 100644 --- a/elab_lval.cc +++ b/elab_lval.cc @@ -476,14 +476,78 @@ bool PEIdent::elaborate_lval_net_idx_(Design*des, NetExpr*base = elab_and_eval(des, scope, index_tail.msb, -1); - /* Correct the mux for the range of the vector. */ - if (reg->msb() < reg->lsb()) - base = make_sub_expr(reg->lsb(), base); - else if (reg->lsb() != 0) - base = make_add_expr(base, - reg->lsb()); - - if (use_sel == index_component_t::SEL_IDX_DO && wid > 1 ) { - base = make_add_expr(base, 1-(long)wid); + // Handle the special case that the base is constant. For this + // case we can reduce the expression. + if (NetEConst*base_c = dynamic_cast (base)) { + // For the undefined case just let the constant pass and + // we will handle it in the code generator. + if (base_c->value().is_defined()) { + long lsv = base_c->value().as_long(); + long offset = 0; + if (((reg->msb() < reg->lsb()) && + use_sel == index_component_t::SEL_IDX_UP) || + ((reg->msb() > reg->lsb()) && + use_sel == index_component_t::SEL_IDX_DO)) { + offset = -wid + 1; + } + delete base; + base = new NetEConst(verinum(reg->sb_to_idx(lsv) + offset)); + if (warn_ob_select) { + long rel_base = reg->sb_to_idx(lsv) + offset; + if (rel_base < 0) { + cerr << get_fileline() << ": warning: " << reg->name(); + if (reg->array_dimensions() > 0) cerr << "[]"; + cerr << "[" << lsv; + if (use_sel == index_component_t::SEL_IDX_UP) { + cerr << "+:"; + } else { + cerr << "-:"; + } + cerr << wid << "] is selecting before vector." << endl; + } + if (rel_base + wid > reg->vector_width()) { + cerr << get_fileline() << ": warning: " << reg->name(); + if (reg->array_dimensions() > 0) cerr << "[]"; + cerr << "[" << lsv; + if (use_sel == index_component_t::SEL_IDX_UP) { + cerr << "+:"; + } else { + cerr << "-:"; + } + cerr << wid << "] is selecting after vector." << endl; + } + } + } else { + if (warn_ob_select) { + cerr << get_fileline() << ": warning: " << reg->name(); + if (reg->array_dimensions() > 0) cerr << "[]"; + cerr << "['bx"; + if (use_sel == index_component_t::SEL_IDX_UP) { + cerr << "+:"; + } else { + cerr << "-:"; + } + cerr << wid << "] is always outside vector." << endl; + } + } + } else { + /* Correct the mux for the range of the vector. */ + if (use_sel == index_component_t::SEL_IDX_UP) { + if (reg->msb() > reg->lsb()) { + if (long offset = reg->lsb()) + base = make_add_expr(base, -offset); + } else { + base = make_sub_expr(reg->lsb()-wid+1, base); + } + } else { + // This is assumed to be a SEL_IDX_DO. + if (reg->msb() > reg->lsb()) { + if (long offset = reg->lsb()+wid-1) + base = make_add_expr(base, -offset); + } else { + base = make_sub_expr(reg->lsb(), base); + } + } } if (debug_elaborate) diff --git a/elab_net.cc b/elab_net.cc index 885bd6ae0..510f78a1d 100644 --- a/elab_net.cc +++ b/elab_net.cc @@ -238,15 +238,33 @@ bool PEIdent::eval_part_select_(Design*des, NetScope*scope, NetNet*sig, return 0; } - long midx_val = tmp->value().as_long(); - midx = sig->sb_to_idx(midx_val); - delete tmp_ex; - /* The width (a constant) is calculated here. */ unsigned long wid = 0; bool flag = calculate_up_do_width_(des, scope, wid); - if (! flag) + if (! flag) return false; + + /* We have an undefined index and that is out of range. */ + if (! tmp->value().is_defined()) { + if (warn_ob_select) { + cerr << get_fileline() << ": warning: " + << sig->name(); + if (sig->array_dimensions() > 0) cerr << "[]"; + cerr << "['bx"; + if (index_tail.sel == + index_component_t::SEL_IDX_UP) { + cerr << "+:"; + } else { + cerr << "-:"; + } + cerr << wid << "] is always outside vector." + << endl; + } return false; + } + + long midx_val = tmp->value().as_long(); + midx = sig->sb_to_idx(midx_val); + delete tmp_ex; if (index_tail.sel == index_component_t::SEL_IDX_UP) lidx = sig->sb_to_idx(midx_val+wid-1); @@ -260,9 +278,19 @@ bool PEIdent::eval_part_select_(Design*des, NetScope*scope, NetNet*sig, } /* Warn about an indexed part select that is out of range. */ - if (midx >= (long)sig->vector_width() || lidx < 0) { - cerr << get_fileline() << ": warning: Indexed part " - "select " << sig->name(); + if (warn_ob_select && (lidx < 0)) { + cerr << get_fileline() << ": warning: " << sig->name(); + if (sig->array_dimensions() > 0) cerr << "[]"; + cerr << "[" << midx_val; + if (index_tail.sel == index_component_t::SEL_IDX_UP) { + cerr << "+:"; + } else { + cerr << "-:"; + } + cerr << wid << "] is selecting before vector." << endl; + } + if (warn_ob_select && (midx >= (long)sig->vector_width())) { + cerr << get_fileline() << ": warning: " << sig->name(); if (sig->array_dimensions() > 0) { cerr << "[]"; } @@ -272,7 +300,7 @@ bool PEIdent::eval_part_select_(Design*des, NetScope*scope, NetNet*sig, } else { cerr << "-:"; } - cerr << wid << "] is out of range." << endl; + cerr << wid << "] is selecting after vector." << endl; } /* This is completely out side the signal so just skip it. */ @@ -424,6 +452,9 @@ NetNet* PEIdent::elaborate_lnet_common_(Design*des, NetScope*scope, unsigned midx = sig->vector_width()-1, lidx = 0; // The default word select is the first. long widx = 0; + // The widx_val is the word select as entered in the source + // code. It's used for error messages. + long widx_val = 0; const name_component_t&name_tail = path_.back(); @@ -462,8 +493,11 @@ NetNet* PEIdent::elaborate_lnet_common_(Design*des, NetScope*scope, return 0; } - long widx_val = tmp->value().as_long(); - widx = sig->array_index_to_address(widx_val); + widx_val = tmp->value().as_long(); + if (sig->array_index_is_valid(widx_val)) + widx = sig->array_index_to_address(widx_val); + else + widx = -1; delete tmp_ex; if (debug_elaborate) @@ -529,7 +563,7 @@ NetNet* PEIdent::elaborate_lnet_common_(Design*des, NetScope*scope, if (widx < 0 || widx >= (long) sig->pin_count()) { cerr << get_fileline() << ": warning: ignoring out of " "bounds l-value array access " - << sig->name() << "[" << widx << "]." << endl; + << sig->name() << "[" << widx_val << "]." << endl; return 0; } diff --git a/elab_scope.cc b/elab_scope.cc index 5929b03b2..86d6b81e8 100644 --- a/elab_scope.cc +++ b/elab_scope.cc @@ -563,7 +563,10 @@ bool PGenerate::generate_scope_loop_(Design*des, NetScope*container) { // Check that the loop_index variable was declared in a // genvar statement. - if (container->find_genvar(loop_index) == 0) { + NetScope*scope = container; + while (scope && !scope->find_genvar(loop_index)) + scope = scope->parent(); + if (!scope) { cerr << get_fileline() << ": error: genvar is missing for " "generate \"loop\" variable '" << loop_index << "'." << endl; @@ -1021,6 +1024,12 @@ void PGenerate::elaborate_subscope_direct_(Design*des, NetScope*scope) void PGenerate::elaborate_subscope_(Design*des, NetScope*scope) { + // Add the genvars to this scope. + typedef map::const_iterator genvar_it_t; + for (genvar_it_t cur = genvars.begin(); cur != genvars.end(); cur++ ) { + scope->add_genvar((*cur).first, (*cur).second); + } + // Scan the generated scope for nested generate schemes, // and *generate* new scopes, which is slightly different // from simple elaboration. diff --git a/elab_sig.cc b/elab_sig.cc index 0c69c3b96..bae8cbefe 100644 --- a/elab_sig.cc +++ b/elab_sig.cc @@ -126,7 +126,7 @@ static void elaborate_sig_funcs(Design*des, NetScope*scope, hname_t use_name ( (*cur).first ); NetScope*fscope = scope->child(use_name); - if (scope == 0) { + if (fscope == 0) { cerr << (*cur).second->get_fileline() << ": internal error: " << "Child scope for function " << (*cur).first << " missing in " << scope_path(scope) << "." << endl; diff --git a/elaborate.cc b/elaborate.cc index 935d1b846..1ef37368a 100644 --- a/elaborate.cc +++ b/elaborate.cc @@ -1571,43 +1571,34 @@ void PGModule::elaborate_udp_(Design*des, PUdp*udp, NetScope*scope) const module or primitive, it interprets them as parameter overrides. Correct that misconception here. */ if (overrides_) { - PDelays tmp_del; - tmp_del.set_delays(overrides_, false); - tmp_del.eval_delays(des, scope, rise_expr, fall_expr, decay_expr); - - if (dynamic_cast (rise_expr)) { - - } else { - cerr << get_fileline() << ": error: Delay expressions must be " - << "constant for primitives." << endl; - cerr << get_fileline() << ": : Cannot calculate " - << *rise_expr << endl; + if (overrides_->count() > 2) { + cerr << get_fileline() << ": error: UDPs take at most two " + "delay arguments." << endl; des->errors += 1; - } - - if (dynamic_cast (fall_expr)) { - } else { - cerr << get_fileline() << ": error: Delay expressions must be " - << "constant for primitives." << endl; - cerr << get_fileline() << ": : Cannot calculate " - << *rise_expr << endl; - des->errors += 1; + PDelays tmp_del; + tmp_del.set_delays(overrides_, false); + tmp_del.eval_delays(des, scope, rise_expr, fall_expr, + decay_expr); + + if (! dynamic_cast (rise_expr)) { + cerr << get_fileline() << ": error: UDP rising delay " + "expression must be constant." << endl; + cerr << get_fileline() << ": : Cannot calculate " + << *rise_expr << endl; + des->errors += 1; + } + + if (! dynamic_cast (fall_expr)) { + cerr << get_fileline() << ": error: UDP falling delay " + "expression must be constant." << endl; + cerr << get_fileline() << ": : Cannot calculate " + << *fall_expr << endl; + des->errors += 1; + } } - - if (dynamic_cast (decay_expr)) { - - } else { - cerr << get_fileline() << ": error: Delay expressions must be " - << "constant for primitives." << endl; - cerr << get_fileline() << ": : Cannot calculate " - << *rise_expr << endl; - des->errors += 1; - } - } - assert(udp); NetUDP*net = new NetUDP(scope, my_name, udp->ports.count(), udp); net->rise_time(rise_expr); @@ -4235,8 +4226,23 @@ class elaborate_root_scope_t : public elaborator_work_item_t { virtual void elaborate_runrun() { - Module::replace_t stub; - if (! rmod_->elaborate_scope(des, scope_, stub)) + Module::replace_t root_repl; + for (list::iterator cur = Module::user_defparms.begin() + ; cur != Module::user_defparms.end() ; cur++) { + + pform_name_t tmp_name = cur->first; + if (peek_head_name(tmp_name) != scope_->basename()) + continue; + + tmp_name.pop_front(); + if (tmp_name.size() != 1) + continue; + + NetExpr*tmp_expr = cur->second->elaborate_pexpr(des, scope_); + root_repl[peek_head_name(tmp_name)] = tmp_expr; + } + + if (! rmod_->elaborate_scope(des, scope_, root_repl)) des->errors += 1; } diff --git a/expr_synth.cc b/expr_synth.cc index 70b5dff76..6e4a7f842 100644 --- a/expr_synth.cc +++ b/expr_synth.cc @@ -122,6 +122,7 @@ NetNet* NetEBAdd::synthesize(Design*des, NetScope*scope, NetExpr*root) NetNet*osig = new NetNet(lsig->scope(), path, NetNet::IMPLICIT, width); osig->local_flag(true); osig->data_type(expr_type()); + osig->set_signed(has_sign()); perm_string oname = osig->scope()->local_symbol(); NetAddSub *adder = new NetAddSub(lsig->scope(), oname, width); @@ -390,6 +391,7 @@ NetNet* NetEBPow::synthesize(Design*des, NetScope*scope, NetExpr*root) NetNet::IMPLICIT, width); osig->set_line(*this); osig->data_type(expr_type()); + osig->set_signed(has_sign()); osig->local_flag(true); connect(powr->pin_Result(), osig->pin(0)); @@ -426,6 +428,7 @@ NetNet* NetEBMult::synthesize(Design*des, NetScope*scope, NetExpr*root) NetNet::IMPLICIT, width); osig->set_line(*this); osig->data_type(expr_type()); + osig->set_signed(has_sign()); osig->local_flag(true); connect(mult->pin_Result(), osig->pin(0)); diff --git a/iverilog-vpi.man b/iverilog-vpi.man index 50ea7f4c2..53797e2cb 100644 --- a/iverilog-vpi.man +++ b/iverilog-vpi.man @@ -4,7 +4,7 @@ iverilog-vpi - Compile front end for VPI modules .SH SYNOPSIS .B iverilog-vpi -[--name=\fIname\fP] +[\-\-name=\fIname\fP] \fIsourcefile\fP... .SH DESCRIPTION @@ -20,7 +20,6 @@ first source file is named \fIfoo.c\fP, the output becomes \fIfoo.vpi\fP. .SH OPTIONS -.l \fIiverilog-vpi\fP accepts the following options: .TP 8 .B -l\fIlibrary\fP @@ -104,9 +103,9 @@ requests a 32bit vpi binary instead of the default 64bit binary. .P Example GNU makefile that takes advantage of these flags: .IP "" 4 -CFLAGS = -Wall -O $(CFLAGS_$@) +CFLAGS = \-Wall \-O $(CFLAGS_$@) .br -VPI_CFLAGS := $(shell iverilog-vpi --cflags) +VPI_CFLAGS := $(shell iverilog-vpi \-\-cflags) .br CFLAGS_messagev.o = $(VPI_CFLAGS) .br diff --git a/lexor.lex b/lexor.lex index 9e8504c66..66c99dfa6 100644 --- a/lexor.lex +++ b/lexor.lex @@ -71,11 +71,11 @@ void reset_lexor(); static void line_directive(); static void line_directive2(); -static verinum*make_unsized_binary(const char*txt); -static verinum*make_undef_highz_dec(const char*txt); -static verinum*make_unsized_dec(const char*txt); -static verinum*make_unsized_octal(const char*txt); -static verinum*make_unsized_hex(const char*txt); +verinum*make_unsized_binary(const char*txt); +verinum*make_undef_highz_dec(const char*txt); +verinum*make_unsized_dec(const char*txt); +verinum*make_unsized_octal(const char*txt); +verinum*make_unsized_hex(const char*txt); static int dec_buf_div2(char *buf); @@ -667,7 +667,7 @@ void lex_end_table() BEGIN(INITIAL); } -static verinum*make_unsized_binary(const char*txt) +verinum*make_unsized_binary(const char*txt) { bool sign_flag = false; const char*ptr = txt; @@ -725,7 +725,7 @@ static verinum*make_unsized_binary(const char*txt) } -static verinum*make_unsized_octal(const char*txt) +verinum*make_unsized_octal(const char*txt) { bool sign_flag = false; const char*ptr = txt; @@ -792,7 +792,7 @@ static verinum*make_unsized_octal(const char*txt) } -static verinum*make_unsized_hex(const char*txt) +verinum*make_unsized_hex(const char*txt) { bool sign_flag = false; const char*ptr = txt; @@ -919,7 +919,7 @@ static int dec_buf_div2(char *buf) } /* Support a single x, z or ? as a decimal constant (from 1364-2005). */ -static verinum* make_undef_highz_dec(const char* ptr) +verinum* make_undef_highz_dec(const char* ptr) { bool signed_flag = false; @@ -972,7 +972,7 @@ static verinum* make_undef_highz_dec(const char* ptr) * hard to calculate. */ -static verinum*make_unsized_dec(const char*ptr) +verinum*make_unsized_dec(const char*ptr) { char buf[4096]; bool signed_flag = false; diff --git a/main.cc b/main.cc index c80b2baed..9a389708f 100644 --- a/main.cc +++ b/main.cc @@ -115,6 +115,7 @@ bool warn_implicit = false; bool warn_timescale = false; bool warn_portbinding = false; bool warn_inf_loop = false; +bool warn_ob_select = false; bool error_implicit = false; @@ -491,6 +492,9 @@ static void read_iconfig_file(const char*ipath) case 'l': warn_inf_loop = true; break; + case 's': + warn_ob_select = true; + break; case 'p': warn_portbinding = true; break; @@ -528,8 +532,9 @@ static void read_iconfig_file(const char*ipath) << endl; flag_errors += 1; } - - } + } else if (strcmp(buf,"defparam") == 0) { + parm_to_defparam_list(cp); + } } fclose(ifile); } diff --git a/mingw.txt b/mingw.txt index d90d32542..c8a2ee063 100644 --- a/mingw.txt +++ b/mingw.txt @@ -1,3 +1,8 @@ +Please NOTE: + +These directions are slightly outdated and need to be updated. +The plan is to rewrite all this using the latest MinGW at +some time in the not too distant future (CR Aug. 2009) MINGW PORT OF ICARUS VERILOG @@ -49,7 +54,7 @@ critical, but these are the versions I use. Mingw32-5.x ... including the sub-packages binutils, gcc-core and gcc-g++ if you are given the option. - readline-4.2-20010727.zip + readline-5.0-1 bzip2-1.0.3 zlib-1.2.3 gperf-3.0.1 @@ -79,7 +84,7 @@ Download the msys-1.x.x.exe and msysdtc-1.x.x.exe binaries. These are self-installing packages. Install msys first, and then msysDTC. Most likely, you want to install them in c:/msys. (The msysDTK is installed in the same location, as it is an add-on.) - + This install should be easy and reliable. The installation will leave an "msys" icon on your desktop and in the @@ -110,29 +115,6 @@ Finally, as part of installing the mingw32 compilers, remember to add the mingw/bin directory to your path. You will need that to be able to find the compilers later. -* Install Mingw32 Packages - -There is a collection of precompiled libraries and add-on packages -that are intended for use with the Mingw32 compiler. These do not come -with simplified Windows installers, but they are pretty easy to -install by hand. Icarus Verilog uses the readline-4.2 package from -that collection. - -Since I installed Mingw32 in c:\mingw, I also created a -Mingw-packages directory called c:\mingw-packages. The install, then, -is as easy as this: - - - $ cd c:/mingw-packages - $ unzip readline-4.2-20010727.zip - [lots of inflating...] - -There is no need to adjust your execution path for this package as we -are only using a library out of here. However, do remember the -directory name, as you will need it later. - -Done. On to the next packages. - * Install GnuWin32 Packages The GnuWin32 project is a collections of open source programs and @@ -148,6 +130,7 @@ You will need these gnuwin32 packages to compile Icarus Verilog: gperf-3.0.1.exe bison-2.1.exe flex-2.5.4a.exe + readline-5.0-1.exe I suggest creating a common directory for holding all your gnuwin32 packages. I use C:\gnuwin32. The download page at the gnuwin32 site @@ -218,8 +201,8 @@ without white space. Now, configure the source to make the makefiles and configuration details. Run these commands: - $ CPPFLAGS="-Ic:/gnuwin32/include -Ic:/mingw-packages/include" - $ LDFLAGS="-Lc:/gnuwin32/lib -Lc:/mingw-packages/lib" + $ CPPFLAGS="-Ic:/gnuwin32/include + $ LDFLAGS="-Lc:/gnuwin32/lib $ export CPPFLAGS LDFLAGS $ ./configure --prefix=c:/iverilog @@ -271,7 +254,8 @@ You may find that you need to put some of the prerequisite DLLs into the d:\iverilog\bin directory. These include: c:\mingw\bin\mingw10.dll - c:\mingw-packages\bin\libreadline.dll + c:\gnuwin32\bin\readline.dll + c:\gnuwin32\bin\history.dll c:\gnuwin32\bin\bzip2.dll c:\gnuwin32\bin\zlib.dll diff --git a/net_scope.cc b/net_scope.cc index 6bdcd8713..ae0497650 100644 --- a/net_scope.cc +++ b/net_scope.cc @@ -395,28 +395,18 @@ NetEvent* NetScope::find_event(perm_string name) return 0; } -// We only add genvars to a module scope, so we do not need to search -// for the module scope here. void NetScope::add_genvar(perm_string name, LineInfo *li) { + assert((type_ == MODULE) || (type_ == GENBLOCK)); genvars_[name] = li; } LineInfo* NetScope::find_genvar(perm_string name) { - // genvars are only added to the module so we need to find it - // if we are in a sub scope. - NetScope *scope = this; - while (scope->type() != NetScope::MODULE) { - scope = scope->parent(); - assert(scope != NULL); - } - - if (scope->genvars_.find(name) != scope->genvars_.end()) { - return scope->genvars_[name]; - } - - return 0; + if (genvars_.find(name) != genvars_.end()) + return genvars_[name]; + else + return 0; } void NetScope::add_signal(NetNet*net) diff --git a/netlist.cc b/netlist.cc index 8f2940316..095338ff3 100644 --- a/netlist.cc +++ b/netlist.cc @@ -914,9 +914,8 @@ NetPartSelect::NetPartSelect(NetNet*sig, NetNet*sel, pin(1).set_dir(Link::INPUT); break; case NetPartSelect::PV: - pin(0).set_dir(Link::INPUT); - pin(1).set_dir(Link::OUTPUT); - break; + /* Only a vector to part can be a variable select. */ + assert(0); } pin(2).set_dir(Link::INPUT); @@ -2349,12 +2348,12 @@ NetNet* NetESignal::sig() return net_; } -unsigned NetESignal::lsi() const +long NetESignal::lsi() const { return net_->lsb(); } -unsigned NetESignal::msi() const +long NetESignal::msi() const { return net_->msb(); } diff --git a/netlist.h b/netlist.h index d34fca4c5..9162e7b71 100644 --- a/netlist.h +++ b/netlist.h @@ -3829,8 +3829,8 @@ class NetESignal : public NetExpr { const NetNet* sig() const; NetNet* sig(); // Declared vector dimensions for the signal. - unsigned msi() const; - unsigned lsi() const; + long msi() const; + long lsi() const; virtual ivl_variable_type_t expr_type() const; diff --git a/parse_misc.h b/parse_misc.h index c49cb1652..40efbfffa 100644 --- a/parse_misc.h +++ b/parse_misc.h @@ -77,4 +77,14 @@ extern UCDriveType uc_drive; extern bool have_timeunit_decl; extern bool have_timeprec_decl; +/* + * Export there functions because we have to generate PENumber class + * in pform.cc for user defparam definition from command file. + */ +extern verinum*make_unsized_dec(const char*txt); +extern verinum*make_undef_highz_dec(const char*txt); +extern verinum*make_unsized_binary(const char*txt); +extern verinum*make_unsized_octal(const char*txt); +extern verinum*make_unsized_hex(const char*txt); + #endif diff --git a/pform.cc b/pform.cc index 9c2660f46..08701a9b7 100644 --- a/pform.cc +++ b/pform.cc @@ -42,6 +42,160 @@ map pform_modules; map pform_primitives; + +/* + * Parse configuration file with format =, where key + * is the hierarchical name of a valid parameter name, and value + * is the value user wants to assign to. The value should be constant. + */ +void parm_to_defparam_list(const string¶m) +{ + char* key; + char* value; + unsigned off = param.find('='); + if (off > param.size()) { + key = strdup(param.c_str()); + value = (char*)malloc(1); + *value = '\0'; + + } else { + key = strdup(param.substr(0, off).c_str()); + value = strdup(param.substr(off+1).c_str()); + } + + // Resolve hierarchical name for defparam. Remember + // to deal with bit select for generate scopes. Bit + // select expression should be constant interger. + pform_name_t name; + char *nkey = key; + char *ptr = strchr(key, '.'); + while (ptr != 0) { + *ptr++ = '\0'; + // Find if bit select is applied, this would be something + // like - scope[2].param = 10 + char *bit_l = strchr(nkey, '['); + if (bit_l !=0) { + *bit_l++ = '\0'; + char *bit_r = strchr(bit_l, ']'); + if (bit_r == 0) { + cerr << ": error: missing ']' for defparam: " << nkey << endl; + free(key); + free(value); + return; + } + *bit_r = '\0'; + int i = 0; + while (*(bit_l+i) != '\0') + if (!isdigit(*(bit_l+i++))) { + cerr << ": error: scope index expression is not constant: " << nkey << endl; + free(key); + free(value); + return; + } + name_component_t tmp(lex_strings.make(nkey)); + index_component_t index; + index.sel = index_component_t::SEL_BIT; + verinum *seln = new verinum(atoi(bit_l)); + PENumber *sel = new PENumber(seln); + index.msb = sel; + index.lsb = sel; + tmp.index.push_back(index); + name.push_back(tmp); + } + else // no bit select + name.push_back(name_component_t(lex_strings.make(nkey))); + + nkey = ptr; + ptr = strchr(nkey, '.'); + } + name.push_back(name_component_t(lex_strings.make(nkey))); + + // Resolve value to PExpr class. Should support all kind of constant + // format including based number, dec number, real number and string. + if (*value == '"') { // string type + char *buf = strdup (value); + char *buf_ptr = buf+1; + // Parse untill another '"' or '\0' + while (*buf_ptr != '"' && *buf_ptr != '\0') { + buf_ptr++; + // Check for escape, especially '\"', which does not mean the + // end of string. + if (*buf_ptr == '\\' && *(buf_ptr+1) != '\0') + buf_ptr += 2; + } + if (*buf_ptr == '\0') // String end without '"' + cerr << ": error: missing close quote of string for defparam: " << name << endl; + else if (*(buf_ptr+1) != 0) { // '"' appears within string with no escape + cerr << buf_ptr << endl; + cerr << ": error: \'\"\' appears within string value for defparam: " << name + << ". Ignore characters after \'\"\'" << endl; + } + + *buf_ptr = '\0'; + buf_ptr = buf+1; + // Remember to use 'new' to allocate string for PEString + // because 'delete' is used by its destructor. + char *nchar = strcpy(new char [strlen(buf_ptr)+1], buf_ptr); + PEString* ndec = new PEString(nchar); + Module::user_defparms.push_back( make_pair(name, ndec) ); + free(buf); + } + else { // number type + char *num = strchr(value, '\''); + if (num != 0) { + verinum *val; + // BASED_NUMBER, somthing like - scope.parameter='b11 + // make sure to check 'h' first because 'b'&'d' may be included + // in hex format + if (strchr(num, 'h') || strchr(num, 'H')) + val = make_unsized_hex(num); + else if (strchr(num, 'd') || strchr(num, 'D')) + if (strchr(num, 'x') || strchr(num, 'X') || strchr(num, 'z') || strchr(num, 'Z')) + val = make_undef_highz_dec(num); + else + val = make_unsized_dec(num); + else if (strchr(num, 'b') || strchr(num, 'B')) { + val = make_unsized_binary(num); + } + else if (strchr(num, 'o') || strchr(num, 'O')) + val = make_unsized_octal(num); + else { + cerr << ": error: value specify error for defparam: " << name << endl; + free(key); + free(value); + return; + } + + // BASED_NUMBER with size, something like - scope.parameter=2'b11 + if (num != value) { + *num = 0; + verinum *siz = make_unsized_dec(value); + val = pform_verinum_with_size(siz, val, "", 0); + } + + PENumber* ndec = new PENumber(val); + Module::user_defparms.push_back( make_pair(name, ndec) ); + + } + else { + // REALTIME, something like - scope.parameter=1.22 or scope.parameter=1e2 + if (strchr(value, '.') || strchr(value, 'e') || strchr(value, 'E')) { + verireal *val = new verireal(value); + PEFNumber* nreal = new PEFNumber(val); + Module::user_defparms.push_back( make_pair(name, nreal) ); + } + else { + // DEC_NUMBER, something like - scope.parameter=3 + verinum *val = make_unsized_dec(value); + PENumber* ndec = new PENumber(val); + Module::user_defparms.push_back( make_pair(name, ndec) ); + } + } + } + free(key); + free(value); +} + /* * The lexor accesses the vl_* variables. */ @@ -675,20 +829,31 @@ void pform_endmodule(const char*name, bool in_celldefine, tp_local_flag = false; } +static void pform_add_genvar(const struct vlltype&li, const perm_string&name, + map&genvars) +{ + LineInfo*lni = new LineInfo(); + FILE_NAME(lni, li); + if (genvars.find(name) != genvars.end()) { + cerr << lni->get_fileline() << ": error: genvar '" + << name << "' has already been declared." << endl; + cerr << genvars[name]->get_fileline() + << ": the previous declaration is here." << endl; + error_count += 1; + delete lni; + } else { + genvars[name] = lni; + } +} + void pform_genvars(const struct vlltype&li, list*names) { list::const_iterator cur; for (cur = names->begin(); cur != names->end() ; *cur++) { - LineInfo*lni = new LineInfo(); - FILE_NAME(lni, li); - if (pform_cur_module->genvars.find(*cur) != - pform_cur_module->genvars.end()) { - cerr << lni->get_fileline() << ": error: duplicate " - "definition for genvar '" << *cur << "' in '" - << pform_cur_module->mod_name() << "'." << endl; - error_count += 1; - delete lni; - } else pform_cur_module->genvars[*cur] = lni; + if (pform_cur_generate) + pform_add_genvar(li, *cur, pform_cur_generate->genvars); + else + pform_add_genvar(li, *cur, pform_cur_module->genvars); } delete names; @@ -703,7 +868,6 @@ void pform_start_generate_for(const struct vlltype&li, FILE_NAME(gen, li); - // For now, assume that generates do not nest. gen->parent = pform_cur_generate; pform_cur_generate = gen; @@ -724,7 +888,6 @@ void pform_start_generate_if(const struct vlltype&li, PExpr*test) FILE_NAME(gen, li); - // For now, assume that generates do not nest. gen->parent = pform_cur_generate; pform_cur_generate = gen; @@ -747,7 +910,6 @@ void pform_start_generate_else(const struct vlltype&li) FILE_NAME(gen, li); - // For now, assume that generates do not nest. gen->parent = pform_cur_generate; pform_cur_generate = gen; diff --git a/pform.h b/pform.h index 778d748d3..a769bee8e 100644 --- a/pform.h +++ b/pform.h @@ -195,7 +195,7 @@ extern verinum* pform_verinum_with_size(verinum*s, verinum*val, /* * This function takes the list of names as new genvars to declare in - * the current module scope. + * the current module or generate scope. */ extern void pform_genvars(const struct vlltype&li, list*names); @@ -410,6 +410,14 @@ extern PExpr* pform_make_branch_probe_expression(const struct vlltype&loc, extern PExpr* pform_make_branch_probe_expression(const struct vlltype&loc, char*name, char*branch); + +/* + * Parse configuration file with format =, where key + * is the hierarchical name of a valid parameter name and value + * is the value user wants to assign to. The value should be constant. + */ +extern void parm_to_defparam_list(const string¶m); + /* * Tasks to set the timeunit or timeprecision for SystemVerilog. */ diff --git a/pform_dump.cc b/pform_dump.cc index a522eb8ac..06a827be5 100644 --- a/pform_dump.cc +++ b/pform_dump.cc @@ -410,6 +410,8 @@ void PDelays::dump_delays(ostream&out) const if (delay_[0] && delay_[1] && delay_[2]) out << "#(" << *delay_[0] << "," << *delay_[1] << "," << *delay_[2] << ")"; + else if (delay_[0] && delay_[1]) + out << "#(" << *delay_[0] << "," << *delay_[1] << ")"; else if (delay_[0]) out << "#" << *delay_[0]; else @@ -1032,6 +1034,12 @@ void PGenerate::dump(ostream&out, unsigned indent) const (*idx)->dump(out, indent+2); } + typedef map::const_iterator genvar_iter_t; + for (genvar_iter_t cur = genvars.begin() + ; cur != genvars.end() ; cur++) { + out << setw(indent+2) << "" << "genvar " << ((*cur).first) << ";" << endl; + } + for (list::const_iterator idx = generate_schemes.begin() ; idx != generate_schemes.end() ; idx++) { (*idx)->dump(out, indent+2); diff --git a/t-dll-api.cc b/t-dll-api.cc index e5a513e8d..5f80a5d50 100644 --- a/t-dll-api.cc +++ b/t-dll-api.cc @@ -1196,7 +1196,8 @@ extern "C" unsigned ivl_lpm_selects(ivl_lpm_t net) case IVL_LPM_ARRAY: return net->u_.array.swid; case IVL_LPM_CONCAT: - return net->u_.concat.inputs; + cerr << "error: ivl_lpm_selects() is no longer supported for " + "IVL_LPM_CONCAT, use ivl_lpm_size() instead." << endl; default: assert(0); return 0; @@ -1268,6 +1269,8 @@ extern "C" unsigned ivl_lpm_size(ivl_lpm_t net) return net->u_.ufunc.ports - 1; case IVL_LPM_REPEAT: return net->u_.repeat.count; + case IVL_LPM_CONCAT: + return net->u_.concat.inputs; default: assert(0); return 0; diff --git a/t-dll-expr.cc b/t-dll-expr.cc index 128830a44..e4dcbf289 100644 --- a/t-dll-expr.cc +++ b/t-dll-expr.cc @@ -351,6 +351,7 @@ void dll_target::expr_select(const NetESelect*net) expr_ = (ivl_expr_t)calloc(1, sizeof(struct ivl_expr_s)); assert(expr_); + FILE_NAME(expr_, net); expr_->type_ = IVL_EX_SELECT; expr_->value_= IVL_VT_VECTOR; diff --git a/t-dll.cc b/t-dll.cc index 1e9a28602..45d7851d7 100644 --- a/t-dll.cc +++ b/t-dll.cc @@ -2147,6 +2147,7 @@ bool dll_target::part_select(const NetPartSelect*net) obj->type = IVL_LPM_PART_PV; break; } + FILE_NAME(obj, net); obj->name = net->name(); // NetPartSelect names are permallocated. assert(net->scope()); obj->scope = find_scope(des_, net->scope()); diff --git a/tgt-stub/stub.c b/tgt-stub/stub.c index 2a378b737..d1d745978 100644 --- a/tgt-stub/stub.c +++ b/tgt-stub/stub.c @@ -430,7 +430,7 @@ static void show_lpm_cmp_ne(ivl_lpm_t net) } /* IVL_LPM_CONCAT - * The concat device takes N inputs (N=ivl_lpm_selects) and generates + * The concat device takes N inputs (N=ivl_lpm_size) and generates * a single output. The total output is known from the ivl_lpm_width * function. The widths of all the inputs are inferred from the widths * of the signals connected to the nexus of the inputs. The compiler @@ -444,10 +444,10 @@ static void show_lpm_concat(ivl_lpm_t net) unsigned width = ivl_lpm_width(net); fprintf(out, " LPM_CONCAT %s: \n", - ivl_lpm_basename(net), width, ivl_lpm_selects(net)); + ivl_lpm_basename(net), width, ivl_lpm_size(net)); fprintf(out, " O: %p\n", ivl_lpm_q(net,0)); - for (idx = 0 ; idx < ivl_lpm_selects(net) ; idx += 1) { + for (idx = 0 ; idx < ivl_lpm_size(net) ; idx += 1) { ivl_nexus_t nex = ivl_lpm_data(net, idx); unsigned signal_width = width_of_nexus(nex); diff --git a/tgt-vhdl/expr.cc b/tgt-vhdl/expr.cc index 62c6cfd1f..15c413661 100644 --- a/tgt-vhdl/expr.cc +++ b/tgt-vhdl/expr.cc @@ -1,7 +1,7 @@ /* * VHDL code generation for expressions. * - * Copyright (C) 2008 Nick Gasson (nick@nickg.me.uk) + * Copyright (C) 2008-2009 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 @@ -107,8 +107,10 @@ static vhdl_var_ref *translate_signal(ivl_expr_t e) if (ivl_signal_array_count(sig) > 0 && (off = ivl_expr_oper1(e))) { // Select from an array vhdl_expr *vhd_off = translate_expr(off); - if (NULL == vhd_off) + if (NULL == vhd_off) { + delete ref; return NULL; + } vhdl_type integer(VHDL_TYPE_INTEGER); ref->set_slice(vhd_off->cast(&integer)); diff --git a/tgt-vhdl/lpm.cc b/tgt-vhdl/lpm.cc index fcf631859..79309489e 100644 --- a/tgt-vhdl/lpm.cc +++ b/tgt-vhdl/lpm.cc @@ -1,7 +1,7 @@ /* * VHDL code generation for LPM devices. * - * Copyright (C) 2008 Nick Gasson (nick@nickg.me.uk) + * Copyright (C) 2008-2009 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 @@ -48,10 +48,12 @@ static vhdl_expr *concat_lpm_to_expr(vhdl_scope *scope, ivl_lpm_t lpm) vhdl_binop_expr *expr = new vhdl_binop_expr(VHDL_BINOP_CONCAT, result_type); - for (int i = ivl_lpm_selects(lpm) - 1; i >= 0; i--) { + for (int i = ivl_lpm_size(lpm) - 1; i >= 0; i--) { vhdl_expr *e = readable_ref(scope, ivl_lpm_data(lpm, i)); - if (NULL == e) + if (NULL == e) { + delete expr; return NULL; + } expr->add_expr(e); } @@ -68,8 +70,10 @@ static vhdl_expr *binop_lpm_to_expr(vhdl_scope *scope, ivl_lpm_t lpm, vhdl_binop for (int i = 0; i < 2; i++) { vhdl_expr *e = readable_ref(scope, ivl_lpm_data(lpm, i)); - if (NULL == e) + if (NULL == e) { + delete expr; return NULL; + } expr->add_expr(e->cast(result_type)); } @@ -95,8 +99,10 @@ static vhdl_expr *rel_lpm_to_expr(vhdl_scope *scope, ivl_lpm_t lpm, vhdl_binop_t for (int i = 0; i < 2; i++) { vhdl_expr *e = readable_ref(scope, ivl_lpm_data(lpm, i)); - if (NULL == e) + if (NULL == e) { + delete expr; return NULL; + } expr->add_expr(e); } @@ -135,8 +141,10 @@ static vhdl_expr *ufunc_lpm_to_expr(vhdl_scope *scope, ivl_lpm_t lpm) for (unsigned i = 0; i < ivl_lpm_size(lpm); i++) { vhdl_var_ref *ref = readable_ref(scope, ivl_lpm_data(lpm, i)); - if (NULL == ref) + if (NULL == ref) { + delete fcall; return NULL; + } fcall->add_expr(ref); } @@ -195,8 +203,10 @@ static vhdl_expr *array_lpm_to_expr(vhdl_scope *scope, ivl_lpm_t lpm) vhdl_type *atype = new vhdl_type(*adecl->get_type()); vhdl_expr *select = readable_ref(scope, ivl_lpm_select(lpm)); - if (NULL == select) + if (NULL == select) { + delete atype; return NULL; + } vhdl_var_ref *ref = new vhdl_var_ref(renamed, atype); vhdl_type integer(VHDL_TYPE_INTEGER); diff --git a/tgt-vhdl/process.cc b/tgt-vhdl/process.cc index 6559f9101..d3813caa5 100644 --- a/tgt-vhdl/process.cc +++ b/tgt-vhdl/process.cc @@ -95,8 +95,13 @@ int draw_process(ivl_process_t proc, void *cd) ivl_scope_tname(scope), ivl_process_file(proc), ivl_process_lineno(proc)); - // A process should occur in a module scope, therefore it - // should have already been assigned a VHDL entity + // Skip over any generate and begin scopes until we find + // the module that contains them - this is where we will + // generate the process + while (ivl_scope_type(scope) == IVL_SCT_GENERATE + || ivl_scope_type(scope) == IVL_SCT_BEGIN) + scope = ivl_scope_parent(scope); + assert(ivl_scope_type(scope) == IVL_SCT_MODULE); vhdl_entity *ent = find_entity(scope); assert(ent != NULL); diff --git a/tgt-vhdl/scope.cc b/tgt-vhdl/scope.cc index 718a32d99..9727d34db 100644 --- a/tgt-vhdl/scope.cc +++ b/tgt-vhdl/scope.cc @@ -472,12 +472,50 @@ static void avoid_name_collision(string& name, vhdl_scope* scope) } } +// Concatenate the expanded genvar values together to make a unique +// instance name +// This isn't ideal: it would be better to replace the Verilog +// generate with an equivalent VHDL generate, but this isn't possible +// with the current API +static string genvar_unique_suffix(ivl_scope_t scope) +{ + ostringstream suffix; + while (scope && ivl_scope_type(scope) == IVL_SCT_GENERATE) { + for (unsigned i = 0; i < ivl_scope_params(scope); i++) { + ivl_parameter_t param = ivl_scope_param(scope, i); + ivl_expr_t e = ivl_parameter_expr(param); + + if (ivl_expr_type(e) == IVL_EX_NUMBER) { + vhdl_expr* value = translate_expr(e); + assert(value); + + value = value->cast(vhdl_type::integer()); + + suffix << "_" << ivl_parameter_basename(param); + value->emit(suffix, 0); + + delete value; + } + else { + error("Only numeric genvars supported at the moment"); + return "_ERROR"; // Never used + } + } + + scope = ivl_scope_parent(scope); + } + + return suffix.str(); +} + // Declare a single signal in a scope -static void declare_one_signal(vhdl_entity *ent, ivl_signal_t sig) +static void declare_one_signal(vhdl_entity *ent, ivl_signal_t sig, + ivl_scope_t scope) { remember_signal(sig, ent->get_arch()->get_scope()); string name(make_safe_name(sig)); + name += genvar_unique_suffix(scope); avoid_name_collision(name, ent->get_arch()->get_scope()); rename_signal(sig, name); @@ -586,14 +624,14 @@ static void declare_signals(vhdl_entity *ent, ivl_scope_t scope) ivl_signal_t sig = ivl_scope_sig(scope, i); if (ivl_signal_port(sig) != IVL_SIP_NONE) - declare_one_signal(ent, sig); + declare_one_signal(ent, sig, scope); } for (int i = 0; i < nsigs; i++) { ivl_signal_t sig = ivl_scope_sig(scope, i); if (ivl_signal_port(sig) == IVL_SIP_NONE) - declare_one_signal(ent, sig); + declare_one_signal(ent, sig, scope); } } @@ -873,9 +911,6 @@ static int draw_skeleton_scope(ivl_scope_t scope, void *_unused) case IVL_SCT_MODULE: create_skeleton_entity_for(scope, depth); break; - case IVL_SCT_GENERATE: - error("No translation for generate statements yet"); - return 1; case IVL_SCT_FORK: error("No translation for fork statements yet"); return 1; @@ -901,6 +936,20 @@ static int draw_all_signals(ivl_scope_t scope, void *_parent) declare_signals(ent, scope); } + else if (ivl_scope_type(scope) == IVL_SCT_GENERATE) { + // Because generate scopes don't appear in the + // output VHDL all their signals are added to the + // containing entity (after being uniqued) + + ivl_scope_t parent = ivl_scope_parent(scope); + while (ivl_scope_type(parent) == IVL_SCT_GENERATE) + parent = ivl_scope_parent(scope); + + vhdl_entity* ent = find_entity(parent); + assert(ent); + + declare_signals(ent, scope); + } return ivl_scope_children(scope, draw_all_signals, scope); } @@ -1032,6 +1081,10 @@ static int draw_hierarchy(ivl_scope_t scope, void *_parent) if (ivl_scope_type(scope) == IVL_SCT_MODULE && _parent) { ivl_scope_t parent = static_cast(_parent); + // Skip over any containing generate scopes + while (ivl_scope_type(parent) == IVL_SCT_GENERATE) + parent = ivl_scope_parent(parent); + if (!is_default_scope_instance(parent)) return 0; // Not generating code for the parent instance so // don't generate for the child @@ -1054,6 +1107,7 @@ static int draw_hierarchy(ivl_scope_t scope, void *_parent) // And an instantiation statement string inst_name(ivl_scope_basename(scope)); + inst_name += genvar_unique_suffix(ivl_scope_parent(scope)); if (inst_name == ent->get_name() || parent_scope->have_declared(inst_name)) { // Cannot have instance name the same as type in VHDL inst_name += "_Inst"; diff --git a/tgt-vhdl/state.cc b/tgt-vhdl/state.cc index 223975f47..7acab014c 100644 --- a/tgt-vhdl/state.cc +++ b/tgt-vhdl/state.cc @@ -170,8 +170,12 @@ vhdl_entity* find_entity(const string& name) // name should be the same as the Verilog module type name. // Note that this will return NULL if no entity has been recorded // for this scope type. -vhdl_entity* find_entity(const ivl_scope_t scope) +vhdl_entity* find_entity(ivl_scope_t scope) { + // Skip over generate scopes + while (ivl_scope_type(scope) == IVL_SCT_GENERATE) + scope = ivl_scope_parent(scope); + assert(ivl_scope_type(scope) == IVL_SCT_MODULE); scope_name_map_t::iterator it = g_scope_names.find(ivl_scope_tname(scope)); diff --git a/tgt-vhdl/state.hh b/tgt-vhdl/state.hh index 2b43ed359..3dda1056d 100644 --- a/tgt-vhdl/state.hh +++ b/tgt-vhdl/state.hh @@ -39,7 +39,7 @@ ivl_signal_t find_signal_named(const std::string &name, const vhdl_scope *scope) // Manage the set of VHDL entities void remember_entity(vhdl_entity *ent, ivl_scope_t scope); -vhdl_entity* find_entity(const ivl_scope_t scope); +vhdl_entity* find_entity(ivl_scope_t scope); vhdl_entity* find_entity(const std::string& name); void emit_all_entities(std::ostream& os, int max_depth); void free_all_vhdl_objects(); diff --git a/tgt-vhdl/stmt.cc b/tgt-vhdl/stmt.cc index ec0cec8b9..d5f94c1e5 100644 --- a/tgt-vhdl/stmt.cc +++ b/tgt-vhdl/stmt.cc @@ -313,11 +313,11 @@ void make_assignment(vhdl_procedural *proc, stmt_container *container, if (NULL == test) return; - vhdl_if_stmt *vhdif = new vhdl_if_stmt(test); - if (!check_valid_assignment(decl->assignment_type(), proc, stmt)) return; + vhdl_if_stmt *vhdif = new vhdl_if_stmt(test); + // True part { vhdl_abstract_assign_stmt *a = @@ -1342,6 +1342,7 @@ int draw_casezx(vhdl_procedural *proc, stmt_container *container, "expression labels can be translated to VHDL", ivl_stmt_file(stmt), ivl_stmt_lineno(stmt), (is_casez ? "z" : "x")); + delete all; return 1; } diff --git a/tgt-vvp/draw_mux.c b/tgt-vvp/draw_mux.c index 592afea73..a9c767863 100644 --- a/tgt-vvp/draw_mux.c +++ b/tgt-vvp/draw_mux.c @@ -48,6 +48,11 @@ static void draw_lpm_mux_ab(ivl_lpm_t net, const char*muxz) if (number_is_immediate(d_rise, 64, 0) && number_is_immediate(d_fall, 64, 0) && number_is_immediate(d_decay, 64, 0)) { + + assert( ! number_is_unknown(d_rise)); + assert( ! number_is_unknown(d_fall)); + assert( ! number_is_unknown(d_decay)); + fprintf(vvp_out, "L_%p .delay (%lu,%lu,%lu) L_%p/d;\n", net, get_number_immediate(d_rise), get_number_immediate(d_fall), diff --git a/tgt-vvp/draw_net_input.c b/tgt-vvp/draw_net_input.c index c65e826f0..299382b2c 100644 --- a/tgt-vvp/draw_net_input.c +++ b/tgt-vvp/draw_net_input.c @@ -388,6 +388,10 @@ static char* draw_net_input_drive(ivl_nexus_t nex, ivl_nexus_ptr_t nptr) number_is_immediate(d_fall, 64, 0) && number_is_immediate(d_decay, 64, 0)) { + assert(! number_is_unknown(d_rise)); + assert(! number_is_unknown(d_fall)); + assert(! number_is_unknown(d_decay)); + fprintf(vvp_out, "L_%p .delay " "(%" PRIu64 ",%" PRIu64 ",%" PRIu64 ") L_%p/d;\n", cptr, get_number_immediate64(d_rise), diff --git a/tgt-vvp/draw_vpi.c b/tgt-vvp/draw_vpi.c index 5ab4e9d8f..0858e672c 100644 --- a/tgt-vvp/draw_vpi.c +++ b/tgt-vvp/draw_vpi.c @@ -109,6 +109,7 @@ static int get_vpi_taskfunc_signal_arg(struct args_info *result, if (word_ex) { /* Some array select have been evaluated. */ if (number_is_immediate(word_ex,IMM_WID, 0)) { + assert(! number_is_unknown(word_ex)); use_word = get_number_immediate(word_ex); word_ex = 0; } @@ -130,6 +131,7 @@ static int get_vpi_taskfunc_signal_arg(struct args_info *result, if (word_ex) { /* Some array select have been evaluated. */ if (number_is_immediate(word_ex, IMM_WID, 0)) { + assert(! number_is_unknown(word_ex)); use_word = get_number_immediate(word_ex); use_word_defined = 1; word_ex = 0; @@ -185,6 +187,7 @@ static int get_vpi_taskfunc_signal_arg(struct args_info *result, /* This is a constant bit/part select. */ if (number_is_immediate(bexpr, 64, 1)) { + assert(! number_is_unknown(bexpr)); snprintf(buffer, sizeof buffer, "&PV", ivl_expr_signal(vexpr), get_number_immediate(bexpr), @@ -206,9 +209,19 @@ static int get_vpi_taskfunc_signal_arg(struct args_info *result, return 0; } } else { - /* Fallback case: evaluate the expression. */ + /* Fallback case: evaluate the expression. */ struct vector_info rv; rv = draw_eval_expr(bexpr, STUFF_OK_XZ); + /* We need to enhance &PV<> to support a signed index. */ + if (ivl_expr_signed(bexpr) && + (ivl_expr_width(bexpr) < 8*sizeof(int))) { + fprintf(stderr, "%s:%u: tgt-vvp warning: V0.9 may give " + "incorrect results for a select with a " + "signed index less than %d bits.\n", + ivl_expr_file(expr), + ivl_expr_lineno(expr), + 8*sizeof(int)); + } snprintf(buffer, sizeof buffer, "&PV", ivl_expr_signal(vexpr), rv.base, rv.wid, diff --git a/tgt-vvp/eval_expr.c b/tgt-vvp/eval_expr.c index 3e6074794..a41ba97f9 100644 --- a/tgt-vvp/eval_expr.c +++ b/tgt-vvp/eval_expr.c @@ -174,6 +174,12 @@ static void eval_logic_into_integer(ivl_expr_t expr, unsigned ix) case IVL_EX_ULONG: { assert(number_is_immediate(expr, IMM_WID, 1)); + if (number_is_unknown(expr)) { + /* We are loading a 'bx so mimic %ix/get. */ + fprintf(vvp_out, " %%ix/load %u, 0, 0;\n", ix); + fprintf(vvp_out, " %%mov 4, 1, 1;\n"); + break; + } long imm = get_number_immediate(expr); if (imm >= 0) { fprintf(vvp_out, " %%ix/load %u, %ld, 0;\n", ix, imm); @@ -192,6 +198,7 @@ static void eval_logic_into_integer(ivl_expr_t expr, unsigned ix) unsigned word = 0; if (ivl_signal_dimensions(sig) > 0) { ivl_expr_t ixe; + char*type = ivl_expr_signed(expr) ? "/s" : ""; /* Detect the special case that this is a variable array. In this case, the ix/getv @@ -199,20 +206,21 @@ static void eval_logic_into_integer(ivl_expr_t expr, unsigned ix) if (ivl_signal_type(sig) == IVL_SIT_REG) { struct vector_info rv; rv = draw_eval_expr(expr, 0); - fprintf(vvp_out, " %%ix/get %u, %u, %u;\n", - ix, rv.base, rv.wid); + fprintf(vvp_out, " %%ix/get%s %u, %u, %u;\n", + type, ix, rv.base, rv.wid); clr_vector(rv); break; } ixe = ivl_expr_oper1(expr); - if (number_is_immediate(ixe, IMM_WID, 0)) + if (number_is_immediate(ixe, IMM_WID, 0)) { + assert(! number_is_unknown(ixe)); word = get_number_immediate(ixe); - else { + } else { struct vector_info rv; rv = draw_eval_expr(expr, 0); - fprintf(vvp_out, " %%ix/get %u, %u, %u;\n", - ix, rv.base, rv.wid); + fprintf(vvp_out, " %%ix/get%s %u, %u, %u;\n", + type, ix, rv.base, rv.wid); clr_vector(rv); break; } @@ -226,8 +234,14 @@ static void eval_logic_into_integer(ivl_expr_t expr, unsigned ix) default: { struct vector_info rv; rv = draw_eval_expr(expr, 0); - fprintf(vvp_out, " %%ix/get %u, %u, %u;\n", - ix, rv.base, rv.wid); + /* Is this a signed expression? */ + if (ivl_expr_signed(expr)) { + fprintf(vvp_out, " %%ix/get/s %u, %u, %u;\n", + ix, rv.base, rv.wid); + } else { + fprintf(vvp_out, " %%ix/get %u, %u, %u;\n", + ix, rv.base, rv.wid); + } clr_vector(rv); break; } @@ -274,7 +288,10 @@ static struct vector_info draw_eq_immediate(ivl_expr_t exp, unsigned ewid, { unsigned wid; struct vector_info lv; - unsigned long imm = get_number_immediate(re); + unsigned long imm; + assert(number_is_immediate(re, IMM_WID, 0)); + assert(! number_is_unknown(re)); + imm = get_number_immediate(re); wid = ivl_expr_width(le); lv = draw_eval_expr_wid(le, wid, stuff_ok_flag); @@ -991,6 +1008,8 @@ static struct vector_info draw_logic_immediate(ivl_expr_t exp, unsigned wid) { struct vector_info lv = draw_eval_expr_wid(le, wid, STUFF_OK_XZ); + assert(number_is_immediate(re, IMM_WID, 0)); + assert(! number_is_unknown(re)); unsigned long imm = get_number_immediate(re); assert(lv.base >= 4); @@ -1241,8 +1260,10 @@ static struct vector_info draw_load_add_immediate(ivl_expr_t le, int signed_flag) { struct vector_info lv; - long imm = get_number_immediate(re); + long imm; + assert(! number_is_unknown(re)); assert(number_is_immediate(re, IMM_WID, 1)); + imm = get_number_immediate(re); lv.base = allocate_vector(wid); lv.wid = wid; if (lv.base == 0) { @@ -1270,6 +1291,8 @@ static struct vector_info draw_add_immediate(ivl_expr_t le, lv = draw_eval_expr_wid(le, wid, STUFF_OK_XZ); assert(lv.wid == wid); + assert(! number_is_unknown(re)); + assert(number_is_immediate(re, IMM_WID, 0)); imm = get_number_immediate(re); /* This shouldn't generally happen, because the elaborator @@ -1308,7 +1331,7 @@ static struct vector_info draw_add_immediate(ivl_expr_t le, } break; - case 2: /* Left expression is X or Z */ + case 2: /* Left expression is 'bx or 'bz */ case 3: lv.base = 2; break; @@ -1335,6 +1358,8 @@ static struct vector_info draw_sub_immediate(ivl_expr_t le, lv = draw_eval_expr_wid(le, wid, STUFF_OK_XZ); assert(lv.wid == wid); + assert(! number_is_unknown(re)); + assert(number_is_immediate(re, IMM_WID, 0)); imm = get_number_immediate(re); if (imm == 0) return lv; @@ -1379,6 +1404,8 @@ static struct vector_info draw_mul_immediate(ivl_expr_t le, lv = draw_eval_expr_wid(le, wid, STUFF_OK_XZ); assert(lv.wid == wid); + assert(! number_is_unknown(re)); + assert(number_is_immediate(re, IMM_WID, 0)); imm = get_number_immediate(re); if (imm == 0) return lv; @@ -2253,7 +2280,7 @@ static struct vector_info draw_select_array(ivl_expr_t sube, unsigned bit_width, unsigned wid) { - unsigned idx; + unsigned idx, label; ivl_signal_t sig = ivl_expr_signal(sube); /* unsigned sig_wid = ivl_expr_width(sube); */ ivl_expr_t ix = ivl_expr_oper1(sube); @@ -2263,7 +2290,18 @@ static struct vector_info draw_select_array(ivl_expr_t sube, shiv = draw_eval_expr(bit_idx, STUFF_OK_XZ|STUFF_OK_RO); draw_eval_expr_into_integer(ix, 3); - fprintf(vvp_out, " %%ix/get 0, %u, %u;\n", shiv.base, shiv.wid); + label = local_count++; + /* We can safely skip the bit index load below if the array word + * index is undefined. We need to do this so that the bit index + * load does not reset bit 4 to zero by loading a defined value. */ + fprintf(vvp_out, " %%jmp/1 T_%d.%d, 4;\n", thread_count, label); + if (ivl_expr_signed(bit_idx)) { + fprintf(vvp_out, " %%ix/get/s 0, %u, %u;\n", shiv.base, + shiv.wid); + } else { + fprintf(vvp_out, " %%ix/get 0, %u, %u;\n", shiv.base, shiv.wid); + } + fprintf(vvp_out, "T_%d.%d ;\n", thread_count, label); if (shiv.base >= 8) clr_vector(shiv); @@ -2294,7 +2332,7 @@ static struct vector_info draw_select_signal(ivl_expr_t sube, /* Use this word of the signal. */ unsigned use_word = 0; - unsigned use_wid; + unsigned use_wid, lab_x, lab_end; /* If this is an access to an array, try to get the index as a constant. If it is (and the array is not a reg array then @@ -2311,6 +2349,7 @@ static struct vector_info draw_select_signal(ivl_expr_t sube, /* The index is constant, so we can return to direct readout with the specific word selected. */ + assert(! number_is_unknown(ix)); use_word = get_number_immediate(ix); } @@ -2318,6 +2357,7 @@ static struct vector_info draw_select_signal(ivl_expr_t sube, the signal (or the entire width). Just load the early bits in one go. */ if (number_is_immediate(bit_idx, 32, 0) + && !number_is_unknown(bit_idx) && get_number_immediate(bit_idx) == 0 && (ivl_expr_width(sube) >= bit_wid)) { @@ -2343,6 +2383,12 @@ static struct vector_info draw_select_signal(ivl_expr_t sube, res.wid = wid; assert(res.base); + lab_x = local_count++; + lab_end = local_count++; + + /* If the index is 'bx then we just return 'bx. */ + fprintf(vvp_out, " %%jmp/1 T_%d.%d, 4;\n", thread_count, lab_x); + use_wid = res.wid; if (use_wid > bit_wid) use_wid = bit_wid; @@ -2353,6 +2399,11 @@ static struct vector_info draw_select_signal(ivl_expr_t sube, fprintf(vvp_out, " %%movi %u, 0, %u;\n", res.base + use_wid, res.wid - use_wid); + fprintf(vvp_out, " %%jmp T_%d.%d;\n", thread_count, lab_end); + fprintf(vvp_out, "T_%d.%d ;\n", thread_count, lab_x); + fprintf(vvp_out, " %%mov %u, 2, %u;\n", res.base, res.wid); + fprintf(vvp_out, "T_%d.%d ;\n", thread_count, lab_end); + return res; } @@ -2371,6 +2422,7 @@ static void draw_select_signal_dest(ivl_expr_t sube, if ((ivl_signal_dimensions(sig) == 0) && (ivl_expr_width(sube) >= dest.wid) && number_is_immediate(bit_idx, 32, 0) + && ! number_is_unknown(bit_idx) && get_number_immediate(bit_idx) == 0) { unsigned use_word = 0; fprintf(vvp_out, " %%load/v %u, v%p_%u, %u; Select %u out of %u bits\n", @@ -2401,6 +2453,8 @@ static struct vector_info draw_select_expr(ivl_expr_t exp, unsigned wid, ivl_expr_t shift = ivl_expr_oper2(exp); int alloc_exclusive = (stuff_ok_flag&STUFF_OK_RO)? 0 : 1; + int cmp; + unsigned lab_l, lab_end; res.wid = wid; @@ -2444,7 +2498,12 @@ static struct vector_info draw_select_expr(ivl_expr_t exp, unsigned wid, return res; } - fprintf(vvp_out, " %%ix/get 0, %u, %u;\n", shiv.base, shiv.wid); + if (ivl_expr_signed(shift)) { + fprintf(vvp_out, " %%ix/get/s 0, %u, %u;\n", shiv.base, + shiv.wid); + } else { + fprintf(vvp_out, " %%ix/get 0, %u, %u;\n", shiv.base, shiv.wid); + } clr_vector(shiv); /* If the subv result is a magic constant, then make a copy in @@ -2458,7 +2517,27 @@ static struct vector_info draw_select_expr(ivl_expr_t exp, unsigned wid, subv = res; } + lab_l = local_count++; + lab_end = local_count++; + /* If we have an undefined index then just produce a 'bx result. */ + fprintf(vvp_out, " %%jmp/1 T_%d.%d, 4;\n", thread_count, lab_l); + + cmp = allocate_word(); + assert(subv.wid >= wid); + /* Determine if we need to shift a 'bx into the top. */ + fprintf(vvp_out, " %%ix/load %u, %u, 0;\n", cmp, subv.wid - wid); + fprintf(vvp_out, " %%cmp/ws %u, 0;\n", cmp); + clr_word(cmp); + fprintf(vvp_out, " %%jmp/1 T_%d.%d, 5;\n", thread_count, lab_l); + /* Clear the cmp bit if the two values are equal. */ + fprintf(vvp_out, " %%mov 4, 0, 1;\n"); fprintf(vvp_out, " %%shiftr/i0 %u, %u;\n", subv.base, subv.wid); + fprintf(vvp_out, " %%jmp T_%d.%d;\n", thread_count, lab_end); + fprintf(vvp_out, "T_%d.%d ;\n", thread_count, lab_l); + /* Multiply by -1. */ + fprintf(vvp_out, " %%ix/mul 0, %u, %u;\n", 0xFFFFFFFF, 0xFFFFFFFF); + fprintf(vvp_out, " %%shiftl/i0 %u, %u;\n", subv.base, subv.wid); + fprintf(vvp_out, "T_%d.%d ;\n", thread_count, lab_end); if (subv.wid > wid) { res.base = subv.base; diff --git a/tgt-vvp/vvp_process.c b/tgt-vvp/vvp_process.c index ed35af624..37d87ec69 100644 --- a/tgt-vvp/vvp_process.c +++ b/tgt-vvp/vvp_process.c @@ -87,7 +87,8 @@ static void set_to_lvariable(ivl_lval_t lval, if (part_off_ex == 0) { part_off = 0; - } else if (number_is_immediate(part_off_ex, IMM_WID, 0)) { + } else if (number_is_immediate(part_off_ex, IMM_WID, 0) && + !number_is_unknown(part_off_ex)) { part_off = get_number_immediate(part_off_ex); part_off_ex = 0; } @@ -96,6 +97,7 @@ static void set_to_lvariable(ivl_lval_t lval, it to select the word, and pay no further heed to the expression itself. */ if (word_ix && number_is_immediate(word_ix, IMM_WID, 0)) { + assert(! number_is_unknown(word_ix)); use_word = get_number_immediate(word_ix); word_ix = 0; } @@ -222,6 +224,63 @@ static void set_to_lvariable(ivl_lval_t lval, } } +/* Support a non-blocking assignment to a real array word. */ +static void assign_to_array_r_word(ivl_signal_t lsig, ivl_expr_t word_ix, + unsigned bit, uint64_t delay, + ivl_expr_t dexp, unsigned nevents) +{ + unsigned skip_assign = transient_id++; + + /* This code is common to all the different types of array delays. */ + if (number_is_immediate(word_ix, IMM_WID, 0)) { + assert(! number_is_unknown(word_ix)); + fprintf(vvp_out, " %%ix/load 3, %lu, 0; address\n", + get_number_immediate(word_ix)); + } else { + /* Calculate array word index into index register 3 */ + draw_eval_expr_into_integer(word_ix, 3); + /* Skip assignment if word expression is not defined. */ + fprintf(vvp_out, " %%jmp/1 t_%u, 4;\n", skip_assign); + } + + if (dexp != 0) { + /* Calculated delay... */ + int delay_index = allocate_word(); + draw_eval_expr_into_integer(dexp, delay_index); + fprintf(vvp_out, " %%assign/ar/d v%p, %d, %u;\n", lsig, + delay_index, bit); + clr_word(delay_index); + } else if (nevents != 0) { + /* Event control delay... */ + fprintf(vvp_out, " %%assign/ar/e v%p, %u;\n", lsig, bit); + } else { + /* Constant delay... */ + unsigned long low_d = delay % UINT64_C(0x100000000); + unsigned long hig_d = delay / UINT64_C(0x100000000); + + /* + * The %assign can only take a 32 bit delay. For a larger + * delay we need to put it into an index register. + */ + if (hig_d != 0) { + int delay_index = allocate_word(); + fprintf(vvp_out, " %%ix/load %d, %lu, %lu;\n", + delay_index, low_d, hig_d); + fprintf(vvp_out, " %%assign/ar/d v%p, %d, %u;\n", lsig, + delay_index, bit); + clr_word(delay_index); + } else { + fprintf(vvp_out, " %%assign/ar v%p, %lu, %u;\n", + lsig, low_d, bit); + } + } + + fprintf(vvp_out, "t_%u ;\n", skip_assign); + if (nevents != 0) fprintf(vvp_out, " %%evctl/c;\n"); + + clear_expression_lookaside(); +} + static void assign_to_array_word(ivl_signal_t lsig, ivl_expr_t word_ix, unsigned bit, uint64_t delay, ivl_expr_t dexp, ivl_expr_t part_off_ex, unsigned width, @@ -233,12 +292,14 @@ static void assign_to_array_word(ivl_signal_t lsig, ivl_expr_t word_ix, if (part_off_ex == 0) { part_off = 0; } else if (number_is_immediate(part_off_ex, IMM_WID, 0)) { + assert(! number_is_unknown(part_off_ex)); part_off = get_number_immediate(part_off_ex); part_off_ex = 0; } /* This code is common to all the different types of array delays. */ if (number_is_immediate(word_ix, IMM_WID, 0)) { + assert(! number_is_unknown(word_ix)); fprintf(vvp_out, " %%ix/load 3, %lu, 0; address\n", get_number_immediate(word_ix)); } else { @@ -317,6 +378,7 @@ static void assign_to_lvector(ivl_lval_t lval, unsigned bit, if (part_off_ex == 0) { part_off = 0; } else if (number_is_immediate(part_off_ex, IMM_WID, 0)) { + assert(! number_is_unknown(part_off_ex)); part_off = get_number_immediate(part_off_ex); part_off_ex = 0; } @@ -643,13 +705,6 @@ static int show_stmt_assign_nb_real(ivl_statement_t net) sig = ivl_lval_sig(lval); assert(sig); - if (ivl_signal_dimensions(sig) > 0) { - word_ix = ivl_lval_idx(lval); - assert(word_ix); - assert(number_is_immediate(word_ix, IMM_WID, 0)); - use_word = get_number_immediate(word_ix); - } - if (del && (ivl_expr_type(del) == IVL_EX_DELAY)) { assert(number_is_immediate(del, 64, 0)); delay = ivl_expr_delay_val(del); @@ -659,6 +714,14 @@ static int show_stmt_assign_nb_real(ivl_statement_t net) /* Evaluate the r-value */ word = draw_eval_real(rval); + if (ivl_signal_dimensions(sig) > 0) { + word_ix = ivl_lval_idx(lval); + assert(word_ix); + assign_to_array_r_word(sig, word_ix, word, delay, del, nevents); + clr_word(word); + return 0; + } + /* We need to calculate the delay expression. */ if (del) { assert(nevents == 0); @@ -1105,11 +1168,13 @@ static void force_vector_to_lval(ivl_statement_t net, struct vector_info rvec) part_off = 0; } else { assert(number_is_immediate(part_off_ex, IMM_WID, 0)); + assert(! number_is_unknown(part_off_ex)); part_off = get_number_immediate(part_off_ex); } if (word_idx != 0) { assert(number_is_immediate(word_idx, IMM_WID, 0)); + assert(! number_is_unknown(word_idx)); use_word = get_number_immediate(word_idx); } @@ -1174,6 +1239,7 @@ static void force_link_rval(ivl_statement_t net, ivl_expr_t rval) * part select (this could give us multiple drivers). */ part_off_ex = ivl_lval_part_off(lval); if (ivl_signal_width(lsig) > ivl_signal_width(rsig) || + // Do we need checks for number_is{immediate,unknown} of part_of_ex? (part_off_ex && get_number_immediate(part_off_ex) != 0)) { fprintf(stderr, "%s:%u: vvp-tgt sorry: cannot %s signal to " "a bit/part select.\n", ivl_expr_file(rval), @@ -1184,11 +1250,13 @@ static void force_link_rval(ivl_statement_t net, ivl_expr_t rval) /* At least for now, only handle force to fixed words of an array. */ if ((lword_idx = ivl_lval_idx(lval)) != 0) { assert(number_is_immediate(lword_idx, IMM_WID, 0)); + assert(! number_is_unknown(lword_idx)); use_lword = get_number_immediate(lword_idx); } if ((rword_idx = ivl_expr_oper1(rval)) != 0) { assert(number_is_immediate(rword_idx, IMM_WID, 0)); + assert(! number_is_unknown(rword_idx)); use_rword = get_number_immediate(rword_idx); } @@ -1272,11 +1340,13 @@ static int show_stmt_deassign(ivl_statement_t net) part_off = 0; if (part_off_ex != 0) { assert(number_is_immediate(part_off_ex, 64, 0)); + assert(! number_is_unknown(part_off_ex)); part_off = get_number_immediate(part_off_ex); } if (word_idx != 0) { assert(number_is_immediate(word_idx, IMM_WID, 0)); + assert(! number_is_unknown(word_idx)); use_word = get_number_immediate(word_idx); } @@ -1567,6 +1637,7 @@ static int show_stmt_release(ivl_statement_t net) part_off = 0; if (part_off_ex != 0) { assert(number_is_immediate(part_off_ex, 64, 0)); + assert(! number_is_unknown(part_off_ex)); part_off = get_number_immediate(part_off_ex); } @@ -1581,6 +1652,7 @@ static int show_stmt_release(ivl_statement_t net) if (word_idx != 0) { assert(number_is_immediate(word_idx, IMM_WID, 0)); + assert(! number_is_unknown(word_idx)); use_word = get_number_immediate(word_idx); } diff --git a/tgt-vvp/vvp_scope.c b/tgt-vvp/vvp_scope.c index 160044b1a..3b54dfdc9 100644 --- a/tgt-vvp/vvp_scope.c +++ b/tgt-vvp/vvp_scope.c @@ -558,6 +558,9 @@ static void draw_delay(ivl_net_logic_t lptr) assert(number_is_immediate(d0, 64, 0)); assert(number_is_immediate(d1, 64, 0)); assert(number_is_immediate(d2, 64, 0)); + assert(! number_is_unknown(d0)); + assert(! number_is_unknown(d1)); + assert(! number_is_unknown(d2)); if (d0 == d1 && d1 == d2) fprintf(vvp_out, " (%lu)", get_number_immediate(d0)); @@ -615,6 +618,8 @@ static void draw_udp_in_scope(ivl_net_logic_t lptr) static ivl_udp_t *udps = 0x0; static int nudps = 0; int i; + unsigned ninp; + const char **input_strings; for (i=0; i"); + input_strings[pdx] = "C4"; } else { - fprintf(vvp_out, ", %s", draw_net_input(nex)); + input_strings[pdx] = draw_net_input(nex); } } + fprintf(vvp_out, "L_%p .udp", lptr); + fprintf(vvp_out, " UDP_%s", + vvp_mangle_id(ivl_udp_name(udp))); + draw_delay(lptr); + + for (pdx = 0 ; pdx < ninp ; pdx += 1) { + fprintf(vvp_out, ", %s", input_strings[pdx]); + } + free(input_strings); + fprintf(vvp_out, ";\n"); } @@ -805,7 +822,6 @@ static void draw_logic_in_scope(ivl_net_logic_t lptr) input_strings[pdx] = draw_net_input(ivl_logic_pin(lptr, pdx+1)); level = 0; - ninp = ivl_logic_pins(lptr) - 1; while (ninp) { int inst; for (inst = 0; inst < ninp; inst += 4) { @@ -861,6 +877,9 @@ static void draw_logic_in_scope(ivl_net_logic_t lptr) && number_is_immediate(fall_exp,64,0) && number_is_immediate(decay_exp,64,0)) { + assert(! number_is_unknown(rise_exp)); + assert(! number_is_unknown(fall_exp)); + assert(! number_is_unknown(decay_exp)); fprintf(vvp_out, "L_%p .delay (%lu,%lu,%lu) L_%p/d;\n", lptr, get_number_immediate(rise_exp), get_number_immediate(fall_exp), @@ -1066,6 +1085,9 @@ static const char* draw_lpm_output_delay(ivl_lpm_t net) assert(number_is_immediate(d_rise, 64, 0)); assert(number_is_immediate(d_fall, 64, 0)); assert(number_is_immediate(d_decay, 64, 0)); + assert(! number_is_unknown(d_rise)); + assert(! number_is_unknown(d_fall)); + assert(! number_is_unknown(d_decay)); dly = "/d"; fprintf(vvp_out, "L_%p .delay (%lu,%lu,%lu) L_%p/d;\n", net, get_number_immediate(d_rise), @@ -1322,7 +1344,7 @@ static unsigned lpm_concat_inputs(ivl_lpm_t net, unsigned start, static void draw_lpm_concat(ivl_lpm_t net) { const char*src_table[4]; - unsigned icnt = ivl_lpm_selects(net); + unsigned icnt = ivl_lpm_size(net); const char*dly = draw_lpm_output_delay(net); if (icnt <= 4) { diff --git a/vpi/sys_display.c b/vpi/sys_display.c index c0f116290..96cef1789 100644 --- a/vpi/sys_display.c +++ b/vpi/sys_display.c @@ -1127,9 +1127,15 @@ static PLI_INT32 sys_display_calltf(PLI_BYTE8 *name) val.format = vpiIntVal; vpi_get_value(arg, &val); fd_mcd = val.value.integer; + + /* If the MCD is zero we have nothing to do so just return. */ + if (fd_mcd == 0) { + vpi_free_object(argv); + return 0; + } + if ((! IS_MCD(fd_mcd) && vpi_get_file(fd_mcd) == NULL) || - ( IS_MCD(fd_mcd) && my_mcd_printf(fd_mcd, "") == EOF) || - (! fd_mcd)) { + ( IS_MCD(fd_mcd) && my_mcd_printf(fd_mcd, "") == EOF)) { vpi_printf("WARNING: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("invalid file descriptor/MCD (0x%x) given " @@ -1241,9 +1247,15 @@ static PLI_INT32 sys_strobe_calltf(PLI_BYTE8*name) val.format = vpiIntVal; vpi_get_value(arg, &val); fd_mcd = val.value.integer; + + /* If the MCD is zero we have nothing to do so just return. */ + if (fd_mcd == 0) { + vpi_free_object(argv); + return 0; + } + if ((! IS_MCD(fd_mcd) && vpi_get_file(fd_mcd) == NULL) || - ( IS_MCD(fd_mcd) && my_mcd_printf(fd_mcd, "") == EOF) || - (! fd_mcd)) { + ( IS_MCD(fd_mcd) && my_mcd_printf(fd_mcd, "") == EOF)) { vpi_printf("WARNING: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); vpi_printf("invalid file descriptor/MCD (0x%x) given " diff --git a/vpi/sys_fileio.c b/vpi/sys_fileio.c index f65331f7b..2fccdd49e 100644 --- a/vpi/sys_fileio.c +++ b/vpi/sys_fileio.c @@ -153,10 +153,13 @@ static PLI_INT32 sys_fopen_calltf(PLI_BYTE8*name) } fname = get_filename(callh, name, fileh); - if (fname == 0 && mode) free(mode_string); /* If either the mode or file name are not valid just return. */ - if (fail || fname == 0) return 0; + if (fail || fname == 0) { + free(fname); + if (mode) free(mode_string); + return 0; + } val.format = vpiIntVal; if (mode) { @@ -267,6 +270,9 @@ static PLI_INT32 sys_fflush_calltf(PLI_BYTE8*name) vpi_get_value(arg, &val); fd_mcd = val.value.integer; + /* If the MCD is zero we have nothing to do so just return. */ + if (fd_mcd == 0) return 0; + if ((! IS_MCD(fd_mcd) && vpi_get_file(fd_mcd) == NULL) || ( IS_MCD(fd_mcd) && vpi_mcd_printf(fd_mcd, str) == EOF) || (! fd_mcd)) { diff --git a/vpi/sys_readmem.c b/vpi/sys_readmem.c index 14976d253..8a522625f 100644 --- a/vpi/sys_readmem.c +++ b/vpi/sys_readmem.c @@ -293,7 +293,10 @@ static PLI_INT32 sys_readmem_calltf(PLI_BYTE8*name) if (process_params(mitem, start_item, stop_item, callh, name, &start_addr, &stop_addr, &addr_incr, - &min_addr, &max_addr)) return 0; + &min_addr, &max_addr)) { + free(fname); + return 0; + } /* Open the data file. */ file = fopen(fname, "r"); @@ -528,7 +531,10 @@ static PLI_INT32 sys_writemem_calltf(PLI_BYTE8*name) if (process_params(mitem, start_item, stop_item, callh, name, &start_addr, &stop_addr, &addr_incr, - &min_addr, &max_addr)) return 0; + &min_addr, &max_addr)) { + free(fname); + return 0; + } /* Open the data file. */ file = fopen(fname, "w"); diff --git a/vpi/sys_scanf.c b/vpi/sys_scanf.c index db64fc35e..e36ddcfa5 100644 --- a/vpi/sys_scanf.c +++ b/vpi/sys_scanf.c @@ -626,6 +626,7 @@ static PLI_INT32 sys_fscanf_compiletf(PLI_BYTE8*name) (int)vpi_get(vpiLineNo, callh)); vpi_printf("%s's first argument (fd) must be numeric.\n", name); vpi_control(vpiFinish, 1); + vpi_free_object(argv); return 0; } @@ -695,6 +696,7 @@ static PLI_INT32 sys_sscanf_compiletf(PLI_BYTE8*name) vpi_printf("%s's first argument must be a register or constant " "string.\n", name); vpi_control(vpiFinish, 1); + vpi_free_object(argv); return 0; } diff --git a/vpi/sys_vcd.c b/vpi/sys_vcd.c index c5b5c177f..904a80056 100644 --- a/vpi/sys_vcd.c +++ b/vpi/sys_vcd.c @@ -805,6 +805,7 @@ static PLI_INT32 sys_dumpvars_calltf(PLI_BYTE8*name) vpi_printf("VCD warning: skipping signal %s, " "it was previously included.\n", fullname); + free(scname); continue; } else { add_var = 1; diff --git a/vpi/v2005_math.c b/vpi/v2005_math.c index 942c3369c..feda0818c 100644 --- a/vpi/v2005_math.c +++ b/vpi/v2005_math.c @@ -184,6 +184,7 @@ static PLI_INT32 va_single_argument_compiletf(PLI_BYTE8 *ud) /* Check that there are arguments. */ if (argv == 0) { va_error_message(callh, "%s requires one argument.\n", name); + free(fun_data); return 0; } @@ -265,6 +266,7 @@ static PLI_INT32 va_double_argument_compiletf(PLI_BYTE8 *ud) /* Check that there are arguments. */ if (argv == 0) { va_error_message(callh, "%s requires two arguments.\n", name); + free(fun_data); return 0; } diff --git a/vpi/va_math.c b/vpi/va_math.c index 91523de7a..cc2581422 100644 --- a/vpi/va_math.c +++ b/vpi/va_math.c @@ -216,6 +216,7 @@ static PLI_INT32 va_single_argument_compiletf(PLI_BYTE8 *ud) /* Check that there are arguments. */ if (argv == 0) { va_error_message(callh, "%s requires one argument.\n", name); + free(fun_data); return 0; } @@ -303,6 +304,7 @@ static PLI_INT32 va_double_argument_compiletf(PLI_BYTE8 *ud) /* Check that there are arguments. */ if (argv == 0) { va_error_message(callh, "%s requires two arguments.\n", name); + free(fun_data); return 0; } diff --git a/vvp/codes.h b/vvp/codes.h index eff9a2b14..5558119c6 100644 --- a/vvp/codes.h +++ b/vvp/codes.h @@ -1,7 +1,7 @@ #ifndef __codes_H #define __codes_H /* - * Copyright (c) 2001-2008 Stephen Williams (steve@icarus.com) + * Copyright (c) 2001-2009 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -40,6 +40,9 @@ extern bool of_ALLOC(vthread_t thr, vvp_code_t code); extern bool of_AND(vthread_t thr, vvp_code_t code); extern bool of_ANDI(vthread_t thr, vvp_code_t code); extern bool of_ANDR(vthread_t thr, vvp_code_t code); +extern bool of_ASSIGN_AR(vthread_t thr, vvp_code_t code); +extern bool of_ASSIGN_ARD(vthread_t thr, vvp_code_t code); +extern bool of_ASSIGN_ARE(vthread_t thr, vvp_code_t code); extern bool of_ASSIGN_AV(vthread_t thr, vvp_code_t code); extern bool of_ASSIGN_AVD(vthread_t thr, vvp_code_t code); extern bool of_ASSIGN_AVE(vthread_t thr, vvp_code_t code); diff --git a/vvp/compile.cc b/vvp/compile.cc index 676ea5db7..67356aed9 100644 --- a/vvp/compile.cc +++ b/vvp/compile.cc @@ -87,6 +87,9 @@ const static struct opcode_table_s opcode_table[] = { { "%and", of_AND, 3, {OA_BIT1, OA_BIT2, OA_NUMBER} }, { "%and/r", of_ANDR, 3, {OA_BIT1, OA_BIT2, OA_NUMBER} }, { "%andi", of_ANDI, 3, {OA_BIT1, OA_BIT2, OA_NUMBER} }, + { "%assign/ar",of_ASSIGN_AR,3,{OA_ARR_PTR,OA_BIT1, OA_BIT2} }, + { "%assign/ar/d",of_ASSIGN_ARD,3,{OA_ARR_PTR,OA_BIT1, OA_BIT2} }, + { "%assign/ar/e",of_ASSIGN_ARE,2,{OA_ARR_PTR,OA_BIT1, OA_NONE} }, { "%assign/av",of_ASSIGN_AV,3,{OA_ARR_PTR,OA_BIT1, OA_BIT2} }, { "%assign/av/d",of_ASSIGN_AVD,3,{OA_ARR_PTR,OA_BIT1, OA_BIT2} }, { "%assign/av/e",of_ASSIGN_AVE,2,{OA_ARR_PTR,OA_BIT1, OA_NONE} }, diff --git a/vvp/config.guess b/vvp/config.guess deleted file mode 100755 index e38e3d54a..000000000 --- a/vvp/config.guess +++ /dev/null @@ -1,1364 +0,0 @@ -#! /bin/sh -# Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002 Free Software Foundation, Inc. - -timestamp='2002-07-23' - -# This file 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Originally written by Per Bothner . -# Please send patches to . Submit a context -# diff and a properly formatted ChangeLog entry. -# -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. -# -# The plan is that this can be called by configure scripts if you -# don't specify an explicit build system type. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] - -Output the configuration name of the system \`$me' is run on. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.guess ($timestamp) - -Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 -Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit 0 ;; - --version | -v ) - echo "$version" ; exit 0 ;; - --help | --h* | -h ) - echo "$usage"; exit 0 ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" >&2 - exit 1 ;; - * ) - break ;; - esac -done - -if test $# != 0; then - echo "$me: too many arguments$help" >&2 - exit 1 -fi - -trap 'exit 1' 1 2 15 - -# CC_FOR_BUILD -- compiler used by this script. Note that the use of a -# compiler to aid in system detection is discouraged as it requires -# temporary files to be created and, as you can see below, it is a -# headache to deal with in a portable fashion. - -# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still -# use `HOST_CC' if defined, but it is deprecated. - -# This shell variable is my proudest work .. or something. --bje - -set_cc_for_build='tmpdir=${TMPDIR-/tmp}/config-guess-$$ ; -(old=`umask` && umask 077 && mkdir $tmpdir && umask $old && unset old) - || (echo "$me: cannot create $tmpdir" >&2 && exit 1) ; -dummy=$tmpdir/dummy ; -files="$dummy.c $dummy.o $dummy.rel $dummy" ; -trap '"'"'rm -f $files; rmdir $tmpdir; exit 1'"'"' 1 2 15 ; -case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int x;" > $dummy.c ; - for c in cc gcc c89 c99 ; do - if ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ; then - CC_FOR_BUILD="$c"; break ; - fi ; - done ; - rm -f $files ; - if test x"$CC_FOR_BUILD" = x ; then - CC_FOR_BUILD=no_compiler_found ; - fi - ;; - ,,*) CC_FOR_BUILD=$CC ;; - ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac ; -unset files' - -# This is needed to find uname on a Pyramid OSx when run in the BSD universe. -# (ghazi@noc.rutgers.edu 1994-08-24) -if (test -f /.attbin/uname) >/dev/null 2>&1 ; then - PATH=$PATH:/.attbin ; export PATH -fi - -UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown -UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown -UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown - -case "${UNAME_MACHINE}" in - i?86) - test -z "$VENDOR" && VENDOR=pc - ;; - *) - test -z "$VENDOR" && VENDOR=unknown - ;; -esac -test -f /etc/SuSE-release && VENDOR=suse - -# Note: order is significant - the case branches are not exclusive. - -case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - *:NetBSD:*:*) - # NetBSD (nbsd) targets should (where applicable) match one or - # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, - # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently - # switched to ELF, *-*-netbsd* would select the old - # object file format. This provides both forward - # compatibility and a consistent mechanism for selecting the - # object file format. - # - # Note: NetBSD doesn't particularly care about the vendor - # portion of the name. We always set it to "unknown". - sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || echo unknown)` - case "${UNAME_MACHINE_ARCH}" in - armeb) machine=armeb-unknown ;; - arm*) machine=arm-unknown ;; - sh3el) machine=shl-unknown ;; - sh3eb) machine=sh-unknown ;; - *) machine=${UNAME_MACHINE_ARCH}-unknown ;; - esac - # The Operating System including object format, if it has switched - # to ELF recently, or will in the future. - case "${UNAME_MACHINE_ARCH}" in - arm*|i386|m68k|ns32k|sh3*|sparc|vax) - eval $set_cc_for_build - if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep __ELF__ >/dev/null - then - # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). - # Return netbsd for either. FIX? - os=netbsd - else - os=netbsdelf - fi - ;; - *) - os=netbsd - ;; - esac - # The OS release - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: - # contains redundant information, the shorter form: - # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" - exit 0 ;; - amiga:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - arc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - hp300:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mac68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - macppc:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme88k:OpenBSD:*:*) - echo m88k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvmeppc:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - pmax:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sgi:OpenBSD:*:*) - echo mipseb-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sun3:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - wgrisc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - *:OpenBSD:*:*) - echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - alpha:OSF1:*:*) - if test $UNAME_RELEASE = "V4.0"; then - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - fi - # A Vn.n version is a released version. - # A Tn.n version is a released field test version. - # A Xn.n version is an unreleased experimental baselevel. - # 1.2 uses "1.2" for uname -r. - eval $set_cc_for_build - cat <$dummy.s - .data -\$Lformat: - .byte 37,100,45,37,120,10,0 # "%d-%x\n" - - .text - .globl main - .align 4 - .ent main -main: - .frame \$30,16,\$26,0 - ldgp \$29,0(\$27) - .prologue 1 - .long 0x47e03d80 # implver \$0 - lda \$2,-1 - .long 0x47e20c21 # amask \$2,\$1 - lda \$16,\$Lformat - mov \$0,\$17 - not \$1,\$18 - jsr \$26,printf - ldgp \$29,0(\$26) - mov 0,\$16 - jsr \$26,exit - .end main -EOF - $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null - if test "$?" = 0 ; then - case `$dummy` in - 0-0) - UNAME_MACHINE="alpha" - ;; - 1-0) - UNAME_MACHINE="alphaev5" - ;; - 1-1) - UNAME_MACHINE="alphaev56" - ;; - 1-101) - UNAME_MACHINE="alphapca56" - ;; - 2-303) - UNAME_MACHINE="alphaev6" - ;; - 2-307) - UNAME_MACHINE="alphaev67" - ;; - 2-1307) - UNAME_MACHINE="alphaev68" - ;; - 3-1307) - UNAME_MACHINE="alphaev7" - ;; - esac - fi - rm -f $dummy.s $dummy && rmdir $tmpdir - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - exit 0 ;; - Alpha\ *:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # Should we change UNAME_MACHINE based on the output of uname instead - # of the specific Alpha model? - echo alpha-pc-interix - exit 0 ;; - 21064:Windows_NT:50:3) - echo alpha-dec-winnt3.5 - exit 0 ;; - Amiga*:UNIX_System_V:4.0:*) - echo m68k-unknown-sysv4 - exit 0;; - *:[Aa]miga[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-amigaos - exit 0 ;; - *:[Mm]orph[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-morphos - exit 0 ;; - *:OS/390:*:*) - echo i370-ibm-openedition - exit 0 ;; - arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix${UNAME_RELEASE} - exit 0;; - SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) - echo hppa1.1-hitachi-hiuxmpp - exit 0;; - Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) - # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. - if test "`(/bin/universe) 2>/dev/null`" = att ; then - echo pyramid-pyramid-sysv3 - else - echo pyramid-pyramid-bsd - fi - exit 0 ;; - NILE*:*:*:dcosx) - echo pyramid-pyramid-svr4 - exit 0 ;; - DRS?6000:UNIX_SV:4.2*:7*) - case `/usr/bin/uname -p` in - sparc) echo sparc-icl-nx7 && exit 0 ;; - esac ;; - sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - i86pc:SunOS:5.*:*) - echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - sun4*:SunOS:6*:*) - # According to config.sub, this is the proper way to canonicalize - # SunOS6. Hard to guess exactly what SunOS6 will be like, but - # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in - Series*|S4*) - UNAME_RELEASE=`uname -v` - ;; - esac - # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit 0 ;; - sun3*:SunOS:*:*) - echo m68k-sun-sunos${UNAME_RELEASE} - exit 0 ;; - sun*:*:4.2BSD:*) - UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 - case "`/bin/arch`" in - sun3) - echo m68k-sun-sunos${UNAME_RELEASE} - ;; - sun4) - echo sparc-sun-sunos${UNAME_RELEASE} - ;; - esac - exit 0 ;; - aushp:SunOS:*:*) - echo sparc-auspex-sunos${UNAME_RELEASE} - exit 0 ;; - # The situation for MiNT is a little confusing. The machine name - # can be virtually everything (everything which is not - # "atarist" or "atariste" at least should have a processor - # > m68000). The system name ranges from "MiNT" over "FreeMiNT" - # to the lowercase version "mint" (or "freemint"). Finally - # the system name "TOS" denotes a system which is actually not - # MiNT. But MiNT is downward compatible to TOS, so this should - # be no problem. - atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; - atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; - *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; - milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit 0 ;; - hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit 0 ;; - *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit 0 ;; - powerpc:machten:*:*) - echo powerpc-apple-machten${UNAME_RELEASE} - exit 0 ;; - RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 - exit 0 ;; - RISC*:ULTRIX:*:*) - echo mips-dec-ultrix${UNAME_RELEASE} - exit 0 ;; - VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix${UNAME_RELEASE} - exit 0 ;; - 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix${UNAME_RELEASE} - exit 0 ;; - mips:*:*:UMIPS | mips:*:*:RISCos) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c -#ifdef __cplusplus -#include /* for printf() prototype */ - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif - #if defined (host_mips) && defined (MIPSEB) - #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); - #endif - #endif - exit (-1); - } -EOF - $CC_FOR_BUILD $dummy.c -o $dummy \ - && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ - && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 - rm -f $dummy.c $dummy && rmdir $tmpdir - echo mips-mips-riscos${UNAME_RELEASE} - exit 0 ;; - Motorola:PowerMAX_OS:*:*) - echo powerpc-motorola-powermax - exit 0 ;; - Night_Hawk:*:*:PowerMAX_OS) - echo powerpc-harris-powermax - exit 0 ;; - Night_Hawk:Power_UNIX:*:*) - echo powerpc-harris-powerunix - exit 0 ;; - m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 - exit 0 ;; - m88k:*:4*:R4*) - echo m88k-motorola-sysv4 - exit 0 ;; - m88k:*:3*:R3*) - echo m88k-motorola-sysv3 - exit 0 ;; - AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] - then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ - [ ${TARGET_BINARY_INTERFACE}x = x ] - then - echo m88k-dg-dgux${UNAME_RELEASE} - else - echo m88k-dg-dguxbcs${UNAME_RELEASE} - fi - else - echo i586-dg-dgux${UNAME_RELEASE} - fi - exit 0 ;; - M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 - exit 0 ;; - M88*:*:R3*:*) - # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 - exit 0 ;; - XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 - exit 0 ;; - Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd - exit 0 ;; - *:IRIX*:*:*) - echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit 0 ;; - ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i*86:AIX:*:*) - echo i386-ibm-aix - exit 0 ;; - ia64:AIX:*:*) - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} - exit 0 ;; - *:AIX:2:3) - if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - - main() - { - if (!__power_pc()) - exit(1); - puts("powerpc-ibm-aix3.2.5"); - exit(0); - } -EOF - $CC_FOR_BUILD $dummy.c -o $dummy && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 - rm -f $dummy.c $dummy && rmdir $tmpdir - echo rs6000-ibm-aix3.2.5 - elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then - echo rs6000-ibm-aix3.2.4 - else - echo rs6000-ibm-aix3.2 - fi - exit 0 ;; - *:AIX:*:[45]) - IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` - if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then - IBM_ARCH=rs6000 - else - IBM_ARCH=powerpc - fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit 0 ;; - *:AIX:*:*) - echo rs6000-ibm-aix - exit 0 ;; - ibmrt:4.4BSD:*|romp-ibm:BSD:*) - echo romp-ibm-bsd4.4 - exit 0 ;; - ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and - echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to - exit 0 ;; # report: romp-ibm BSD 4.3 - *:BOSX:*:*) - echo rs6000-bull-bosx - exit 0 ;; - DPX/2?00:B.O.S.:*:*) - echo m68k-bull-sysv3 - exit 0 ;; - 9000/[34]??:4.3bsd:1.*:*) - echo m68k-hp-bsd - exit 0 ;; - hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - echo m68k-hp-bsd4.4 - exit 0 ;; - 9000/[34678]??:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - case "${UNAME_MACHINE}" in - 9000/31? ) HP_ARCH=m68000 ;; - 9000/[34]?? ) HP_ARCH=m68k ;; - 9000/[678][0-9][0-9]) - if [ -x /usr/bin/getconf ]; then - sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 - 532) # CPU_PA_RISC2_0 - case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 - esac ;; - esac - fi - if [ "${HP_ARCH}" = "" ]; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - - #define _HPUX_SOURCE - #include - #include - - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); - - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } -EOF - (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null) && HP_ARCH=`$dummy` - if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi - rm -f $dummy.c $dummy && rmdir $tmpdir - fi ;; - esac - echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit 0 ;; - ia64:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux${HPUX_REV} - exit 0 ;; - 3050*:HI-UX:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - int - main () - { - long cpu = sysconf (_SC_CPU_VERSION); - /* The order matters, because CPU_IS_HP_MC68K erroneously returns - true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct - results, however. */ - if (CPU_IS_PA_RISC (cpu)) - { - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; - case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; - default: puts ("hppa-hitachi-hiuxwe2"); break; - } - } - else if (CPU_IS_HP_MC68K (cpu)) - puts ("m68k-hitachi-hiuxwe2"); - else puts ("unknown-hitachi-hiuxwe2"); - exit (0); - } -EOF - $CC_FOR_BUILD $dummy.c -o $dummy && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 - rm -f $dummy.c $dummy && rmdir $tmpdir - echo unknown-hitachi-hiuxwe2 - exit 0 ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) - echo hppa1.1-hp-bsd - exit 0 ;; - 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd - exit 0 ;; - *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) - echo hppa1.0-hp-mpeix - exit 0 ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) - echo hppa1.1-hp-osf - exit 0 ;; - hp8??:OSF1:*:*) - echo hppa1.0-hp-osf - exit 0 ;; - i*86:OSF1:*:*) - if [ -x /usr/sbin/sysversion ] ; then - echo ${UNAME_MACHINE}-unknown-osf1mk - else - echo ${UNAME_MACHINE}-unknown-osf1 - fi - exit 0 ;; - parisc*:Lites*:*:*) - echo hppa1.1-hp-lites - exit 0 ;; - C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd - exit 0 ;; - C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit 0 ;; - C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd - exit 0 ;; - C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd - exit 0 ;; - C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - echo c4-convex-bsd - exit 0 ;; - CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY*[A-Z]90:*:*:*) - echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ - | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ - -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ - -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY*T3D:*:*:*) - echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY*SV1:*:*:*) - echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit 0 ;; - i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit 0 ;; - sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; - *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; - *:FreeBSD:*:*) - # Determine whether the default compiler uses glibc. - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - #if __GLIBC__ >= 2 - LIBC=gnu - #else - LIBC= - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - rm -f $dummy.c && rmdir $tmpdir - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} - exit 0 ;; - i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin - exit 0 ;; - i*:MINGW*:*) - echo ${UNAME_MACHINE}-pc-mingw32 - exit 0 ;; - i*:PW*:*) - echo ${UNAME_MACHINE}-pc-pw32 - exit 0 ;; - x86:Interix*:3*) - echo i386-pc-interix3 - exit 0 ;; - i*:Windows_NT*:* | Pentium*:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we - # UNAME_MACHINE based on the output of uname instead of i386? - echo i386-pc-interix - exit 0 ;; - i*:UWIN*:*) - echo ${UNAME_MACHINE}-pc-uwin - exit 0 ;; - p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin - exit 0 ;; - prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - *:GNU:*:*) - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit 0 ;; - i*86:Minix:*:*) - echo ${UNAME_MACHINE}-pc-minix - exit 0 ;; - arm*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux - exit 0 ;; - ia64:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux - exit 0 ;; - m68*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux - exit 0 ;; - mips:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef mips - #undef mipsel - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mipsel - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips - #else - CPU= - #endif - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - rm -f $dummy.c && rmdir $tmpdir - test x"${CPU}" != x && echo "${CPU}-${VENDOR}-linux" && exit 0 - ;; - ppc:Linux:*:*) - echo powerpc-${VENDOR}-linux - exit 0 ;; - ppc64:Linux:*:*) - echo powerpc64-${VENDOR}-linux - exit 0 ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in - EV5) UNAME_MACHINE=alphaev5 ;; - EV56) UNAME_MACHINE=alphaev56 ;; - PCA56) UNAME_MACHINE=alphapca56 ;; - PCA57) UNAME_MACHINE=alphapca56 ;; - EV6) UNAME_MACHINE=alphaev6 ;; - EV67) UNAME_MACHINE=alphaev67 ;; - EV68*) UNAME_MACHINE=alphaev68 ;; - esac - objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-${VENDOR}-linux${LIBC} - exit 0 ;; - parisc:Linux:*:* | hppa:Linux:*:*) - # Look for CPU level - case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-${VENDOR}-linux ;; - PA8*) echo hppa2.0-${VENDOR}-linux ;; - *) echo hppa-${VENDOR}-linux ;; - esac - exit 0 ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-${VENDOR}-linux - exit 0 ;; - s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux - exit 0 ;; - sh*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux - exit 0 ;; - sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux - exit 0 ;; - x86_64:Linux:*:*) - echo x86_64-${VENDOR}-linux - exit 0 ;; - i*86:Linux:*:*) - # The BFD linker knows what the default object file format is, so - # first see if it will tell us. cd to the root directory to prevent - # problems with other programs or directories called `ld' in the path. - # Set LC_ALL=C to ensure ld outputs messages in English. - ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ - | sed -ne '/supported targets:/!d - s/[ ][ ]*/ /g - s/.*supported targets: *// - s/ .*// - p'` - case "$ld_supported_targets" in - elf32-i386) - TENTATIVE="${UNAME_MACHINE}-${VENDOR}-linux" - ;; - a.out-i386-linux) - echo "${UNAME_MACHINE}-${VENDOR}-linuxaout" - exit 0 ;; - coff-i386) - echo "${UNAME_MACHINE}-${VENDOR}-linuxcoff" - exit 0 ;; - "") - # Either a pre-BFD a.out linker (linuxoldld) or - # one that does not give us useful --help. - echo "${UNAME_MACHINE}-${VENDOR}-linuxoldld" - exit 0 ;; - esac - # Determine whether the default compiler is a.out or elf - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - #ifdef __ELF__ - # ifdef __GLIBC__ - # if __GLIBC__ >= 2 - LIBC=gnu - # else - LIBC=gnulibc1 - # endif - # else - LIBC=gnulibc1 - # endif - #else - #ifdef __INTEL_COMPILER - LIBC=gnu - #else - LIBC=gnuaout - #endif - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - rm -f $dummy.c && rmdir $tmpdir - test x"${LIBC}" != x && echo "${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}" | sed 's/linux-gnu/linux/' && exit 0 - test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 - ;; - i*86:DYNIX/ptx:4*:*) - # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. - # earlier versions are messed up and put the nodename in both - # sysname and nodename. - echo i386-sequent-sysv4 - exit 0 ;; - i*86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, - # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. - echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - exit 0 ;; - i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) - UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` - if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} - else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} - fi - exit 0 ;; - i*86:*:5:[78]*) - case `/bin/uname -X | grep "^Machine"` in - *486*) UNAME_MACHINE=i486 ;; - *Pentium) UNAME_MACHINE=i586 ;; - *Pent*|*Celeron) UNAME_MACHINE=i686 ;; - esac - echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} - exit 0 ;; - i*86:*:3.2:*) - if test -f /usr/options/cb.name; then - UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` - (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ - && UNAME_MACHINE=i586 - (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ - && UNAME_MACHINE=i686 - (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ - && UNAME_MACHINE=i686 - echo ${UNAME_MACHINE}-pc-sco$UNAME_REL - else - echo ${UNAME_MACHINE}-pc-sysv32 - fi - exit 0 ;; - i*86:*DOS:*:*) - echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit 0 ;; - pc:*:*:*) - # Left here for compatibility: - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i386. - echo i386-pc-msdosdjgpp - exit 0 ;; - Intel:Mach:3*:*) - echo i386-pc-mach3 - exit 0 ;; - paragon:*:*:*) - echo i860-intel-osf1 - exit 0 ;; - i860:*:4.*:*) # i860-SVR4 - if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 - else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 - fi - exit 0 ;; - mini*:CTIX:SYS*5:*) - # "miniframe" - echo m68010-convergent-sysv - exit 0 ;; - M68*:*:R3V[567]*:*) - test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; - 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0) - OS_REL='' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4.3${OS_REL} && exit 0 - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; - 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4 && exit 0 ;; - m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 - exit 0 ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) - echo powerpc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv${UNAME_RELEASE} - exit 0 ;; - RM*:ReliantUNIX-*:*:*) - echo mips-sni-sysv4 - exit 0 ;; - RM*:SINIX-*:*:*) - echo mips-sni-sysv4 - exit 0 ;; - *:SINIX-*:*:*) - if uname -p 2>/dev/null >/dev/null ; then - UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo ${UNAME_MACHINE}-sni-sysv4 - else - echo ns32k-sni-sysv - fi - exit 0 ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says - echo i586-unisys-sysv4 - exit 0 ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes . - # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 - exit 0 ;; - *:*:*:FTX*) - # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 - exit 0 ;; - *:VOS:*:*) - # From Paul.Green@stratus.com. - echo hppa1.1-stratus-vos - exit 0 ;; - mc68*:A/UX:*:*) - echo m68k-apple-aux${UNAME_RELEASE} - exit 0 ;; - news*:NEWS-OS:6*:*) - echo mips-sony-newsos6 - exit 0 ;; - R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) - if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} - else - echo mips-unknown-sysv${UNAME_RELEASE} - fi - exit 0 ;; - BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - echo powerpc-be-beos - exit 0 ;; - BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - echo powerpc-apple-beos - exit 0 ;; - BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - echo i586-pc-beos - exit 0 ;; - SX-4:SUPER-UX:*:*) - echo sx4-nec-superux${UNAME_RELEASE} - exit 0 ;; - SX-5:SUPER-UX:*:*) - echo sx5-nec-superux${UNAME_RELEASE} - exit 0 ;; - Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; - *:Rhapsody:*:*) - echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; - *:Darwin:*:*) - echo `uname -p`-apple-darwin${UNAME_RELEASE} - exit 0 ;; - *:procnto*:*:* | *:QNX:[0123456789]*:*) - UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = "x86"; then - UNAME_PROCESSOR=i386 - UNAME_MACHINE=pc - fi - echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} - exit 0 ;; - *:QNX:*:4*) - echo i386-pc-qnx - exit 0 ;; - NSR-[GKLNPTVW]:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk${UNAME_RELEASE} - exit 0 ;; - *:NonStop-UX:*:*) - echo mips-compaq-nonstopux - exit 0 ;; - BS2000:POSIX*:*:*) - echo bs2000-siemens-sysv - exit 0 ;; - DS/*:UNIX_System_V:*:*) - echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} - exit 0 ;; - *:Plan9:*:*) - # "uname -m" is not consistent, so use $cputype instead. 386 - # is converted to i386 for consistency with other x86 - # operating systems. - if test "$cputype" = "386"; then - UNAME_MACHINE=i386 - else - UNAME_MACHINE="$cputype" - fi - echo ${UNAME_MACHINE}-unknown-plan9 - exit 0 ;; - i*86:OS/2:*:*) - # If we were able to find `uname', then EMX Unix compatibility - # is probably installed. - echo ${UNAME_MACHINE}-pc-os2-emx - exit 0 ;; - *:TOPS-10:*:*) - echo pdp10-unknown-tops10 - exit 0 ;; - *:TENEX:*:*) - echo pdp10-unknown-tenex - exit 0 ;; - KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) - echo pdp10-dec-tops20 - exit 0 ;; - XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) - echo pdp10-xkl-tops20 - exit 0 ;; - *:TOPS-20:*:*) - echo pdp10-unknown-tops20 - exit 0 ;; - *:ITS:*:*) - echo pdp10-unknown-its - exit 0 ;; - i*86:XTS-300:*:STOP) - echo ${UNAME_MACHINE}-unknown-stop - exit 0 ;; - i*86:atheos:*:*) - echo ${UNAME_MACHINE}-unknown-atheos - exit 0 ;; -esac - -#echo '(No uname command or uname output not recognized.)' 1>&2 -#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 - -eval $set_cc_for_build -cat >$dummy.c < -# include -#endif -main () -{ -#if defined (sony) -#if defined (MIPSEB) - /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, - I don't know.... */ - printf ("mips-sony-bsd\n"); exit (0); -#else -#include - printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 - "4" -#else - "" -#endif - ); exit (0); -#endif -#endif - -#if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix"); exit (0); -#endif - -#if defined (hp300) && !defined (hpux) - printf ("m68k-hp-bsd\n"); exit (0); -#endif - -#if defined (NeXT) -#if !defined (__ARCHITECTURE__) -#define __ARCHITECTURE__ "m68k" -#endif - int version; - version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - if (version < 4) - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); - else - printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); - exit (0); -#endif - -#if defined (MULTIMAX) || defined (n16) -#if defined (UMAXV) - printf ("ns32k-encore-sysv\n"); exit (0); -#else -#if defined (CMU) - printf ("ns32k-encore-mach\n"); exit (0); -#else - printf ("ns32k-encore-bsd\n"); exit (0); -#endif -#endif -#endif - -#if defined (__386BSD__) - printf ("i386-pc-bsd\n"); exit (0); -#endif - -#if defined (sequent) -#if defined (i386) - printf ("i386-sequent-dynix\n"); exit (0); -#endif -#if defined (ns32000) - printf ("ns32k-sequent-dynix\n"); exit (0); -#endif -#endif - -#if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); - -#endif - -#if defined (vax) -# if !defined (ultrix) -# include -# if defined (BSD) -# if BSD == 43 - printf ("vax-dec-bsd4.3\n"); exit (0); -# else -# if BSD == 199006 - printf ("vax-dec-bsd4.3reno\n"); exit (0); -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# endif -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# else - printf ("vax-dec-ultrix\n"); exit (0); -# endif -#endif - -#if defined (alliant) && defined (i860) - printf ("i860-alliant-bsd\n"); exit (0); -#endif - - exit (1); -} -EOF - -$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 -rm -f $dummy.c $dummy && rmdir $tmpdir - -# Apollos put the system type in the environment. - -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } - -# Convex versions that predate uname can use getsysinfo(1) - -if [ -x /usr/convex/getsysinfo ] -then - case `getsysinfo -f cpu_type` in - c1*) - echo c1-convex-bsd - exit 0 ;; - c2*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit 0 ;; - c34*) - echo c34-convex-bsd - exit 0 ;; - c38*) - echo c38-convex-bsd - exit 0 ;; - c4*) - echo c4-convex-bsd - exit 0 ;; - esac -fi - -cat >&2 < in order to provide the needed -information to handle your system. - -config.guess timestamp = $timestamp - -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null` - -hostinfo = `(hostinfo) 2>/dev/null` -/bin/universe = `(/bin/universe) 2>/dev/null` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` -/bin/arch = `(/bin/arch) 2>/dev/null` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` - -UNAME_MACHINE = ${UNAME_MACHINE} -UNAME_RELEASE = ${UNAME_RELEASE} -UNAME_SYSTEM = ${UNAME_SYSTEM} -UNAME_VERSION = ${UNAME_VERSION} -EOF - -exit 1 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/vvp/config.sub b/vvp/config.sub deleted file mode 100755 index 09de79bf0..000000000 --- a/vvp/config.sub +++ /dev/null @@ -1,1457 +0,0 @@ -#! /bin/sh -# Configuration validation subroutine script. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002 Free Software Foundation, Inc. - -timestamp='2002-07-03' - -# This file is (in principle) common to ALL GNU software. -# The presence of a machine in this file suggests that SOME GNU software -# can handle that machine. It does not imply ALL GNU software can. -# -# This file 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., 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Please send patches to . Submit a context -# diff and a properly formatted ChangeLog entry. -# -# Configuration subroutine to validate and canonicalize a configuration type. -# Supply the specified configuration type as an argument. -# If it is invalid, we print an error message on stderr and exit with code 1. -# Otherwise, we print the canonical config type on stdout and succeed. - -# This file is supposed to be the same for all GNU packages -# and recognize all the CPU types, system types and aliases -# that are meaningful with *any* GNU software. -# Each package is responsible for reporting which valid configurations -# it does not support. The user should be able to distinguish -# a failure to support a valid configuration from a meaningless -# configuration. - -# The goal of this file is to map all the various variations of a given -# machine specification into a single specification in the form: -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or in some cases, the newer four-part form: -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# It is wrong to echo any other type of specification. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS - $0 [OPTION] ALIAS - -Canonicalize a configuration name. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.sub ($timestamp) - -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 -Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit 0 ;; - --version | -v ) - echo "$version" ; exit 0 ;; - --help | --h* | -h ) - echo "$usage"; exit 0 ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" - exit 1 ;; - - *local*) - # First pass through any local machine types. - echo $1 - exit 0;; - - * ) - break ;; - esac -done - -case $# in - 0) echo "$me: missing argument$help" >&2 - exit 1;; - 1) ;; - *) echo "$me: too many arguments$help" >&2 - exit 1;; -esac - -# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). -# Here we must recognize all the valid KERNEL-OS combinations. -maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` -case $maybe_os in - nto-qnx* | linux-gnu* | freebsd*-gnu* | storm-chaos* | os2-emx* | windows32-* | rtmk-nova*) - os=-$maybe_os - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` - ;; - *) - basic_machine=`echo $1 | sed 's/-[^-]*$//'` - if [ $basic_machine != $1 ] - then os=`echo $1 | sed 's/.*-/-/'` - else os=; fi - ;; -esac - -### Let's recognize common machines as not being operating systems so -### that things like config.sub decstation-3100 work. We also -### recognize some manufacturers as not being operating systems, so we -### can provide default operating systems below. -case $os in - -sun*os*) - # Prevent following clause from handling this invalid input. - ;; - -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ - -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ - -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ - -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ - -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ - -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis) - os= - basic_machine=$1 - ;; - -sim | -cisco | -oki | -wec | -winbond) - os= - basic_machine=$1 - ;; - -scout) - ;; - -wrs) - os=-vxworks - basic_machine=$1 - ;; - -chorusos*) - os=-chorusos - basic_machine=$1 - ;; - -chorusrdb) - os=-chorusrdb - basic_machine=$1 - ;; - -hiux*) - os=-hiuxwe2 - ;; - -sco5) - os=-sco3.2v5 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco4) - os=-sco3.2v4 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2.[4-9]*) - os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2v[4-9]*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco*) - os=-sco3.2v2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -udk*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -isc) - os=-isc2.2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -clix*) - basic_machine=clipper-intergraph - ;; - -isc*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -lynx*) - os=-lynxos - ;; - -ptx*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` - ;; - -windowsnt*) - os=`echo $os | sed -e 's/windowsnt/winnt/'` - ;; - -psos*) - os=-psos - ;; - -mint | -mint[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; -esac - -# Decode aliases for certain CPU-COMPANY combinations. -case $basic_machine in - # Recognize the basic CPU types without company name. - # Some are omitted here because they have special meanings below. - 1750a | 580 \ - | a29k \ - | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ - | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ - | c4x | clipper \ - | d10v | d30v | dlx | dsp16xx \ - | fr30 | frv \ - | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ - | i370 | i860 | i960 | ia64 \ - | ip2k \ - | m32r | m68000 | m68k | m88k | mcore \ - | mips | mipsbe | mipseb | mipsel | mipsle \ - | mips16 \ - | mips64 | mips64el \ - | mips64orion | mips64orionel \ - | mips64vr4100 | mips64vr4100el \ - | mips64vr4300 | mips64vr4300el \ - | mips64vr5000 | mips64vr5000el \ - | mipsisa32 | mipsisa32el \ - | mipsisa64 | mipsisa64el \ - | mipsisa64sb1 | mipsisa64sb1el \ - | mipstx39 | mipstx39el \ - | mn10200 | mn10300 \ - | ns16k | ns32k \ - | openrisc | or32 \ - | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ - | pyramid \ - | sh | sh[1234] | sh3e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ - | sh64 | sh64le \ - | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ - | strongarm \ - | tahoe | thumb | tic80 | tron \ - | v850 | v850e \ - | we32k \ - | x86 | xscale | xstormy16 | xtensa \ - | z8k) - basic_machine=$basic_machine-unknown - ;; - m6811 | m68hc11 | m6812 | m68hc12) - # Motorola 68HC11/12. - basic_machine=$basic_machine-unknown - os=-none - ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) - ;; - - # We use `pc' rather than `unknown' - # because (1) that's what they normally are, and - # (2) the word "unknown" tends to confuse beginning users. - i*86 | x86_64) - basic_machine=$basic_machine-pc - ;; - # Object if more than one company name word. - *-*-*) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; - # Recognize the basic CPU types with company name. - 580-* \ - | a29k-* \ - | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ - | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ - | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | avr-* \ - | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c54x-* \ - | clipper-* | cydra-* \ - | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ - | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ - | h8300-* | h8500-* \ - | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ - | i*86-* | i860-* | i960-* | ia64-* \ - | ip2k-* \ - | m32r-* \ - | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | mcore-* \ - | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ - | mips16-* \ - | mips64-* | mips64el-* \ - | mips64orion-* | mips64orionel-* \ - | mips64vr4100-* | mips64vr4100el-* \ - | mips64vr4300-* | mips64vr4300el-* \ - | mips64vr5000-* | mips64vr5000el-* \ - | mipsisa32-* | mipsisa32el-* \ - | mipsisa64-* | mipsisa64el-* \ - | mipsisa64sb1-* | mipsisa64sb1el-* \ - | mipstx39 | mipstx39el \ - | none-* | np1-* | ns16k-* | ns32k-* \ - | orion-* \ - | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ - | pyramid-* \ - | romp-* | rs6000-* \ - | sh-* | sh[1234]-* | sh3e-* | sh[34]eb-* | shbe-* \ - | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ - | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ - | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \ - | v850-* | v850e-* | vax-* \ - | we32k-* \ - | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ - | xtensa-* \ - | ymp-* \ - | z8k-*) - ;; - # Recognize the various machine names and aliases which stand - # for a CPU type and a company and sometimes even an OS. - 386bsd) - basic_machine=i386-unknown - os=-bsd - ;; - 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - basic_machine=m68000-att - ;; - 3b*) - basic_machine=we32k-att - ;; - a29khif) - basic_machine=a29k-amd - os=-udi - ;; - adobe68k) - basic_machine=m68010-adobe - os=-scout - ;; - alliant | fx80) - basic_machine=fx80-alliant - ;; - altos | altos3068) - basic_machine=m68k-altos - ;; - am29k) - basic_machine=a29k-none - os=-bsd - ;; - amdahl) - basic_machine=580-amdahl - os=-sysv - ;; - amiga | amiga-*) - basic_machine=m68k-unknown - ;; - amigaos | amigados) - basic_machine=m68k-unknown - os=-amigaos - ;; - amigaunix | amix) - basic_machine=m68k-unknown - os=-sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - os=-sysv - ;; - apollo68bsd) - basic_machine=m68k-apollo - os=-bsd - ;; - aux) - basic_machine=m68k-apple - os=-aux - ;; - balance) - basic_machine=ns32k-sequent - os=-dynix - ;; - c90) - basic_machine=c90-cray - os=-unicos - ;; - convex-c1) - basic_machine=c1-convex - os=-bsd - ;; - convex-c2) - basic_machine=c2-convex - os=-bsd - ;; - convex-c32) - basic_machine=c32-convex - os=-bsd - ;; - convex-c34) - basic_machine=c34-convex - os=-bsd - ;; - convex-c38) - basic_machine=c38-convex - os=-bsd - ;; - cray | j90) - basic_machine=j90-cray - os=-unicos - ;; - crds | unos) - basic_machine=m68k-crds - ;; - cris | cris-* | etrax*) - basic_machine=cris-axis - ;; - da30 | da30-*) - basic_machine=m68k-da30 - ;; - decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) - basic_machine=mips-dec - ;; - decsystem10* | dec10*) - basic_machine=pdp10-dec - os=-tops10 - ;; - decsystem20* | dec20*) - basic_machine=pdp10-dec - os=-tops20 - ;; - delta | 3300 | motorola-3300 | motorola-delta \ - | 3300-motorola | delta-motorola) - basic_machine=m68k-motorola - ;; - delta88) - basic_machine=m88k-motorola - os=-sysv3 - ;; - dpx20 | dpx20-*) - basic_machine=rs6000-bull - os=-bosx - ;; - dpx2* | dpx2*-bull) - basic_machine=m68k-bull - os=-sysv3 - ;; - ebmon29k) - basic_machine=a29k-amd - os=-ebmon - ;; - elxsi) - basic_machine=elxsi-elxsi - os=-bsd - ;; - encore | umax | mmax) - basic_machine=ns32k-encore - ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - os=-ose - ;; - fx2800) - basic_machine=i860-alliant - ;; - genix) - basic_machine=ns32k-ns - ;; - gmicro) - basic_machine=tron-gmicro - os=-sysv - ;; - go32) - basic_machine=i386-pc - os=-go32 - ;; - h3050r* | hiux*) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - h8300hms) - basic_machine=h8300-hitachi - os=-hms - ;; - h8300xray) - basic_machine=h8300-hitachi - os=-xray - ;; - h8500hms) - basic_machine=h8500-hitachi - os=-hms - ;; - harris) - basic_machine=m88k-harris - os=-sysv3 - ;; - hp300-*) - basic_machine=m68k-hp - ;; - hp300bsd) - basic_machine=m68k-hp - os=-bsd - ;; - hp300hpux) - basic_machine=m68k-hp - os=-hpux - ;; - hp3k9[0-9][0-9] | hp9[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k2[0-9][0-9] | hp9k31[0-9]) - basic_machine=m68000-hp - ;; - hp9k3[2-9][0-9]) - basic_machine=m68k-hp - ;; - hp9k6[0-9][0-9] | hp6[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k7[0-79][0-9] | hp7[0-79][0-9]) - basic_machine=hppa1.1-hp - ;; - hp9k78[0-9] | hp78[0-9]) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][13679] | hp8[0-9][13679]) - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][0-9] | hp8[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hppa-next) - os=-nextstep3 - ;; - hppaosf) - basic_machine=hppa1.1-hp - os=-osf - ;; - hppro) - basic_machine=hppa1.1-hp - os=-proelf - ;; - i370-ibm* | ibm*) - basic_machine=i370-ibm - ;; -# I'm not sure what "Sysv32" means. Should this be sysv3.2? - i*86v32) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv32 - ;; - i*86v4*) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv4 - ;; - i*86v) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv - ;; - i*86sol2) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-solaris2 - ;; - i386mach) - basic_machine=i386-mach - os=-mach - ;; - i386-vsta | vsta) - basic_machine=i386-unknown - os=-vsta - ;; - iris | iris4d) - basic_machine=mips-sgi - case $os in - -irix*) - ;; - *) - os=-irix4 - ;; - esac - ;; - isi68 | isi) - basic_machine=m68k-isi - os=-sysv - ;; - m88k-omron*) - basic_machine=m88k-omron - ;; - magnum | m3230) - basic_machine=mips-mips - os=-sysv - ;; - merlin) - basic_machine=ns32k-utek - os=-sysv - ;; - mingw32) - basic_machine=i386-pc - os=-mingw32 - ;; - miniframe) - basic_machine=m68000-convergent - ;; - *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; - mips3*-*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` - ;; - mips3*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown - ;; - mmix*) - basic_machine=mmix-knuth - os=-mmixware - ;; - monitor) - basic_machine=m68k-rom68k - os=-coff - ;; - morphos) - basic_machine=powerpc-unknown - os=-morphos - ;; - msdos) - basic_machine=i386-pc - os=-msdos - ;; - mvs) - basic_machine=i370-ibm - os=-mvs - ;; - ncr3000) - basic_machine=i486-ncr - os=-sysv4 - ;; - netbsd386) - basic_machine=i386-unknown - os=-netbsd - ;; - netwinder) - basic_machine=armv4l-rebel - os=-linux - ;; - news | news700 | news800 | news900) - basic_machine=m68k-sony - os=-newsos - ;; - news1000) - basic_machine=m68030-sony - os=-newsos - ;; - news-3600 | risc-news) - basic_machine=mips-sony - os=-newsos - ;; - necv70) - basic_machine=v70-nec - os=-sysv - ;; - next | m*-next ) - basic_machine=m68k-next - case $os in - -nextstep* ) - ;; - -ns2*) - os=-nextstep2 - ;; - *) - os=-nextstep3 - ;; - esac - ;; - nh3000) - basic_machine=m68k-harris - os=-cxux - ;; - nh[45]000) - basic_machine=m88k-harris - os=-cxux - ;; - nindy960) - basic_machine=i960-intel - os=-nindy - ;; - mon960) - basic_machine=i960-intel - os=-mon960 - ;; - nonstopux) - basic_machine=mips-compaq - os=-nonstopux - ;; - np1) - basic_machine=np1-gould - ;; - nsr-tandem) - basic_machine=nsr-tandem - ;; - op50n-* | op60c-*) - basic_machine=hppa1.1-oki - os=-proelf - ;; - or32 | or32-*) - basic_machine=or32-unknown - os=-coff - ;; - OSE68000 | ose68000) - basic_machine=m68000-ericsson - os=-ose - ;; - os68k) - basic_machine=m68k-none - os=-os68k - ;; - pa-hitachi) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - paragon) - basic_machine=i860-intel - os=-osf - ;; - pbd) - basic_machine=sparc-tti - ;; - pbb) - basic_machine=m68k-tti - ;; - pc532 | pc532-*) - basic_machine=ns32k-pc532 - ;; - pentium | p5 | k5 | k6 | nexgen | viac3) - basic_machine=i586-pc - ;; - pentiumpro | p6 | 6x86 | athlon) - basic_machine=i686-pc - ;; - pentiumii | pentium2) - basic_machine=i686-pc - ;; - pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) - basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumpro-* | p6-* | 6x86-* | athlon-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumii-* | pentium2-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pn) - basic_machine=pn-gould - ;; - power) basic_machine=power-ibm - ;; - ppc) basic_machine=powerpc-unknown - ;; - ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppcle | powerpclittle | ppc-le | powerpc-little) - basic_machine=powerpcle-unknown - ;; - ppcle-* | powerpclittle-*) - basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64) basic_machine=powerpc64-unknown - ;; - ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64le | powerpc64little | ppc64-le | powerpc64-little) - basic_machine=powerpc64le-unknown - ;; - ppc64le-* | powerpc64little-*) - basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ps2) - basic_machine=i386-ibm - ;; - pw32) - basic_machine=i586-unknown - os=-pw32 - ;; - rom68k) - basic_machine=m68k-rom68k - os=-coff - ;; - rm[46]00) - basic_machine=mips-siemens - ;; - rtpc | rtpc-*) - basic_machine=romp-ibm - ;; - s390 | s390-*) - basic_machine=s390-ibm - ;; - s390x | s390x-*) - basic_machine=s390x-ibm - ;; - sa29200) - basic_machine=a29k-amd - os=-udi - ;; - sequent) - basic_machine=i386-sequent - ;; - sh) - basic_machine=sh-hitachi - os=-hms - ;; - sparclite-wrs | simso-wrs) - basic_machine=sparclite-wrs - os=-vxworks - ;; - sps7) - basic_machine=m68k-bull - os=-sysv2 - ;; - spur) - basic_machine=spur-unknown - ;; - st2000) - basic_machine=m68k-tandem - ;; - stratus) - basic_machine=i860-stratus - os=-sysv4 - ;; - sun2) - basic_machine=m68000-sun - ;; - sun2os3) - basic_machine=m68000-sun - os=-sunos3 - ;; - sun2os4) - basic_machine=m68000-sun - os=-sunos4 - ;; - sun3os3) - basic_machine=m68k-sun - os=-sunos3 - ;; - sun3os4) - basic_machine=m68k-sun - os=-sunos4 - ;; - sun4os3) - basic_machine=sparc-sun - os=-sunos3 - ;; - sun4os4) - basic_machine=sparc-sun - os=-sunos4 - ;; - sun4sol2) - basic_machine=sparc-sun - os=-solaris2 - ;; - sun3 | sun3-*) - basic_machine=m68k-sun - ;; - sun4) - basic_machine=sparc-sun - ;; - sun386 | sun386i | roadrunner) - basic_machine=i386-sun - ;; - sv1) - basic_machine=sv1-cray - os=-unicos - ;; - symmetry) - basic_machine=i386-sequent - os=-dynix - ;; - t3d) - basic_machine=alpha-cray - os=-unicos - ;; - t3e) - basic_machine=alphaev5-cray - os=-unicos - ;; - t90) - basic_machine=t90-cray - os=-unicos - ;; - tic54x | c54x*) - basic_machine=tic54x-unknown - os=-coff - ;; - tx39) - basic_machine=mipstx39-unknown - ;; - tx39el) - basic_machine=mipstx39el-unknown - ;; - toad1) - basic_machine=pdp10-xkl - os=-tops20 - ;; - tower | tower-32) - basic_machine=m68k-ncr - ;; - udi29k) - basic_machine=a29k-amd - os=-udi - ;; - ultra3) - basic_machine=a29k-nyu - os=-sym1 - ;; - v810 | necv810) - basic_machine=v810-nec - os=-none - ;; - vaxv) - basic_machine=vax-dec - os=-sysv - ;; - vms) - basic_machine=vax-dec - os=-vms - ;; - vpp*|vx|vx-*) - basic_machine=f301-fujitsu - ;; - vxworks960) - basic_machine=i960-wrs - os=-vxworks - ;; - vxworks68) - basic_machine=m68k-wrs - os=-vxworks - ;; - vxworks29k) - basic_machine=a29k-wrs - os=-vxworks - ;; - w65*) - basic_machine=w65-wdc - os=-none - ;; - w89k-*) - basic_machine=hppa1.1-winbond - os=-proelf - ;; - windows32) - basic_machine=i386-pc - os=-windows32-msvcrt - ;; - xps | xps100) - basic_machine=xps100-honeywell - ;; - ymp) - basic_machine=ymp-cray - os=-unicos - ;; - z8k-*-coff) - basic_machine=z8k-unknown - os=-sim - ;; - none) - basic_machine=none-none - os=-none - ;; - -# Here we handle the default manufacturer of certain CPU types. It is in -# some cases the only manufacturer, in others, it is the most popular. - w89k) - basic_machine=hppa1.1-winbond - ;; - op50n) - basic_machine=hppa1.1-oki - ;; - op60c) - basic_machine=hppa1.1-oki - ;; - romp) - basic_machine=romp-ibm - ;; - rs6000) - basic_machine=rs6000-ibm - ;; - vax) - basic_machine=vax-dec - ;; - pdp10) - # there are many clones, so DEC is not a safe bet - basic_machine=pdp10-unknown - ;; - pdp11) - basic_machine=pdp11-dec - ;; - we32k) - basic_machine=we32k-att - ;; - sh3 | sh4 | sh3eb | sh4eb | sh[1234]le | sh3ele) - basic_machine=sh-unknown - ;; - sh64) - basic_machine=sh64-unknown - ;; - sparc | sparcv9 | sparcv9b) - basic_machine=sparc-sun - ;; - cydra) - basic_machine=cydra-cydrome - ;; - orion) - basic_machine=orion-highlevel - ;; - orion105) - basic_machine=clipper-highlevel - ;; - mac | mpw | mac-mpw) - basic_machine=m68k-apple - ;; - pmac | pmac-mpw) - basic_machine=powerpc-apple - ;; - c4x*) - basic_machine=c4x-none - os=-coff - ;; - *-unknown) - # Make sure to match an already-canonicalized machine name. - ;; - *) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; -esac - -# Here we canonicalize certain aliases for manufacturers. -case $basic_machine in - *-digital*) - basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` - ;; - *-commodore*) - basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` - ;; - *) - ;; -esac - -# Decode manufacturer-specific aliases for certain operating systems. - -if [ x"$os" != x"" ] -then -case $os in - # First match some system type aliases - # that might get confused with valid system types. - # -solaris* is a basic system type, with this one exception. - -solaris1 | -solaris1.*) - os=`echo $os | sed -e 's|solaris1|sunos4|'` - ;; - -solaris) - os=-solaris2 - ;; - -svr4*) - os=-sysv4 - ;; - -unixware*) - os=-sysv4.2uw - ;; - -gnu/linux*) - os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` - ;; - # First accept the basic system types. - # The portable systems comes first. - # Each alternative MUST END IN A *, to match a version number. - # -sysv* is not here because it comes later, after sysvr4. - -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* \ - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ - | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ - | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ - | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ - | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* \ - | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux* | -uxpv* | -beos* | -mpeix* | -udk* \ - | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ - | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ - | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ - | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ - | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* | -powermax*) - # Remember, each alternative MUST END IN *, to match a version number. - ;; - -qnx*) - case $basic_machine in - x86-* | i*86-*) - ;; - *) - os=-nto$os - ;; - esac - ;; - -nto*) - os=-nto-qnx - ;; - -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ - | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) - ;; - -mac*) - os=`echo $os | sed -e 's|mac|macos|'` - ;; - -sunos5*) - os=`echo $os | sed -e 's|sunos5|solaris2|'` - ;; - -sunos6*) - os=`echo $os | sed -e 's|sunos6|solaris3|'` - ;; - -opened*) - os=-openedition - ;; - -wince*) - os=-wince - ;; - -osfrose*) - os=-osfrose - ;; - -osf*) - os=-osf - ;; - -utek*) - os=-bsd - ;; - -dynix*) - os=-bsd - ;; - -acis*) - os=-aos - ;; - -atheos*) - os=-atheos - ;; - -386bsd) - os=-bsd - ;; - -ctix* | -uts*) - os=-sysv - ;; - -nova*) - os=-rtmk-nova - ;; - -ns2 ) - os=-nextstep2 - ;; - -nsk*) - os=-nsk - ;; - # Preserve the version number of sinix5. - -sinix5.*) - os=`echo $os | sed -e 's|sinix|sysv|'` - ;; - -sinix*) - os=-sysv4 - ;; - -triton*) - os=-sysv3 - ;; - -oss*) - os=-sysv3 - ;; - -svr4) - os=-sysv4 - ;; - -svr3) - os=-sysv3 - ;; - -sysvr4) - os=-sysv4 - ;; - # This must come after -sysvr4. - -sysv*) - ;; - -ose*) - os=-ose - ;; - -es1800*) - os=-ose - ;; - -xenix) - os=-xenix - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - os=-mint - ;; - -none) - ;; - *) - # Get rid of the `-' at the beginning of $os. - os=`echo $os | sed 's/[^-]*-//'` - echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 - exit 1 - ;; -esac -else - -# Here we handle the default operating systems that come with various machines. -# The value should be what the vendor currently ships out the door with their -# machine or put another way, the most popular os provided with the machine. - -# Note that if you're going to try to match "-MANUFACTURER" here (say, -# "-sun"), then you have to tell the case statement up towards the top -# that MANUFACTURER isn't an operating system. Otherwise, code above -# will signal an error saying that MANUFACTURER isn't an operating -# system, and we'll never get to this point. - -case $basic_machine in - *-acorn) - os=-riscix1.2 - ;; - arm*-rebel) - os=-linux - ;; - arm*-semi) - os=-aout - ;; - # This must come before the *-dec entry. - pdp10-*) - os=-tops20 - ;; - pdp11-*) - os=-none - ;; - *-dec | vax-*) - os=-ultrix4.2 - ;; - m68*-apollo) - os=-domain - ;; - i386-sun) - os=-sunos4.0.2 - ;; - m68000-sun) - os=-sunos3 - # This also exists in the configure program, but was not the - # default. - # os=-sunos4 - ;; - m68*-cisco) - os=-aout - ;; - mips*-cisco) - os=-elf - ;; - mips*-*) - os=-elf - ;; - or32-*) - os=-coff - ;; - *-tti) # must be before sparc entry or we get the wrong os. - os=-sysv3 - ;; - sparc-* | *-sun) - os=-sunos4.1.1 - ;; - *-be) - os=-beos - ;; - *-ibm) - os=-aix - ;; - *-wec) - os=-proelf - ;; - *-winbond) - os=-proelf - ;; - *-oki) - os=-proelf - ;; - *-hp) - os=-hpux - ;; - *-hitachi) - os=-hiux - ;; - i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=-sysv - ;; - *-cbm) - os=-amigaos - ;; - *-dg) - os=-dgux - ;; - *-dolphin) - os=-sysv3 - ;; - m68k-ccur) - os=-rtu - ;; - m88k-omron*) - os=-luna - ;; - *-next ) - os=-nextstep - ;; - *-sequent) - os=-ptx - ;; - *-crds) - os=-unos - ;; - *-ns) - os=-genix - ;; - i370-*) - os=-mvs - ;; - *-next) - os=-nextstep3 - ;; - *-gould) - os=-sysv - ;; - *-highlevel) - os=-bsd - ;; - *-encore) - os=-bsd - ;; - *-sgi) - os=-irix - ;; - *-siemens) - os=-sysv4 - ;; - *-masscomp) - os=-rtu - ;; - f30[01]-fujitsu | f700-fujitsu) - os=-uxpv - ;; - *-rom68k) - os=-coff - ;; - *-*bug) - os=-coff - ;; - *-apple) - os=-macos - ;; - *-atari*) - os=-mint - ;; - *) - os=-none - ;; -esac -fi - -# Here we handle the case where we know the os, and the CPU type, but not the -# manufacturer. We pick the logical manufacturer. -vendor=unknown -case $basic_machine in - *-unknown) - case $os in - -riscix*) - vendor=acorn - ;; - -sunos*) - vendor=sun - ;; - -aix*) - vendor=ibm - ;; - -beos*) - vendor=be - ;; - -hpux*) - vendor=hp - ;; - -mpeix*) - vendor=hp - ;; - -hiux*) - vendor=hitachi - ;; - -unos*) - vendor=crds - ;; - -dgux*) - vendor=dg - ;; - -luna*) - vendor=omron - ;; - -genix*) - vendor=ns - ;; - -mvs* | -opened*) - vendor=ibm - ;; - -ptx*) - vendor=sequent - ;; - -vxsim* | -vxworks* | -windiss*) - vendor=wrs - ;; - -aux*) - vendor=apple - ;; - -hms*) - vendor=hitachi - ;; - -mpw* | -macos*) - vendor=apple - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - vendor=atari - ;; - -vos*) - vendor=stratus - ;; - esac - basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` - ;; -esac - -echo $basic_machine$os -exit 0 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/vvp/delay.cc b/vvp/delay.cc index a1798b4f1..85e33e9a6 100644 --- a/vvp/delay.cc +++ b/vvp/delay.cc @@ -140,6 +140,7 @@ vvp_fun_delay::vvp_fun_delay(vvp_net_t*n, vvp_bit4_t init, const vvp_delay_t&d) cur_vec8_ = vvp_vector8_t(cur_vec4_, 6, 6); cur_real_ = 0.0; list_ = 0; + type_ = UNKNOWN_DELAY; initial_ = true; // Calculate the values used when converting variable delays // to simulation time units. @@ -160,10 +161,48 @@ vvp_fun_delay::~vvp_fun_delay() delete cur; } +bool vvp_fun_delay::clean_pulse_events_(vvp_time64_t use_delay, + const vvp_vector4_t&bit) +{ + if (list_ == 0) return false; + + /* If the most recent event and the new event have the same + * value then we need to skip the new event. */ + if (list_->next->ptr_vec4.eeq(bit)) return true; + + clean_pulse_events_(use_delay); + return false; +} + +bool vvp_fun_delay::clean_pulse_events_(vvp_time64_t use_delay, + const vvp_vector8_t&bit) +{ + if (list_ == 0) return false; + + /* If the most recent event and the new event have the same + * value then we need to skip the new event. */ + if (list_->next->ptr_vec8.eeq(bit)) return true; + + clean_pulse_events_(use_delay); + return false; +} + +bool vvp_fun_delay::clean_pulse_events_(vvp_time64_t use_delay, + double bit) +{ + if (list_ == 0) return false; + + /* If the most recent event and the new event have the same + * value then we need to skip the new event. */ + if (list_->next->ptr_real == bit) return true; + + clean_pulse_events_(use_delay); + return false; +} + void vvp_fun_delay::clean_pulse_events_(vvp_time64_t use_delay) { - if (list_ == 0) - return; + assert(list_ != 0); do { struct event_*cur = list_->next; @@ -219,6 +258,7 @@ void vvp_fun_delay::recv_vec4(vvp_net_ptr_t port, const vvp_vector4_t&bit, /* This is an initial value so it needs to be compared to all the bits (the order the bits are changed is not deterministic). */ if (initial_) { + type_ = VEC4_DELAY; vvp_bit4_t cur_val = cur_vec4_.value(0); use_delay = delay_.get_delay(cur_val, bit.value(0)); for (unsigned idx = 1 ; idx < bit.size() ; idx += 1) { @@ -227,6 +267,7 @@ void vvp_fun_delay::recv_vec4(vvp_net_ptr_t port, const vvp_vector4_t&bit, if (tmp > use_delay) use_delay = tmp; } } else { + assert(type_ == VEC4_DELAY); /* How many bits to compare? */ unsigned use_wid = cur_vec4_.size(); @@ -246,7 +287,7 @@ void vvp_fun_delay::recv_vec4(vvp_net_ptr_t port, const vvp_vector4_t&bit, /* what *should* happen here is we check to see if there is a transaction in the queue. This would be a pulse that needs to be eliminated. */ - clean_pulse_events_(use_delay); + if (clean_pulse_events_(use_delay, bit)) return; vvp_time64_t use_simtime = schedule_simtime() + use_delay; @@ -273,6 +314,7 @@ void vvp_fun_delay::recv_vec8(vvp_net_ptr_t port, const vvp_vector8_t&bit) /* This is an initial value so it needs to be compared to all the bits (the order the bits are changed is not deterministic). */ if (initial_) { + type_ = VEC8_DELAY; vvp_bit4_t cur_val = cur_vec8_.value(0).value(); use_delay = delay_.get_delay(cur_val, bit.value(0).value()); for (unsigned idx = 1 ; idx < bit.size() ; idx += 1) { @@ -281,6 +323,7 @@ void vvp_fun_delay::recv_vec8(vvp_net_ptr_t port, const vvp_vector8_t&bit) if (tmp > use_delay) use_delay = tmp; } } else { + assert(type_ == VEC8_DELAY); /* How many bits to compare? */ unsigned use_wid = cur_vec8_.size(); @@ -302,7 +345,7 @@ void vvp_fun_delay::recv_vec8(vvp_net_ptr_t port, const vvp_vector8_t&bit) /* what *should* happen here is we check to see if there is a transaction in the queue. This would be a pulse that needs to be eliminated. */ - clean_pulse_events_(use_delay); + if (clean_pulse_events_(use_delay, bit)) return; vvp_time64_t use_simtime = schedule_simtime() + use_delay; @@ -351,11 +394,14 @@ void vvp_fun_delay::recv_real(vvp_net_ptr_t port, double bit, return; } + if (initial_) type_ = REAL_DELAY; + else assert(type_ == REAL_DELAY); + vvp_time64_t use_delay; use_delay = delay_.get_min_delay(); /* Eliminate glitches. */ - clean_pulse_events_(use_delay); + if (clean_pulse_events_(use_delay, bit)) return; /* This must be done after cleaning pulses to avoid propagating * an incorrect value. */ diff --git a/vvp/delay.h b/vvp/delay.h index f7da4a907..12c64e4dd 100644 --- a/vvp/delay.h +++ b/vvp/delay.h @@ -71,6 +71,7 @@ class vvp_delay_t { */ class vvp_fun_delay : public vvp_net_fun_t, private vvp_gen_event_s { + enum delay_type_t {UNKNOWN_DELAY, VEC4_DELAY, VEC8_DELAY, REAL_DELAY}; struct event_ { event_(vvp_time64_t s) : sim_time(s) { } void (vvp_fun_delay::*run_run_ptr)(struct vvp_fun_delay::event_*cur); @@ -103,6 +104,7 @@ class vvp_fun_delay : public vvp_net_fun_t, private vvp_gen_event_s { private: vvp_net_t*net_; vvp_delay_t delay_; + delay_type_t type_; bool initial_; // Indicates if the value is still the initial value. vvp_vector4_t cur_vec4_; @@ -133,6 +135,10 @@ class vvp_fun_delay : public vvp_net_fun_t, private vvp_gen_event_s { list_->next = cur->next; return cur; } + bool clean_pulse_events_(vvp_time64_t use_delay, const vvp_vector4_t&bit); + bool clean_pulse_events_(vvp_time64_t use_delay, const vvp_vector8_t&bit); + bool clean_pulse_events_(vvp_time64_t use_delay, double bit); +// Delete this when done! void clean_pulse_events_(vvp_time64_t use_delay); }; diff --git a/vvp/event.cc b/vvp/event.cc index 4f4098b62..de4caff5e 100644 --- a/vvp/event.cc +++ b/vvp/event.cc @@ -159,6 +159,32 @@ void schedule_evctl(vvp_array_t memory, unsigned index, ep->last = &((*(ep->last))->next); } +evctl_array_r::evctl_array_r(vvp_array_t memory, unsigned index, + double value, unsigned long ecount) +:evctl(ecount) +{ + mem_ = memory; + idx_ = index; + value_ = value; +} + +void evctl_array_r::run_run() +{ + array_set_word(mem_, idx_, value_); +} + +void schedule_evctl(vvp_array_t memory, unsigned index, + double value, + vvp_net_t*event, unsigned long ecount) +{ + // Get the functor we are going to wait on. + waitable_hooks_s*ep = dynamic_cast (event->fun); + assert(ep); + // Now add this call to the end of the event list. + *(ep->last) = new evctl_array_r(memory, index, value, ecount); + ep->last = &((*(ep->last))->next); +} + inline vvp_fun_edge::edge_t VVP_EDGE(vvp_bit4_t from, vvp_bit4_t to) { return 1 << ((from << 2) | to); diff --git a/vvp/event.h b/vvp/event.h index fd7ac81ae..55582d79b 100644 --- a/vvp/event.h +++ b/vvp/event.h @@ -81,6 +81,20 @@ class evctl_array : public evctl { unsigned off_; }; +class evctl_array_r : public evctl { + + public: + explicit evctl_array_r(vvp_array_t memory, unsigned index, + double value, unsigned long ecount); + virtual ~evctl_array_r() {} + virtual void run_run(); + + private: + vvp_array_t mem_; + unsigned idx_; + double value_; +}; + extern void schedule_evctl(struct __vpiHandle*handle, double value, vvp_net_t*event, unsigned long ecount); @@ -92,6 +106,10 @@ extern void schedule_evctl(vvp_array_t memory, unsigned index, const vvp_vector4_t&value, unsigned offset, vvp_net_t*event, unsigned long ecount); +extern void schedule_evctl(vvp_array_t memory, unsigned index, + double value, + vvp_net_t*event, unsigned long ecount); + /* * Event / edge detection functors */ diff --git a/vvp/install-sh b/vvp/install-sh deleted file mode 100755 index ba5e22ad4..000000000 --- a/vvp/install-sh +++ /dev/null @@ -1,238 +0,0 @@ -#! /bin/sh -# -# install - install a program, script, or datafile -# This comes from X11R5. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. -# - - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -transformbasename="" -transform_arg="" -instcmd="$mvprog" -chmodcmd="$chmodprog 0755" -chowncmd="" -chgrpcmd="" -stripcmd="" -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src="" -dst="" -dir_arg="" - -while [ x"$1" != x ]; do - case $1 in - -c) instcmd="$cpprog" - shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - -s) stripcmd="$stripprog" - shift - continue;; - - -t=*) transformarg=`echo $1 | sed 's/-t=//'` - shift - continue;; - - -b=*) transformbasename=`echo $1 | sed 's/-b=//'` - shift - continue;; - - *) if [ x"$src" = x ] - then - src=$1 - else - # this colon is to work around a 386BSD /bin/sh bug - : - dst=$1 - fi - shift - continue;; - esac -done - -if [ x"$src" = x ] -then - echo "install: no input file specified" - exit 1 -else - true -fi - -if [ x"$dir_arg" != x ]; then - dst=$src - src="" - - if [ -d $dst ]; then - instcmd=: - else - instcmd=mkdir - fi -else - -# Waiting for this to be detected by the "$instcmd $src $dsttmp" command -# might cause directories to be created, which would be especially bad -# if $src (and thus $dsttmp) contains '*'. - - if [ -f $src -o -d $src ] - then - true - else - echo "install: $src does not exist" - exit 1 - fi - - if [ x"$dst" = x ] - then - echo "install: no destination specified" - exit 1 - else - true - fi - -# If destination is a directory, append the input filename; if your system -# does not like double slashes in filenames, you may need to add some logic - - if [ -d $dst ] - then - dst="$dst"/`basename $src` - else - true - fi -fi - -## this sed command emulates the dirname command -dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` - -# Make sure that the destination directory exists. -# this part is taken from Noah Friedman's mkinstalldirs script - -# Skip lots of stat calls in the usual case. -if [ ! -d "$dstdir" ]; then -defaultIFS=' -' -IFS="${IFS-${defaultIFS}}" - -oIFS="${IFS}" -# Some sh's can't handle IFS=/ for some reason. -IFS='%' -set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` -IFS="${oIFS}" - -pathcomp='' - -while [ $# -ne 0 ] ; do - pathcomp="${pathcomp}${1}" - shift - - if [ ! -d "${pathcomp}" ] ; - then - $mkdirprog "${pathcomp}" - else - true - fi - - pathcomp="${pathcomp}/" -done -fi - -if [ x"$dir_arg" != x ] -then - $doit $instcmd $dst && - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi -else - -# If we're going to rename the final executable, determine the name now. - - if [ x"$transformarg" = x ] - then - dstfile=`basename $dst` - else - dstfile=`basename $dst $transformbasename | - sed $transformarg`$transformbasename - fi - -# don't allow the sed command to completely eliminate the filename - - if [ x"$dstfile" = x ] - then - dstfile=`basename $dst` - else - true - fi - -# Make a temp file name in the proper directory. - - dsttmp=$dstdir/#inst.$$# - -# Move or copy the file name to the temp name - - $doit $instcmd $src $dsttmp && - - trap "rm -f ${dsttmp}" 0 && - -# and set any options; do chmod last to preserve setuid bits - -# If any of these fail, we abort the whole thing. If we want to -# ignore errors from any of these, just make sure not to ignore -# errors from the above "$doit $instcmd $src $dsttmp" command. - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && - -# Now rename the file to the real destination. - - $doit $rmcmd -f $dstdir/$dstfile && - $doit $mvcmd $dsttmp $dstdir/$dstfile - -fi && - - -exit 0 diff --git a/vvp/main.cc b/vvp/main.cc index 76d66a168..d0cca4e40 100644 --- a/vvp/main.cc +++ b/vvp/main.cc @@ -422,6 +422,8 @@ int main(int argc, char*argv[]) count_assign_real_pool()); vpi_mcd_printf(1, " ...assign(word) pool=%lu\n", count_assign_aword_pool()); + vpi_mcd_printf(1, " ...assign(word/r) pool=%lu\n", + count_assign_arword_pool()); vpi_mcd_printf(1, " %8lu other events (pool=%lu)\n", count_gen_events, count_gen_pool()); } diff --git a/vvp/opcodes.txt b/vvp/opcodes.txt index 2c18aabbd..54e49c152 100644 --- a/vvp/opcodes.txt +++ b/vvp/opcodes.txt @@ -65,6 +65,26 @@ means the following: 1 and 1 --> 1 otherwise x +* %assign/ar , , +* %assign/ar/d , , +* %assign/ar/e , + +The %assign/ar instruction assigns a real value to a word in the +labeled real array. The is the delay in simulation time to +the assignment (0 for non-blocking assignment) and is the +index register that contains the value to write. + +The memory word address is read from index register 3. The address is +in canonical form. + +The %assign/ar/d variation reads the delay from an integer register that +is given by the value. This should not be 3 or the index, +of course, since these registers contain the word address and the value. + +The %assign/ar/e variation uses the information in the thread +event control registers to determine when to perform the assign. +%evctl is used to set the event control information. + * %assign/av , , * %assign/av/d , , * %assign/av/e , @@ -417,7 +437,7 @@ These instructions are like the %ix/get instructions, except that they read directly from a functor label instead of from thread bits. They set bit 4 just like %ix/get. -* %ix/load , +* %ix/load , , This instruction loads an immediate value into the addressed index register. The index register holds signed 64 bit numeric values, so @@ -428,9 +448,9 @@ vector. The values are unsigned decimal values and are combined as << 32 | to produce the final value. -* %ix/add , -* %ix/sub , -* %ix/mul , +* %ix/add , , +* %ix/sub , , +* %ix/mul , , These instructions add, subtract, or multiply the selected index register by the immediate value. The 64 bit immediate value is built @@ -491,7 +511,8 @@ vector is sign extended (instead of 0-extended) before the addition. This instruction is similar to %load/av, but it loads only a single bit, and the is the selector for the bit to use. If is -out of range, then x is loaded. +out of range, then x is loaded. The index value is incremented by one +if it is defined (bit 4 is not 1). * %load/v , , @@ -758,6 +779,8 @@ bits) by the amount in index register 0. The is the address of the LSB of the vector, and the width of the vector. The shift is done in place. Zero values are shifted in. +For a negative shift the value is padded with 'bx. + * %shiftr/i0 , * %shiftr/s/i0 , @@ -769,6 +792,8 @@ shift is done in place. %shiftr/i0 is an unsigned down shift, so zeros are shifted into the top bits. %shiftr/s/i0 is a signed shift, so the value is sign-extended. +For a negative shift %shiftr/i0 will pad the value with 'bx. + * %sub , , This instruction arithmetically subtracts the right vector out of the @@ -846,7 +871,7 @@ and leaves the result in the vector. xor is this: /* - * Copyright (c) 2001-2008 Stephen Williams (steve@icarus.com) + * Copyright (c) 2001-2009 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU diff --git a/vvp/part.cc b/vvp/part.cc index bd0dedcf1..9070779c7 100644 --- a/vvp/part.cc +++ b/vvp/part.cc @@ -86,11 +86,8 @@ void vvp_fun_part_sa::recv_vec4_pv(vvp_net_ptr_t port, const vvp_vector4_t&bit, { assert(bit.size() == wid); - vvp_vector4_t tmp = val_; - if (tmp.size() == 0) - tmp = vvp_vector4_t(vwid); - - assert(tmp.size() == vwid); + vvp_vector4_t tmp (vwid, BIT4_Z); + tmp.set_vec(base_, val_); tmp.set_vec(base, bit); recv_vec4(port, tmp, 0); } @@ -178,11 +175,8 @@ void vvp_fun_part_aa::recv_vec4_pv(vvp_net_ptr_t port, const vvp_vector4_t&bit, vvp_vector4_t*val = static_cast (vvp_get_context_item(context, context_idx_)); - vvp_vector4_t tmp = *val; - if (tmp.size() == 0) - tmp = vvp_vector4_t(vwid); - - assert(tmp.size() == vwid); + vvp_vector4_t tmp (vwid, BIT4_Z); + tmp.set_vec(base_, *val); tmp.set_vec(base, bit); recv_vec4(port, tmp, context); } else { @@ -244,17 +238,20 @@ vvp_fun_part_var::~vvp_fun_part_var() } bool vvp_fun_part_var::recv_vec4_(vvp_net_ptr_t port, const vvp_vector4_t&bit, - unsigned&base, vvp_vector4_t&source, + long&base, vvp_vector4_t&source, vvp_vector4_t&ref) { - unsigned long tmp; + long tmp; switch (port.port()) { case 0: source = bit; break; case 1: - tmp = ULONG_MAX; - vector4_to_value(bit, tmp); + // LONG_MIN is before the vector and is used to + // represent a 'bx value on the select input. + tmp = LONG_MIN; + // We need a new &PV<> that knows if the index is signed. + vector4_to_value(bit, tmp, false); if (tmp == base) return false; base = tmp; break; @@ -267,11 +264,11 @@ bool vvp_fun_part_var::recv_vec4_(vvp_net_ptr_t port, const vvp_vector4_t&bit, vvp_vector4_t res (wid_); for (unsigned idx = 0 ; idx < wid_ ; idx += 1) { - unsigned adr = base+idx; - if (adr >= source.size()) - break; + long adr = base+idx; + if (adr < 0) continue; + if ((unsigned)adr >= source.size()) break; - res.set_bit(idx, source.value(adr)); + res.set_bit(idx, source.value((unsigned)adr)); } if (! ref.eeq(res)) { @@ -316,7 +313,7 @@ void vvp_fun_part_var_sa::recv_vec4_pv(vvp_net_ptr_t port, const vvp_vector4_t&b struct vvp_fun_part_var_state_s { vvp_fun_part_var_state_s() : base(0) { } - unsigned base; + long base; vvp_vector4_t source; vvp_vector4_t ref; }; diff --git a/vvp/part.h b/vvp/part.h index 687b76063..f42dc6cd3 100644 --- a/vvp/part.h +++ b/vvp/part.h @@ -130,7 +130,7 @@ class vvp_fun_part_var : public vvp_net_fun_t { protected: bool recv_vec4_(vvp_net_ptr_t port, const vvp_vector4_t&bit, - unsigned&base, vvp_vector4_t&source, + long&base, vvp_vector4_t&source, vvp_vector4_t&ref); unsigned wid_; @@ -154,7 +154,7 @@ class vvp_fun_part_var_sa : public vvp_fun_part_var { vvp_context_t); private: - unsigned base_; + long base_; vvp_vector4_t source_; // Save the last output, for detecting change. vvp_vector4_t ref_; diff --git a/vvp/schedule.cc b/vvp/schedule.cc index a0b2890c8..a3c951da6 100644 --- a/vvp/schedule.cc +++ b/vvp/schedule.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001-2008 Stephen Williams (steve@icarus.com) + * Copyright (c) 2001-2009 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -278,6 +278,37 @@ void propagate_vector4_event_s::run_run(void) net->send_vec4(val, 0); } +struct assign_array_r_word_s : public event_s { + vvp_array_t mem; + unsigned adr; + double val; + void run_run(void); + + static void* operator new(size_t); + static void operator delete(void*); +}; + +void assign_array_r_word_s::run_run(void) +{ + count_assign_events += 1; + array_set_word(mem, adr, val); +} +static const size_t ARRAY_R_W_CHUNK_COUNT = 8192 / sizeof(struct assign_array_r_word_s); +static slab_t array_r_w_heap; + +inline void* assign_array_r_word_s::operator new(size_t size) +{ + assert(size == sizeof(assign_array_r_word_s)); + return array_r_w_heap.alloc_slab(); +} + +void assign_array_r_word_s::operator delete(void*ptr) +{ + array_r_w_heap.free_slab(ptr); +} + +unsigned long count_assign_arword_pool(void) { return array_r_w_heap.pool; } + struct generic_event_s : public event_s { vvp_gen_event_t obj; bool delete_obj_when_done; @@ -641,6 +672,18 @@ void schedule_assign_array_word(vvp_array_t mem, schedule_event_(cur, delay, SEQ_NBASSIGN); } +void schedule_assign_array_word(vvp_array_t mem, + unsigned word_addr, + double val, + vvp_time64_t delay) +{ + struct assign_array_r_word_s*cur = new struct assign_array_r_word_s; + cur->mem = mem; + cur->adr = word_addr; + cur->val = val; + schedule_event_(cur, delay, SEQ_NBASSIGN); +} + void schedule_set_vector(vvp_net_ptr_t ptr, const vvp_vector4_t&bit) { struct assign_vector4_event_s*cur = new struct assign_vector4_event_s(bit); diff --git a/vvp/schedule.h b/vvp/schedule.h index f1c688572..27f92ba2e 100644 --- a/vvp/schedule.h +++ b/vvp/schedule.h @@ -1,7 +1,7 @@ #ifndef __schedule_H #define __schedule_H /* - * Copyright (c) 2001-2008 Stephen Williams (steve@icarus.com) + * Copyright (c) 2001-2009 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -58,13 +58,17 @@ extern void schedule_assign_array_word(vvp_array_t mem, vvp_vector4_t val, vvp_time64_t delay); +extern void schedule_assign_array_word(vvp_array_t mem, + unsigned word_address, + double val, + vvp_time64_t delay); /* * Create an event to propagate the output of a net. */ extern void schedule_propagate_plucked_vector(vvp_net_t*ptr, - vvp_time64_t delay, + vvp_time64_t delay, const vvp_vector4_t&val, - unsigned adr, unsigned wid); + unsigned adr, unsigned wid); /* * This is very similar to schedule_assign_vector, but generates an diff --git a/vvp/statistics.h b/vvp/statistics.h index cc5876120..aa7bf0386 100644 --- a/vvp/statistics.h +++ b/vvp/statistics.h @@ -1,7 +1,7 @@ #ifndef __statistics_H #define __statistics_H /* - * Copyright (c) 2002-2007 Stephen Williams (steve@icarus.com) + * Copyright (c) 2002-2009 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -47,6 +47,7 @@ extern unsigned long count_assign4_pool(void); extern unsigned long count_assign8_pool(void); extern unsigned long count_assign_real_pool(void); extern unsigned long count_assign_aword_pool(void); +extern unsigned long count_assign_arword_pool(void); extern unsigned long count_gen_events; extern unsigned long count_gen_pool(void); diff --git a/vvp/vpi_signal.cc b/vvp/vpi_signal.cc index 70321acba..2c1683014 100644 --- a/vvp/vpi_signal.cc +++ b/vvp/vpi_signal.cc @@ -38,6 +38,7 @@ # include #endif # include +# include # include # include #ifdef CHECK_WITH_VALGRIND @@ -1000,12 +1001,24 @@ static int PV_get_base(struct __vpiPV*rfp) /* If the width is zero then tbase is the constant. */ if (rfp->twid == 0) return rfp->tbase; + /* Get the value from thread space. */ int tval = 0; for (unsigned idx = 0 ; idx < rfp->twid ; idx += 1) { vvp_bit4_t bit = vthread_get_bit(vpip_current_vthread, rfp->tbase + idx); - if (bit == BIT4_1) { + switch (bit) { + case BIT4_X: + case BIT4_Z: + /* We use INT_MIN to indicate an X base. */ + return INT_MIN; + break; + + case BIT4_1: tval |= 1<, , + * Generate an assignment event to a real array. Index register 3 + * contains the canonical address of the word in the memory. + * is the delay in simulation time. is the index register + * containing the real value. + */ +bool of_ASSIGN_AR(vthread_t thr, vvp_code_t cp) +{ + long adr = thr->words[3].w_int; + unsigned delay = cp->bit_idx[0]; + double value = thr->words[cp->bit_idx[1]].w_real; + + if (adr >= 0) { + schedule_assign_array_word(cp->array, adr, value, delay); + } + + return true; +} + +/* %assign/ar/d , , + * Generate an assignment event to a real array. Index register 3 + * contains the canonical address of the word in the memory. + * is the integer register that contains the delay value. + * is the index register containing the real value. + */ +bool of_ASSIGN_ARD(vthread_t thr, vvp_code_t cp) +{ + long adr = thr->words[3].w_int; + vvp_time64_t delay = thr->words[cp->bit_idx[0]].w_int; + double value = thr->words[cp->bit_idx[1]].w_real; + + if (adr >= 0) { + schedule_assign_array_word(cp->array, adr, value, delay); + } + + return true; +} + +/* %assign/ar/e , + * Generate an assignment event to a real array. Index register 3 + * contains the canonical address of the word in the memory. + * is the index register containing the real value. The event + * information is contained in the thread event control registers + * and is set with %evctl. + */ +bool of_ASSIGN_ARE(vthread_t thr, vvp_code_t cp) +{ + long adr = thr->words[3].w_int; + double value = thr->words[cp->bit_idx[0]].w_real; + + if (adr >= 0) { + if (thr->ecount == 0) { + schedule_assign_array_word(cp->array, adr, value, 0); + } else { + schedule_evctl(cp->array, adr, value, thr->event, + thr->ecount); + } + } + + return true; +} + /* %assign/av , , * This generates an assignment event to an array. Index register 0 * contains the width of the vector (and the word) and index register @@ -803,10 +865,12 @@ bool of_ASSIGN_AV(vthread_t thr, vvp_code_t cp) { unsigned wid = thr->words[0].w_int; long off = thr->words[1].w_int; - unsigned adr = thr->words[3].w_int; + long adr = thr->words[3].w_int; unsigned delay = cp->bit_idx[0]; unsigned bit = cp->bit_idx[1]; + if (adr < 0) return true; + long vwidth = get_array_word_size(cp->array); // We fell off the MSB end. if (off >= vwidth) return true; @@ -840,10 +904,12 @@ bool of_ASSIGN_AVD(vthread_t thr, vvp_code_t cp) { unsigned wid = thr->words[0].w_int; long off = thr->words[1].w_int; - unsigned adr = thr->words[3].w_int; + long adr = thr->words[3].w_int; vvp_time64_t delay = thr->words[cp->bit_idx[0]].w_int; unsigned bit = cp->bit_idx[1]; + if (adr < 0) return true; + long vwidth = get_array_word_size(cp->array); // We fell off the MSB end. if (off >= vwidth) return true; @@ -871,9 +937,11 @@ bool of_ASSIGN_AVE(vthread_t thr, vvp_code_t cp) { unsigned wid = thr->words[0].w_int; long off = thr->words[1].w_int; - unsigned adr = thr->words[3].w_int; + long adr = thr->words[3].w_int; unsigned bit = cp->bit_idx[0]; + if (adr < 0) return true; + long vwidth = get_array_word_size(cp->array); // We fell off the MSB end. if (off >= vwidth) return true; @@ -2574,7 +2642,7 @@ bool of_IX_GET_S(vthread_t thr, vvp_code_t cp) unsigned base = cp->bit_idx[1]; unsigned width = cp->number; - unsigned long v = 0; + uint64_t v = 0; bool unknown_flag = false; vvp_bit4_t vv = BIT4_0; @@ -2586,7 +2654,7 @@ bool of_IX_GET_S(vthread_t thr, vvp_code_t cp) break; } - v |= (unsigned long) vv << i; + v |= (uint64_t) vv << i; if (base >= 4) base += 1; @@ -2594,7 +2662,7 @@ bool of_IX_GET_S(vthread_t thr, vvp_code_t cp) /* Sign-extend to fill the integer value. */ if (!unknown_flag) { - unsigned long pad = vv; + uint64_t pad = vv; for (unsigned i = width ; i < 8*sizeof(v) ; i += 1) { v |= pad << i; } @@ -2784,8 +2852,15 @@ bool of_LOAD_AR(vthread_t thr, vvp_code_t cp) unsigned bit = cp->bit_idx[0]; unsigned idx = cp->bit_idx[1]; unsigned adr = thr->words[idx].w_int; + double word; + + /* The result is 0.0 if the address is undefined. */ + if (thr_get_bit(thr, 4) == BIT4_1) { + word = 0.0; + } else { + word = array_get_word_r(cp->array, adr); + } - double word = array_get_word_r(cp->array, adr); thr->words[bit].w_real = word; return true; } @@ -2805,11 +2880,18 @@ bool of_LOAD_AV(vthread_t thr, vvp_code_t cp) unsigned wid = cp->bit_idx[1]; unsigned adr = thr->words[3].w_int; - vvp_vector4_t word = array_get_word(cp->array, adr); - /* Check the address once, before we scan the vector. */ thr_check_addr(thr, bit+wid-1); + /* The result is 'bx if the address is undefined. */ + if (thr_get_bit(thr, 4) == BIT4_1) { + vvp_vector4_t tmp (wid, BIT4_X); + thr->bits4.set_vec(bit, tmp); + return true; + } + + vvp_vector4_t word = array_get_word(cp->array, adr); + if (word.size() > wid) word.resize(wid); @@ -2880,6 +2962,15 @@ bool of_LOAD_AVP0(vthread_t thr, vvp_code_t cp) unsigned wid = cp->bit_idx[1]; unsigned adr = thr->words[3].w_int; + /* The result is 'bx if the address is undefined. */ + if (thr_get_bit(thr, 4) == BIT4_1) { + unsigned bit = cp->bit_idx[0]; + thr_check_addr(thr, bit+wid-1); + vvp_vector4_t tmp (wid, BIT4_X); + thr->bits4.set_vec(bit, tmp); + return true; + } + /* We need a vector this wide to make the math work correctly. * Copy the base bits into the vector, but keep the width. */ vvp_vector4_t sig_value(wid, BIT4_0); @@ -2894,6 +2985,15 @@ bool of_LOAD_AVP0_S(vthread_t thr, vvp_code_t cp) unsigned wid = cp->bit_idx[1]; unsigned adr = thr->words[3].w_int; + /* The result is 'bx if the address is undefined. */ + if (thr_get_bit(thr, 4) == BIT4_1) { + unsigned bit = cp->bit_idx[0]; + thr_check_addr(thr, bit+wid-1); + vvp_vector4_t tmp (wid, BIT4_X); + thr->bits4.set_vec(bit, tmp); + return true; + } + vvp_vector4_t tmp (array_get_word(cp->array, adr)); /* We need a vector this wide to make the math work correctly. @@ -2920,11 +3020,17 @@ bool of_LOAD_AVX_P(vthread_t thr, vvp_code_t cp) unsigned index = cp->bit_idx[1]; unsigned adr = thr->words[3].w_int; - unsigned use_index = thr->words[index].w_int; + /* The result is 'bx if the address is undefined. */ + if (thr_get_bit(thr, 4) == BIT4_1) { + thr_put_bit(thr, bit, BIT4_X); + return true; + } + + long use_index = thr->words[index].w_int; vvp_vector4_t word = array_get_word(cp->array, adr); - if (use_index >= word.size()) { + if ((use_index >= (long)word.size()) || (use_index < 0)) { thr_put_bit(thr, bit, BIT4_X); } else { thr_put_bit(thr, bit, word.value(use_index)); @@ -4096,7 +4202,7 @@ bool of_SHIFTL_I0(vthread_t thr, vvp_code_t cp) { unsigned base = cp->bit_idx[0]; unsigned wid = cp->number; - unsigned long shift = thr->words[0].w_int; + long shift = thr->words[0].w_int; assert(base >= 4); thr_check_addr(thr, base+wid-1); @@ -4105,7 +4211,8 @@ bool of_SHIFTL_I0(vthread_t thr, vvp_code_t cp) // The result is 'bx if the shift amount is undefined. vvp_vector4_t tmp (wid, BIT4_X); thr->bits4.set_vec(base, tmp); - } else if (shift >= wid) { + + } else if (shift >= (long)wid) { // Shift is so far that all value is shifted out. Write // in a constant 0 result. vvp_vector4_t tmp (wid, BIT4_0); @@ -4118,6 +4225,17 @@ bool of_SHIFTL_I0(vthread_t thr, vvp_code_t cp) // Fill zeros on the bottom vvp_vector4_t fil (shift, BIT4_0); thr->bits4.set_vec(base, fil); + + } else if (shift < 0) { + // For a negative shift we pad with 'bx. + unsigned idx; + for (idx = 0 ; (idx-shift) < wid ; idx += 1) { + unsigned src = base + idx - shift; + unsigned dst = base + idx; + thr_put_bit(thr, dst, thr_get_bit(thr, src)); + } + for ( ; idx < wid ; idx += 1) + thr_put_bit(thr, base+idx, BIT4_X); } return true; } @@ -4134,12 +4252,16 @@ bool of_SHIFTR_I0(vthread_t thr, vvp_code_t cp) { unsigned base = cp->bit_idx[0]; unsigned wid = cp->number; - unsigned long shift = thr->words[0].w_int; + long shift = thr->words[0].w_int; + + assert(base >= 4); + thr_check_addr(thr, base+wid-1); if (thr_get_bit(thr, 4) == BIT4_1) { - // The result is 'bx if the shift amount is undefined. + // The result is 'bx if the shift amount is undefined. vvp_vector4_t tmp (wid, BIT4_X); thr->bits4.set_vec(base, tmp); + } else if (shift > 0) { unsigned idx; for (idx = 0 ; (idx+shift) < wid ; idx += 1) { @@ -4149,6 +4271,21 @@ bool of_SHIFTR_I0(vthread_t thr, vvp_code_t cp) } for ( ; idx < wid ; idx += 1) thr_put_bit(thr, base+idx, BIT4_0); + + } else if (shift < -(long)wid) { + // Negative shift is so far that all the value is shifted out. + // Write in a constant 'bx result. + vvp_vector4_t tmp (wid, BIT4_X); + thr->bits4.set_vec(base, tmp); + + } else if (shift < 0) { + + // For a negative shift we pad with 'bx. + vvp_vector4_t tmp (thr->bits4, base, wid+shift); + thr->bits4.set_vec(base-shift, tmp); + + vvp_vector4_t fil (-shift, BIT4_X); + thr->bits4.set_vec(base, fil); } return true; } @@ -4161,7 +4298,7 @@ bool of_SHIFTR_S_I0(vthread_t thr, vvp_code_t cp) vvp_bit4_t sign = thr_get_bit(thr, base+wid-1); if (thr_get_bit(thr, 4) == BIT4_1) { - // The result is 'bx if the shift amount is undefined. + // The result is 'bx if the shift amount is undefined. vvp_vector4_t tmp (wid, BIT4_X); thr->bits4.set_vec(base, tmp); } else if (shift >= wid) { diff --git a/vvp/vvp.man b/vvp/vvp.man index d1c0e3c9c..c53c4fd0c 100644 --- a/vvp/vvp.man +++ b/vvp/vvp.man @@ -4,7 +4,7 @@ vvp - Icarus Verilog vvp runtime engine .SH SYNOPSIS .B vvp -[-nNsvV] [-Mpath] [-mmodule] [-llogfile] inputfile [extended-args...] +[\-nNsvV] [\-Mpath] [\-mmodule] [\-llogfile] inputfile [extended-args...] .SH DESCRIPTION .PP @@ -14,7 +14,6 @@ command is not by itself executable on any platform. Instead, the \fIvvp\fP program is invoked to execute the generated output file. .SH OPTIONS -.l \fIvvp\fP accepts the following options: .TP 8 .B -l\fIlogfile\fP @@ -121,7 +120,7 @@ to print information about the annotation. .TP 8 .B -sdf-verbose -This is shorthand for -sdf-info -sdf-warn. +This is shorthand for \-sdf\-info \-sdf\-warn. .SH ENVIRONMENT .PP