Added automatic memid generation to memory_unpack command
authorClifford Wolf <clifford@clifford.at>
Thu, 16 Jan 2014 23:15:15 +0000 (00:15 +0100)
committerClifford Wolf <clifford@clifford.at>
Thu, 16 Jan 2014 23:15:15 +0000 (00:15 +0100)
passes/memory/memory_unpack.cc

index 6aa6698f77fd3a409f15901a7eb9584df1f1c8ad..060d8e671a6e105b7465f18381c6289425573f05 100644 (file)
@@ -31,8 +31,8 @@ static void handle_memory(RTLIL::Module *module, RTLIL::Cell *memory)
 
        RTLIL::IdString mem_name = RTLIL::escape_id(memory->parameters.at("\\MEMID").decode_string());
 
-       if (module->memories.count(mem_name) != 0)
-               log_error("Already found a memory object with the ID %s.\n", mem_name.c_str());
+       while (module->memories.count(mem_name) != 0)
+               mem_name += stringf("_%d", RTLIL::autoidx++);
 
        RTLIL::Memory *mem = new RTLIL::Memory;
        mem->name = mem_name;