diff options
author | Tristan Gingold <tgingold@free.fr> | 2021-05-07 19:20:32 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2021-05-07 19:20:32 +0200 |
commit | 29aa770398bd26fb82f6322e887f8313de77f96f (patch) | |
tree | 1b15a0d1e7260e3284098d565292d47a19e3a217 /src/synth/synth-environment.adb | |
parent | 6266bf8c49ecf5d04d6de11b9d4d1064bbd84bcd (diff) | |
download | ghdl-29aa770398bd26fb82f6322e887f8313de77f96f.tar.gz ghdl-29aa770398bd26fb82f6322e887f8313de77f96f.tar.bz2 ghdl-29aa770398bd26fb82f6322e887f8313de77f96f.zip |
synth-environment: add Set/Get_Kind, Wire_Unset
Diffstat (limited to 'src/synth/synth-environment.adb')
-rw-r--r-- | src/synth/synth-environment.adb | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/synth/synth-environment.adb b/src/synth/synth-environment.adb index 001b417ca..9c9385dd4 100644 --- a/src/synth/synth-environment.adb +++ b/src/synth/synth-environment.adb @@ -69,6 +69,22 @@ package body Synth.Environment is Wire_Rec.Kind := Wire_None; end Free_Wire; + procedure Set_Kind (Wid : Wire_Id; Kind : Wire_Kind) + is + Wire_Rec : Wire_Id_Record renames Wire_Id_Table.Table (Wid); + begin + pragma Assert (Kind = Wire_Unset or Wire_Rec.Kind = Wire_Unset); + Wire_Rec.Kind := Kind; + end Set_Kind; + + function Get_Kind (Wid : Wire_Id) return Wire_Kind + is + Wire_Rec : Wire_Id_Record renames Wire_Id_Table.Table (Wid); + begin + pragma Assert (Wire_Rec.Kind /= Wire_None); + return Wire_Rec.Kind; + end Get_Kind; + procedure Set_Wire_Gate (Wid : Wire_Id; Gate : Net) is begin -- Cannot override a gate. @@ -974,7 +990,7 @@ package body Synth.Environment is begin case Wid_Rec.Kind is when Wire_Signal | Wire_Output | Wire_Inout - | Wire_Variable => + | Wire_Variable | Wire_Unset => null; when Wire_Input | Wire_Enable | Wire_None => raise Internal_Error; @@ -1020,6 +1036,9 @@ package body Synth.Environment is | Wire_Enable => -- For signals, always read the previous value. return Wire_Rec.Gate; + when Wire_Unset => + pragma Assert (Wire_Rec.Cur_Assign = No_Seq_Assign); + return Wire_Rec.Gate; when Wire_None => raise Internal_Error; end case; |