aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2023-01-18 21:32:59 +0100
committerTristan Gingold <tgingold@free.fr>2023-01-20 21:54:35 +0100
commit418800b56e3296eec94e56707ebad7dcd1d1c6ee (patch)
tree3dc316321d3bdef39629dc57dde9651e276b9f2b
parenta53b01b53c3c8225a832e8f20d019ac39d68ce38 (diff)
downloadghdl-418800b56e3296eec94e56707ebad7dcd1d1c6ee.tar.gz
ghdl-418800b56e3296eec94e56707ebad7dcd1d1c6ee.tar.bz2
ghdl-418800b56e3296eec94e56707ebad7dcd1d1c6ee.zip
synth: create sub-instace for processes
-rw-r--r--src/simul/simul-vhdl_elab.adb1
-rw-r--r--src/synth/elab-vhdl_annotations.adb6
-rw-r--r--src/synth/elab-vhdl_context.adb10
-rw-r--r--src/synth/elab-vhdl_context.ads5
-rw-r--r--src/synth/elab-vhdl_stmts.adb2
5 files changed, 18 insertions, 6 deletions
diff --git a/src/simul/simul-vhdl_elab.adb b/src/simul/simul-vhdl_elab.adb
index eb481479b..8e2db63ad 100644
--- a/src/simul/simul-vhdl_elab.adb
+++ b/src/simul/simul-vhdl_elab.adb
@@ -1125,6 +1125,7 @@ package body Simul.Vhdl_Elab is
if Get_Kind (Proc) in Iir_Kinds_Process_Statement then
Proc_Inst := Make_Elab_Instance (Processes_Table.Table (I).Inst,
Proc, Proc, Null_Node);
+ Set_Sub_Instance (Processes_Table.Table (I).Inst, Proc, Proc_Inst);
Processes_Table.Table (I).Inst := Proc_Inst;
Set_Instance_Const (Proc_Inst, True);
Synth.Vhdl_Decls.Synth_Declarations
diff --git a/src/synth/elab-vhdl_annotations.adb b/src/synth/elab-vhdl_annotations.adb
index 0d7af8c79..3a076cde2 100644
--- a/src/synth/elab-vhdl_annotations.adb
+++ b/src/synth/elab-vhdl_annotations.adb
@@ -983,13 +983,9 @@ package body Elab.Vhdl_Annotations is
procedure Annotate_Process_Statement (Block_Info : Sim_Info_Acc; Stmt : Iir)
is
- pragma Unreferenced (Block_Info);
Info : Sim_Info_Acc;
begin
- Info := new Sim_Info_Type'(Kind => Kind_Process,
- Ref => Stmt,
- Nbr_Objects => 0);
- Set_Ann (Stmt, Info);
+ Info := Create_Block_Info (Block_Info, Stmt);
Annotate_Declaration_List
(Info, Get_Declaration_Chain (Stmt));
diff --git a/src/synth/elab-vhdl_context.adb b/src/synth/elab-vhdl_context.adb
index 99f3efb1d..7b905f663 100644
--- a/src/synth/elab-vhdl_context.adb
+++ b/src/synth/elab-vhdl_context.adb
@@ -484,6 +484,16 @@ package body Elab.Vhdl_Context is
return Syn_Inst.Objects (Info.Inst_Slot).I_Inst;
end Get_Sub_Instance;
+ procedure Set_Sub_Instance (Syn_Inst : Synth_Instance_Acc;
+ Stmt : Node;
+ Sub_Inst : Synth_Instance_Acc)
+ is
+ Info : constant Sim_Info_Acc := Get_Ann (Stmt);
+ begin
+ pragma Assert (Syn_Inst.Objects (Info.Inst_Slot).I_Inst = null);
+ Syn_Inst.Objects (Info.Inst_Slot).I_Inst := Sub_Inst;
+ end Set_Sub_Instance;
+
function Get_Component_Instance
(Syn_Inst : Synth_Instance_Acc) return Synth_Instance_Acc
is
diff --git a/src/synth/elab-vhdl_context.ads b/src/synth/elab-vhdl_context.ads
index 13fe8bb49..69435d283 100644
--- a/src/synth/elab-vhdl_context.ads
+++ b/src/synth/elab-vhdl_context.ads
@@ -194,6 +194,11 @@ package Elab.Vhdl_Context is
function Get_Component_Instance
(Syn_Inst : Synth_Instance_Acc) return Synth_Instance_Acc;
+ -- For processes, whose instance is not set during elaboration.
+ procedure Set_Sub_Instance (Syn_Inst : Synth_Instance_Acc;
+ Stmt : Node;
+ Sub_Inst : Synth_Instance_Acc);
+
-- Return the scope of BLK. Deals with architecture bodies.
function Get_Info_Scope (Blk : Node) return Sim_Info_Acc;
diff --git a/src/synth/elab-vhdl_stmts.adb b/src/synth/elab-vhdl_stmts.adb
index 6f0339534..ebb2380b2 100644
--- a/src/synth/elab-vhdl_stmts.adb
+++ b/src/synth/elab-vhdl_stmts.adb
@@ -268,7 +268,7 @@ package body Elab.Vhdl_Stmts is
begin
case Get_Kind (Stmt) is
when Iir_Kinds_Process_Statement =>
- null;
+ Create_Sub_Instance (Syn_Inst, Stmt, null);
when Iir_Kind_Concurrent_Simple_Signal_Assignment
| Iir_Kind_Concurrent_Selected_Signal_Assignment
| Iir_Kind_Concurrent_Conditional_Signal_Assignment
id='n334' href='#n334'>334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445