From 4e77abca44d40e60fb3cf5525b0cb8f75681202a Mon Sep 17 00:00:00 2001 From: Nick Gasson Date: Wed, 26 Aug 2009 15:56:23 +0100 Subject: [PATCH] Allow labelled begin blocks to contain processes in VHDL target This is a simple fix for a crash that occured when a process was inside a labelled begin inside a generate statement. (cherry picked from commit face1a1d150889e8258cca291d2e830257194536) --- tgt-vhdl/process.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tgt-vhdl/process.cc b/tgt-vhdl/process.cc index 6559f9101..d3813caa5 100644 --- a/tgt-vhdl/process.cc +++ b/tgt-vhdl/process.cc @@ -95,8 +95,13 @@ int draw_process(ivl_process_t proc, void *cd) ivl_scope_tname(scope), ivl_process_file(proc), ivl_process_lineno(proc)); - // A process should occur in a module scope, therefore it - // should have already been assigned a VHDL entity + // Skip over any generate and begin scopes until we find + // the module that contains them - this is where we will + // generate the process + while (ivl_scope_type(scope) == IVL_SCT_GENERATE + || ivl_scope_type(scope) == IVL_SCT_BEGIN) + scope = ivl_scope_parent(scope); + assert(ivl_scope_type(scope) == IVL_SCT_MODULE); vhdl_entity *ent = find_entity(scope); assert(ent != NULL);