diff options
author | Tristan Gingold <tgingold@free.fr> | 2019-07-05 18:37:26 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2019-07-06 07:18:48 +0200 |
commit | aef7921f6c3b375a881945e21e55453d761303a3 (patch) | |
tree | 3226c736e86779b21951a2ab0b649acc3f320468 /src/synth/synthesis.adb | |
parent | d14ef7bf8c94b4e164ae26954c4f737e2c3d655b (diff) | |
download | ghdl-aef7921f6c3b375a881945e21e55453d761303a3.tar.gz ghdl-aef7921f6c3b375a881945e21e55453d761303a3.tar.bz2 ghdl-aef7921f6c3b375a881945e21e55453d761303a3.zip |
synth: support top-level generics.
Diffstat (limited to 'src/synth/synthesis.adb')
-rw-r--r-- | src/synth/synthesis.adb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/synth/synthesis.adb b/src/synth/synthesis.adb index a9ce60085..3a90aff40 100644 --- a/src/synth/synthesis.adb +++ b/src/synth/synthesis.adb @@ -33,6 +33,7 @@ with Synth.Context; use Synth.Context; with Synth.Types; use Synth.Types; with Synth.Decls; use Synth.Decls; with Synth.Stmts; use Synth.Stmts; +with Synth.Expr; use Synth.Expr; with Synth.Environment.Debug; pragma Unreferenced (Synth.Environment.Debug); @@ -149,6 +150,20 @@ package body Synthesis is Syn_Inst.Block_Scope := Get_Info (Entity); Syn_Inst.Name := New_Sname_User (Get_Identifier (Entity)); + -- Compute generics. + Inter := Get_Generic_Chain (Entity); + while Is_Valid (Inter) loop + Synth_Declaration_Type (Syn_Inst, Inter); + declare + Val : Value_Acc; + begin + Val := Synth_Expression_With_Type + (Syn_Inst, Get_Default_Value (Inter), Get_Type (Inter)); + Create_Object (Syn_Inst, Inter, Val); + end; + Inter := Get_Chain (Inter); + end loop; + -- Allocate values and count inputs and outputs Inter := Get_Port_Chain (Entity); Nbr_Inputs := 0; |