Skip to content

Commit

Permalink
Pass signal values to interfaces. 'sigptr' optimization.
Browse files Browse the repository at this point in the history
Improve simulation speed by about 20%.
  • Loading branch information
gingold-adacore committed Dec 18, 2015
1 parent 4680da5 commit e8a965f
Show file tree
Hide file tree
Showing 29 changed files with 1,704 additions and 1,293 deletions.
167 changes: 0 additions & 167 deletions src/grt/config/win32thr.c

This file was deleted.

7 changes: 6 additions & 1 deletion src/grt/grt-disp_rti.adb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ with Grt.Astdio; use Grt.Astdio;
with Grt.Errors; use Grt.Errors;
with Grt.Hooks; use Grt.Hooks;
with Grt.Rtis_Utils; use Grt.Rtis_Utils;
with Grt.Signals;

package body Grt.Disp_Rti is
procedure Disp_Kind (Kind : Ghdl_Rtik);
Expand Down Expand Up @@ -57,7 +58,11 @@ package body Grt.Disp_Rti is
Sz : Ghdl_Index_Type;
begin
if Is_Sig then
Val := To_Ghdl_Value_Ptr (To_Addr_Acc (Addr).all);
-- ADDR is the address of the object.
-- The object contains a pointer to the signal.
-- The first field of the signal is a pointer to the value.
Val := Grt.Signals.To_Ghdl_Signal_Ptr
(To_Addr_Acc (Addr).all).Value_Ptr;
Sz := Address'Size / Storage_Unit;
else
Val := To_Ghdl_Value_Ptr (Addr);
Expand Down
14 changes: 9 additions & 5 deletions src/grt/grt-disp_signals.adb
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,15 @@ package body Grt.Disp_Signals is
Put_Time (stdout, Sig.Last_Active);
end if;
Put (" val=");
if Sig_Type /= null then
Disp_Value (stdout, Sig.Value, Sig_Type);
else
Disp_Value (Sig.Value, Sig.Mode);
end if;
declare
Val : constant Value_Union := Read_Value (Sig.Value_Ptr, Sig.Mode);
begin
if Sig_Type /= null then
Disp_Value (stdout, Val, Sig_Type);
else
Disp_Value (Val, Sig.Mode);
end if;
end;
Put ("; drv=");
if Sig_Type /= null then
Disp_Value (stdout, Sig.Driving_Value, Sig_Type);
Expand Down
6 changes: 3 additions & 3 deletions src/grt/grt-fst.adb
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ package body Grt.Fst is
Str : Std_String_Uncons (0 .. Len - 1);
begin
for I in Str'Range loop
Str (I) := From_Bit (Sig (I).Value.B1);
Str (I) := From_Bit (Sig (I).Value_Ptr.B1);
end loop;
fstWriterEmitValueChange (Context, Hand, Str'Address);
end;
Expand All @@ -556,12 +556,12 @@ package body Grt.Fst is
Str : Std_String_Uncons (0 .. Len - 1);
begin
for I in Str'Range loop
Str (I) := From_Std (Sig (I).Value.E8);
Str (I) := From_Std (Sig (I).Value_Ptr.E8);
end loop;
fstWriterEmitValueChange (Context, Hand, Str'Address);
end;
when Vcd_Integer32 =>
Fst_Put_Integer32 (Hand, Sig (0).Value.E32);
Fst_Put_Integer32 (Hand, Sig (0).Value_Ptr.E32);
when Vcd_Float64 =>
null;
when Vcd_Bad =>
Expand Down

0 comments on commit e8a965f

Please sign in to comment.