InterfaceBlock *InterfaceGenerator::generate_interface(InterfaceBlock &out_block)
{
- if(stage->interface_blocks.count("in"+out_block.block_name))
+ if(stage->interface_blocks.count("in "+out_block.block_name))
return 0;
InterfaceBlock *in_block = new InterfaceBlock;
}
iface_target_block->body.insert(iface_insert_point, in_block);
- stage->interface_blocks.insert(make_pair("in"+in_block->block_name, in_block));
+ stage->interface_blocks.insert(make_pair("in "+in_block->block_name, in_block));
if(!in_block->instance_name.empty())
- stage->interface_blocks.insert(make_pair("_"+in_block->instance_name, in_block));
+ stage->interface_blocks.insert(make_pair(in_block->instance_name, in_block));
SetFlag set_scope(function_scope, false);
SetForScope<Block *> set_block(current_block, &stage->content);
}
const map<string, InterfaceBlock *> &prev_blocks = stage->previous->interface_blocks;
- map<string, InterfaceBlock *>::const_iterator j = prev_blocks.find("_"+var.name);
+ map<string, InterfaceBlock *>::const_iterator j = prev_blocks.find(var.name);
if(j!=prev_blocks.end() && j->second->interface=="out")
{
generate_interface(*j->second);
if(!iface.linked_block && stage->previous)
{
const map<string, InterfaceBlock *> &prev_blocks = stage->previous->interface_blocks;
- map<string, InterfaceBlock *>::const_iterator i = prev_blocks.find("out"+iface.block_name);
+ map<string, InterfaceBlock *>::const_iterator i = prev_blocks.find("out "+iface.block_name);
if(i!=prev_blocks.end())
{
iface.linked_block = i->second;
if(!declaration)
{
const map<string, InterfaceBlock *> &blocks = stage->interface_blocks;
- map<string, InterfaceBlock *>::const_iterator i = blocks.find("_"+var.name);
+ map<string, InterfaceBlock *>::const_iterator i = blocks.find(var.name);
if(i!=blocks.end())
{
/* The name refers to an interface block with an instance name rather
void VariableResolver::visit(InterfaceBlockReference &iface)
{
- map<string, InterfaceBlock *>::iterator i = stage->interface_blocks.find("_"+iface.name);
+ map<string, InterfaceBlock *>::iterator i = stage->interface_blocks.find(iface.name);
InterfaceBlock *declaration = (i!=stage->interface_blocks.end() ? i->second : 0);
r_any_resolved |= (declaration!=iface.declaration);
iface.declaration = declaration;
{
/* Block names can be reused in different interfaces. Prefix the name with
the first character of the interface to avoid conflicts. */
- stage->interface_blocks.insert(make_pair(iface.interface+iface.block_name, &iface));
+ stage->interface_blocks.insert(make_pair(format("%s %s", iface.interface, iface.block_name), &iface));
if(!iface.instance_name.empty())
- stage->interface_blocks.insert(make_pair("_"+iface.instance_name, &iface));
+ stage->interface_blocks.insert(make_pair(iface.instance_name, &iface));
TraversingVisitor::visit(iface);
}
void IdentifierValidator::visit(InterfaceBlock &iface)
{
- string key = iface.interface+iface.block_name;
+ string key = format("%s %s", iface.interface, iface.block_name);
map<string, InterfaceBlock *>::const_iterator i = interface_blocks.find(key);
if(i!=interface_blocks.end())
multiple_definition(format("interface block '%s %s'", iface.interface, iface.block_name), iface, *i->second);
{
if(to_remove->count(&iface))
{
- remove_from_map(stage->interface_blocks, iface.interface+iface.block_name, iface);
+ remove_from_map(stage->interface_blocks, format("%s %s", iface.interface, iface.block_name), iface);
if(!iface.instance_name.empty())
- remove_from_map(stage->interface_blocks, "_"+iface.instance_name, iface);
+ remove_from_map(stage->interface_blocks, iface.instance_name, iface);
}
SetFlag set_recursive(recursive_remove, recursive_remove || to_remove->count(&iface));
TraversingVisitor::visit(iface);