diff options
author | gingold <gingold@b72b5c32-5f01-0410-b925-b5c7b92870f7> | 2005-10-24 19:53:59 +0000 |
---|---|---|
committer | gingold <gingold@b72b5c32-5f01-0410-b925-b5c7b92870f7> | 2005-10-24 19:53:59 +0000 |
commit | 729ff8c7d5c4c93bc67bd496ef398adfc980df22 (patch) | |
tree | 019cae33a7c06632c5ad599a6b6d8e63a7281522 /translate | |
parent | 37b4ff57b54a81d56dddf36945afe26841527b8f (diff) | |
download | ghdl-729ff8c7d5c4c93bc67bd496ef398adfc980df22.tar.gz ghdl-729ff8c7d5c4c93bc67bd496ef398adfc980df22.tar.bz2 ghdl-729ff8c7d5c4c93bc67bd496ef398adfc980df22.zip |
support of ia64 added, more stats added
Diffstat (limited to 'translate')
-rwxr-xr-x | translate/gcc/dist.sh | 23 | ||||
-rw-r--r-- | translate/ghdldrv/Makefile | 3 | ||||
-rw-r--r-- | translate/grt/Makefile | 5 | ||||
-rw-r--r-- | translate/grt/Makefile.inc | 33 | ||||
-rw-r--r-- | translate/grt/config/ia64.S | 193 | ||||
-rw-r--r-- | translate/grt/config/linux.c | 8 | ||||
-rw-r--r-- | translate/grt/grt-processes.adb | 17 | ||||
-rw-r--r-- | translate/grt/grt-processes.ads | 3 | ||||
-rw-r--r-- | translate/grt/grt-signals.adb | 5 | ||||
-rw-r--r-- | translate/grt/grt-stats.adb | 30 | ||||
-rw-r--r-- | translate/grt/grt-stats.ads | 5 | ||||
-rw-r--r-- | translate/grt/grt-types.ads | 2 | ||||
-rw-r--r-- | translate/translation.adb | 5 |
13 files changed, 304 insertions, 28 deletions
diff --git a/translate/gcc/dist.sh b/translate/gcc/dist.sh index 5c27694dd..59effd48e 100755 --- a/translate/gcc/dist.sh +++ b/translate/gcc/dist.sh @@ -38,6 +38,16 @@ set -e +# GCC version +GCCVERSION=4.0.2 +# Machine name used by GCC +MACHINE=i686-pc-linux-gnu +# Directory where GCC sources (and objects) stay. +DISTDIR=$HOME/dist +# GTKWave version. +GTKWAVE_VERSION=1.3.72 + +# GHDL version (extracted from version.ads) VERSION=`sed -n -e 's/.*GHDL \([0-9.a-z]*\) (.*/\1/p' ../../version.ads` CWD=`pwd` @@ -45,17 +55,13 @@ CWD=`pwd` distdir=ghdl-$VERSION tarfile=$distdir.tar -GCCVERSION=4.0.2 -DISTDIR=$HOME/dist -GTKWAVE_VERSION=1.3.72 - GTKWAVE_BASE=$HOME/devel/gtkwave-$GTKWAVE_VERSION GCCDIST=$DISTDIR/gcc-$GCCVERSION GCCDISTOBJ=$GCCDIST-objs PREFIX=/usr/local -GCCLIBDIR=$PREFIX/lib/gcc/i686-pc-linux-gnu/$GCCVERSION -GCCLIBEXECDIR=$PREFIX/libexec/gcc/i686-pc-linux-gnu/$GCCVERSION +GCCLIBDIR=$PREFIX/lib/gcc/$MACHINE/$GCCVERSION +GCCLIBEXECDIR=$PREFIX/libexec/gcc/$MACHINE/$GCCVERSION bindirname=ghdl-$VERSION-i686-pc-linux TARINSTALL=$DISTDIR/$bindirname.tar.bz2 VHDLDIR=$distdir/vhdl @@ -359,6 +365,7 @@ grt_config_files=" i386.S sparc.S ppc.S +ia64.S times.c clock.c linux.c @@ -426,8 +433,6 @@ check_root () # Do a make install do_compile2 () { -# check_root; - PATH=/usr/gnat/bin:$PATH set -x cd $GCCDISTOBJ # Check the info file is not empty. @@ -483,7 +488,7 @@ do_distclean_gcc () set -x rm -f ${DESTDIR}${PREFIX}/bin/cpp ${DESTDIR}${PREFIX}/bin/gcc rm -f ${DESTDIR}${PREFIX}/bin/gccbug ${DESTDIR}${PREFIX}/bin/gcov - rm -f ${DESTDIR}${PREFIX}/bin/i686-pc-linux-gnu-gcc* + rm -f ${DESTDIR}${PREFIX}/bin/${MACHINE}-gcc* rm -f ${DESTDIR}${PREFIX}/info/cpp.info* rm -f ${DESTDIR}${PREFIX}/info/cppinternals.info* rm -f ${DESTDIR}${PREFIX}/info/gcc.info* diff --git a/translate/ghdldrv/Makefile b/translate/ghdldrv/Makefile index dc1b07df6..467794c8f 100644 --- a/translate/ghdldrv/Makefile +++ b/translate/ghdldrv/Makefile @@ -102,6 +102,9 @@ install.v87: std.v87 ieee.v87 synopsys.v87 install.standard: $(LIB93_DIR)/std/std_standard.o \ $(LIB87_DIR)/std/std_standard.o +make-lib-links: + cd ../lib; ln -sf ../grt/grt.lst .; ln -sf ../grt/libgrt.a . + install.all: install.v87 install.v93 install.standard install.mcode: install.v87 install.v93 diff --git a/translate/grt/Makefile b/translate/grt/Makefile index 2b60de150..5e0a7cdb9 100644 --- a/translate/grt/Makefile +++ b/translate/grt/Makefile @@ -31,13 +31,16 @@ exec_prefix=$(prefix) libdir=$(exec_prefix)/lib grt_libdir=$(libdir) -target=i686-pc-linux-gnu +target:=$(shell $(CC) -dumpmachine) all: grt-all install: grt-install clean: grt-clean $(RM) *~ +show_target: + echo "Target is $(target)" + include Makefile.inc diff --git a/translate/grt/Makefile.inc b/translate/grt/Makefile.inc index 55a45e977..249e84b8a 100644 --- a/translate/grt/Makefile.inc +++ b/translate/grt/Makefile.inc @@ -28,29 +28,45 @@ # target: GCC target # GRT_FLAGS: compilation flags. +# Convert the target variable into a space separated list of architecture, +# manufacturer, and operating system and assign each of those to its own +# variable. + +targ:=$(subst -, ,$(target)) +arch:=$(word 1,$(targ)) +ifeq ($(words $(targ)),2) + osys:=$(word 2,$(targ)) +else + osys:=$(word 3,$(targ)) +endif + # Set target files. -ifeq ($(filter-out i%86-pc-linux-gnu,$(target)),) +ifeq ($(filter-out i%86 linux,$(arch) $(osys)),) GRT_TARGET_OBJS=i386.o linux.o times.o GRT_EXTRA_LIB=-ldl endif -ifeq ($(filter-out sparc-sun-solaris%,$(target)),) +ifeq ($(filter-out sparc solaris%,$(arch) $(osys)),) GRT_TARGET_OBJS=sparc.o linux.o times.o GRT_EXTRA_LIB=-ldl endif -ifeq ($(filter-out powerpc-linux%,$(target)),) +ifeq ($(filter-out powerpc linux%,$(arch) $(osys)),) GRT_TARGET_OBJS=ppc.o linux.o times.o GRT_EXTRA_LIB=-ldl endif -ifeq ($(filter-out i%86-pc-mingw32,$(target)),) +ifeq ($(filter-out ia64 linux,$(arch) $(osys)),) + GRT_TARGET_OBJS=ia64.o linux.o times.o + GRT_EXTRA_LIB=-ldl +endif +ifeq ($(filter-out i%86 mingw32,$(arch) $(osys)),) GRT_TARGET_OBJS=win32.o clock.o endif -ifeq ($(filter-out i%86-pc-cygwin,$(target)),) +ifeq ($(filter-out i%86 cygwin,$(arch) $(osys)),) GRT_TARGET_OBJS=win32.o clock.o endif # Fall-back: use a generic implementation based on pthreads. ifndef GRT_TARGET_OBJS GRT_TARGET_OBJS=pthread.o times.o - GRT_EXTRA_LIB=-lpthread + GRT_EXTRA_LIB=-lpthread -ldl endif # Additionnal object files (C or asm files). @@ -90,6 +106,9 @@ sparc.o: $(GRTSRCDIR)/config/sparc.S ppc.o: $(GRTSRCDIR)/config/ppc.S $(CC) -c $(GRT_FLAGS) -o $@ $< +ia64.o: $(GRTSRCDIR)/config/ia64.S + $(CC) -c $(GRT_FLAGS) -o $@ $< + linux.o: $(GRTSRCDIR)/config/linux.c $(CC) -c $(GRT_FLAGS) -o $@ $< @@ -127,7 +146,7 @@ grt-files.in: grt-files grt.lst: grt-files.in echo "@/libgrt.a" > $@ ifdef GRT_EXTRA_LIB - echo $(GRT_EXTRA_LIB) >> $@ + for i in $(GRT_EXTRA_LIB); do echo $$i >> $@; done endif cat $< >> $@ diff --git a/translate/grt/config/ia64.S b/translate/grt/config/ia64.S new file mode 100644 index 000000000..cd77d497a --- /dev/null +++ b/translate/grt/config/ia64.S @@ -0,0 +1,193 @@ + .file "ia64.S" + .pred.safe_across_calls p1-p5,p16-p63 + + .text + .align 16 + .proc grt_stack_loop +grt_stack_loop: + alloc r32 = ar.pfs, 0, 1, 1, 0 + .body + ;; +1: mov r33 = r4 + br.call.sptk.many b0 = b1 + ;; + br 1b + .endp + + .global grt_stack_switch# + .proc grt_stack_switch# + /* r32: struct stack_context *TO, r33: struct stack_context *FROM. */ + // Registers to be saved: + // ar.rsc, ar.bsp, ar.pfs, ar.lc, ar.rnat [5] + // gp, r4-r7 (+ Nat) [6] + // f2-f5, f16-f31 [20] + // p1-p5, p16-p63 [1] ??? + // b1-b5 [5] +grt_stack_switch: + .prologue 2, 2 + .vframe r2 + alloc r31=ar.pfs, 2, 0, 0, 0 + adds r12 = -160, r12 + .body + ;; + // Save ar.rsc, ar.bsp, ar.pfs + { + mov r14 = ar.rsc + mov r15 = ar.bsp + adds r22 = (5*8), r12 + } + ;; + { + st8 [r12] = r14 // sp + 0 <- ar.rsc + st8.spill [r22] = r1, 8 // sp + 40 <- r1 + adds r20 = 8, r12 + } + ;; + st8 [r20] = r15, 8 // sp + 8 <- ar.bsp + st8.spill [r22] = r4, 8 // sp + 48 <- r4 + ;; + mov r15 = ar.lc + st8 [r20] = r31, 8 // sp + 16 <- ar.pfs + st8.spill [r22] = r5, 8 // sp + 56 <- r5 + ;; + mov r14 = b0 + st8 [r20] = r15, 8 // sp + 24 <- ar.lc + // Flush dirty registers to the backing store + flushrs + ;; + // Set the RSE in enforced lazy mode. + mov ar.rsc = 0 + ;; + mov r15 = ar.rnat + st8.spill [r22] = r6, 8 // sp + 64 <- r6 + ;; + mov r16 = b1 + st8.spill [r22] = r7, 16 // sp + 72 <- r7 + st8 [r20] = r15, 64 // sp + 32 <- ar.rnat + ;; + mov r15 = b2 + mov r17 = ar.unat + st8 [r20] = r14, 8 // sp + 96 <- b0 + ;; + mov r14 = b3 + st8 [r22] = r17, 24 // sp + 88 <- ar.unat + st8 [r20] = r16, 16 // sp + 104 <- b1 + ;; + st8 [r22] = r15, 16 // sp + 112 <- b2 + st8 [r20] = r14, 16 // sp + 120 <- b3 + mov r16 = b4 + ;; + st8 [r22] = r16, 16 // sp + 128 <- b4 + // Read new sp. + ld8 r21 = [r32] + mov r15 = b5 + ;; + mov r14 = pr + st8 [r20] = r15 // sp + 136 <- b5 + ;; + st8 [r22] = r14 // sp + 144 <- pr + adds r20 = 8, r21 + ;; + invala + // Save sp. + st8 [r33] = r12 + ld8 r14 = [r21], 88 // sp + 0 (ar.rsc) + ;; + ld8 r15 = [r21], -56 // sp + 88 (ar.unat) + ld8 r16 = [r20], 8 // sp + 8 (ar.bsp) + ;; + ld8 r17 = [r21], 8 // sp + 32 (ar.rnat) + ld8 r18 = [r20], 8 // sp + 16 (ar.pfs) + mov ar.unat = r15 + ;; + ld8 r15 = [r20], 72 // sp + 24 (ar.lc) + ld8.fill r1 = [r21], 8 // sp + 40 (r1) + mov ar.bspstore = r16 + ;; + mov ar.rnat = r17 + mov ar.pfs = r18 + ld8.fill r4 = [r21], 8 // sp + 48 (r4) + ;; + mov ar.rsc = r14 + mov ar.lc = r15 + ld8 r17 = [r20], 8 // sp + 96 (b0) + ;; + mov b0 = r17 + ld8.fill r5 = [r21], 8 // sp + 56 (r5) + ld8 r14 = [r20], 8 // sp + 104 (b1) + ;; + mov b1 = r14 + ld8.fill r6 = [r21], 8 // sp + 64 (r6) + ld8 r15 = [r20], 8 // sp + 112 (b2) + ;; + mov b2 = r15 + ld8.fill r7 = [r21], 8 // sp + 72 (r7) + ld8 r14 = [r20], 8 // sp + 120 (b3) + ;; + mov b3 = r14 + ld8 r15 = [r20], 8 // sp + 128 (b4) + ;; + mov b4 = r15 + ld8 r14 = [r20], 8 // sp + 136 (b5) + ;; + mov b5 = r14 + ld8 r15 = [r20], 8 // sp + 144 (pr) + mov r12 = r21 + ;; + mov pr = r15, -1 + br.ret.sptk.many b0 + ;; + .endp grt_stack_switch# + + .align 16 + // r32: func, r33: arg + .global grt_stack_create# + .proc grt_stack_create# +grt_stack_create: + .prologue 14, 34 + .save ar.pfs, r35 + alloc r35 = ar.pfs, 2, 4, 0, 0 + .save rp, r34 + mov r34 = b0 + ;; + .body + br.call.sptk.many b0 = grt_stack_allocate# + ;; + // Compute backing store. + movl r14=stack_max_size + ld8 r22 = [r32], 8 // read ip (-> b1) + adds r20 = -(160 + 16), r8 + adds r21 = -(160 + 16) + 32, r8 + ;; + mov r18 = 0x0f // ar.rsc: LE, PL=3, Eager + ld4 r14 = [r14] // r16: bsp + st8 [r21] = r0, 8 // sp + 32 (ar.rnat = 0) + ld8 r23 = [r32] // read r1 from func + st8 [r8] = r20 // Save cur_sp + ;; + st8 [r20] = r18, 8 // sp + 0 (ar.rsc) + st8 [r21] = r23, 64 // sp + 40 (r1 = func.r1) + sub r14 = r8, r14 // Backing store base + ;; + adds r14 = 16, r14 // Add sizeof (stack_context) + st8 [r21] = r22, -8 // sp + 104 (b1 = func.ip) + ;; + movl r15 = grt_stack_loop + mov r16 = (0 << 7) | 1 // CFM: sol=0, sof=1 + st8 [r20] = r14, 8 // sp + 8 (ar.bsp) + ;; + st8 [r21] = r15, -48 // sp + 96 (b0 = grt_stack_loop) + st8 [r20] = r16, 8 // sp + 16 (ar.pfs) + ;; + st8 [r20] = r0, 8 // sp + 24 (ar.lc) + st8 [r21] = r33 // sp + 48 (r4 = arg) + ;; + st8 [r20] = r0, 8 // sp + 32 (ar.rnat) + ;; + + mov ar.pfs = r35 + mov b0 = r34 + br.ret.sptk.many b0 + ;; + .endp grt_stack_create# + .ident "GCC: (GNU) 4.0.2" diff --git a/translate/grt/config/linux.c b/translate/grt/config/linux.c index 047cfd1b4..3159cd613 100644 --- a/translate/grt/config/linux.c +++ b/translate/grt/config/linux.c @@ -22,6 +22,7 @@ #include <signal.h> #include <fcntl.h> #include <sys/ucontext.h> +#include <stdlib.h> //#include <stdint.h> /* On x86, the stack growns downward. */ @@ -262,6 +263,13 @@ grt_stack_allocate (void) res = (struct stack_context *)(base + sizeof (struct stack_context)); #endif +#ifdef __ia64__ + /* Also allocate BSP. */ + if (mmap (base, page_size, PROT_READ | PROT_WRITE, + MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS, MMAP_FILEDES, 0) != base) + return NULL; +#endif + res->cur_sp = (void *)res; res->cur_length = stack_size; return res; diff --git a/translate/grt/grt-processes.adb b/translate/grt/grt-processes.adb index c0dee2bcb..1e8b183ef 100644 --- a/translate/grt/grt-processes.adb +++ b/translate/grt/grt-processes.adb @@ -134,6 +134,18 @@ package body Grt.Processes is return Natural (Process_Table.Last); end Get_Nbr_Processes; + function Get_Nbr_Sensitized_Processes return Natural + is + Res : Natural := 0; + begin + for I in Process_Table.First .. Process_Table.Last loop + if Process_Table.Table (I).State = State_Sensitized then + Res := Res + 1; + end if; + end loop; + return Res; + end Get_Nbr_Sensitized_Processes; + procedure Process_Register (This : System.Address; Proc : System.Address; Ctxt : Rti_Context; @@ -616,6 +628,7 @@ package body Grt.Processes is Update_Signals; if Options.Flag_Stats then Stats.End_Update; + Stats.Start_Resume; end if; -- d) For each process P, if P is currently sensitive to a signal S and @@ -659,6 +672,10 @@ package body Grt.Processes is end; end loop; + if Options.Flag_Stats then + Stats.End_Resume; + end if; + -- e) Each nonpostponed that has resumed in the current simulation cycle -- is executed until it suspends. Status := Run_Processes (Postponed => False); diff --git a/translate/grt/grt-processes.ads b/translate/grt/grt-processes.ads index e9faa3732..d7cb68caa 100644 --- a/translate/grt/grt-processes.ads +++ b/translate/grt/grt-processes.ads @@ -47,9 +47,10 @@ package Grt.Processes is function Get_Current_Process_Id return Process_Id; pragma Inline (Get_Current_Process_Id); - -- Return the number of processes. + -- Return the total number of processes and number of sensitized processes. -- Used for statistics. function Get_Nbr_Processes return Natural; + function Get_Nbr_Sensitized_Processes return Natural; -- Disp the name of process PROC. procedure Disp_Process_Name (Stream : Grt.Stdio.FILEs; Proc : Process_Id); diff --git a/translate/grt/grt-signals.adb b/translate/grt/grt-signals.adb index 638c37572..fed178853 100644 --- a/translate/grt/grt-signals.adb +++ b/translate/grt/grt-signals.adb @@ -235,7 +235,7 @@ package body Grt.Signals is procedure Ghdl_Process_Add_Driver (Sign : Ghdl_Signal_Ptr) is - type Size_T is new Integer; + type Size_T is mod 2**Standard'Address_Size; function Malloc (Size : Size_T) return Driver_Arr_Ptr; pragma Import (C, Malloc); @@ -246,7 +246,8 @@ package body Grt.Signals is function Size (N : Ghdl_Index_Type) return Size_T is begin - return Size_T (N * Driver_Type'Size / System.Storage_Unit); + return Size_T (N * Driver_Fat_Array'Component_Size + / System.Storage_Unit); end Size; Trans : Transaction_Acc; diff --git a/translate/grt/grt-stats.adb b/translate/grt/grt-stats.adb index 284cc6a91..fb8a69202 100644 --- a/translate/grt/grt-stats.adb +++ b/translate/grt/grt-stats.adb @@ -110,6 +110,10 @@ package body Grt.Stats is Start_Next_Time_Time : Time_Stats; Next_Time_Times : Time_Stats; + Start_Resume_Time : Time_Stats; + Resume_Times : Time_Stats; + + Running_Time : Time_Stats; Simu_Time : Time_Stats; procedure Start_Elaboration is @@ -169,12 +173,26 @@ package body Grt.Stats is Next_Time_Times := Next_Time_Times + (Now - Start_Next_Time_Time); end End_Next_Time; + procedure Start_Resume is + begin + Get_Stats (Start_Resume_Time); + end Start_Resume; + + procedure End_Resume + is + Now : Time_Stats; + begin + Get_Stats (Now); + Resume_Times := Resume_Times + (Now - Start_Resume_Time); + end End_Resume; + procedure End_Simulation is Now : Time_Stats; begin Get_Stats (Now); Simu_Time := Now - Start_Time; + Running_Time := Now - End_Order_Time; end End_Simulation; procedure Disp_Signals_Stats @@ -290,12 +308,18 @@ package body Grt.Stats is Put (stdout, " internal elab: "); Put (stdout, End_Order_Time - End_Elab_Time); New_Line (stdout); + Put (stdout, " running time: "); + Put (stdout, Running_Time); + New_Line (stdout); Put (stdout, " cycle (sum): "); - Put (stdout, Proc_Times + Update_Times + Next_Time_Times); + Put (stdout, Proc_Times + Update_Times + Next_Time_Times + Resume_Times); New_Line (stdout); Put (stdout, " processes: "); Put (stdout, Proc_Times); New_Line (stdout); + Put (stdout, " resume: "); + Put (stdout, Resume_Times); + New_Line (stdout); Put (stdout, " update: "); Put (stdout, Update_Times); New_Line (stdout); @@ -322,6 +346,8 @@ package body Grt.Stats is Put (stdout, "Number of processes: "); Put_I32 (stdout, Ghdl_I32 (Grt.Processes.Get_Nbr_Processes)); New_Line; - + Put (stdout, "Number of sensitized processes: "); + Put_I32 (stdout, Ghdl_I32 (Grt.Processes.Get_Nbr_Sensitized_Processes)); + New_Line; end Disp_Stats; end Grt.Stats; diff --git a/translate/grt/grt-stats.ads b/translate/grt/grt-stats.ads index c03f11b02..7844a86eb 100644 --- a/translate/grt/grt-stats.ads +++ b/translate/grt/grt-stats.ads @@ -34,6 +34,11 @@ package Grt.Stats is procedure Start_Update; procedure End_Update; + -- Time in process resume + procedure Start_Resume; + procedure End_Resume; + + procedure End_Simulation; -- Disp all statistics. diff --git a/translate/grt/grt-types.ads b/translate/grt/grt-types.ads index 5c8191070..c168ca40f 100644 --- a/translate/grt/grt-types.ads +++ b/translate/grt/grt-types.ads @@ -33,7 +33,7 @@ package Grt.Types is type Ghdl_F64 is new IEEE_Float_64; type Ghdl_Ptr is new Address; - type Ghdl_Index_Type is mod 2 ** Word_Size; + type Ghdl_Index_Type is mod 2 ** 32; subtype Ghdl_Real is Ghdl_F64; type Ghdl_Dir_Type is (Dir_To, Dir_Downto); diff --git a/translate/translation.adb b/translate/translation.adb index e0d21d001..7881530c5 100644 --- a/translate/translation.adb +++ b/translate/translation.adb @@ -9951,10 +9951,6 @@ package body Translation is Atype : O_Tnode; begin Decl_Type := Get_Type (Decl); - if Decl_Type = Null_Iir then - -- FIXME : todo. - raise Internal_Error; - end if; Chap3.Translate_Named_Type_Definition (Decl_Type, Get_Identifier (Decl)); @@ -10020,7 +10016,6 @@ package body Translation is Name_Node := Chap6.Translate_Name (Name); Kind := Get_Object_Kind (Name_Node); N_Info := Get_Info (Name_Type); - --Chap6.Translate_Name (Decl, Decl_Node, Sig); case Tinfo.Type_Mode is when Type_Mode_Fat_Array => |