aboutsummaryrefslogtreecommitdiffstats
path: root/src/synth/synth-insts.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2019-09-21 09:09:48 +0200
committerTristan Gingold <tgingold@free.fr>2019-09-21 09:09:48 +0200
commit1bb482dc531d0b6485c128184ab77674df0fcfdb (patch)
tree109d0772071e35591b99ab942527dabb97c26f14 /src/synth/synth-insts.adb
parent9dc242a89475b2de486859988cf10fc7d57cf698 (diff)
downloadghdl-1bb482dc531d0b6485c128184ab77674df0fcfdb.tar.gz
ghdl-1bb482dc531d0b6485c128184ab77674df0fcfdb.tar.bz2
ghdl-1bb482dc531d0b6485c128184ab77674df0fcfdb.zip
synth-insts: refactoring
Diffstat (limited to 'src/synth/synth-insts.adb')
-rw-r--r--src/synth/synth-insts.adb39
1 files changed, 12 insertions, 27 deletions
diff --git a/src/synth/synth-insts.adb b/src/synth/synth-insts.adb
index b73ca6ac8..275efcfeb 100644
--- a/src/synth/synth-insts.adb
+++ b/src/synth/synth-insts.adb
@@ -56,34 +56,17 @@ package body Synth.Insts is
end case;
end Mode_To_Port_Kind;
- procedure Make_Port_Desc (Val : Value_Acc;
- Name : Sname;
- Ports : in out Port_Desc_Array;
- Idx : in out Port_Nbr;
- Dir : Port_Kind) is
- begin
- case Val.Kind is
- when Value_Wire =>
- Idx := Idx + 1;
- Ports (Idx) := (Name => Name,
- W => Get_Type_Width (Val.Typ),
- Dir => Dir);
- when others =>
- raise Internal_Error; -- TODO
- end case;
- end Make_Port_Desc;
-
- procedure Make_Port_Desc (Syn_Inst : Synth_Instance_Acc;
- Inter : Node;
- Ports : in out Port_Desc_Array;
- Idx : in out Port_Nbr;
- Dir : Port_Kind)
+ function Make_Port_Desc (Syn_Inst : Synth_Instance_Acc;
+ Inter : Node;
+ Dir : Port_Kind) return Port_Desc
is
Val : constant Value_Acc := Get_Value (Syn_Inst, Inter);
Name : Sname;
begin
Name := New_Sname_User (Get_Identifier (Inter));
- Make_Port_Desc (Val, Name, Ports, Idx, Dir);
+ return (Name => Name,
+ W => Get_Type_Width (Val.Typ),
+ Dir => Dir);
end Make_Port_Desc;
-- Parameters that define an instance.
@@ -223,12 +206,14 @@ package body Synth.Insts is
while Is_Valid (Inter) loop
case Mode_To_Port_Kind (Get_Mode (Inter)) is
when Port_In =>
- Make_Port_Desc
- (Syn_Inst, Inter, Inports, Nbr_Inputs, Port_In);
+ Nbr_Inputs := Nbr_Inputs + 1;
+ Inports (Nbr_Inputs) :=
+ Make_Port_Desc (Syn_Inst, Inter, Port_In);
when Port_Out
| Port_Inout =>
- Make_Port_Desc
- (Syn_Inst, Inter, Outports, Nbr_Outputs, Port_Out);
+ Nbr_Outputs := Nbr_Outputs + 1;
+ Outports (Nbr_Outputs) :=
+ Make_Port_Desc (Syn_Inst, Inter, Port_Out);
end case;
Inter := Get_Chain (Inter);
end loop;