mirror of
https://github.com/YosysHQ/yosys
synced 2025-06-02 20:31:22 +00:00
adding offset info to memories
This commit is contained in:
parent
a25f370191
commit
609f46eeb7
1 changed files with 3 additions and 2 deletions
|
@ -388,7 +388,7 @@ void dump_wire(std::ostream &f, std::string indent, RTLIL::Wire *wire)
|
||||||
void dump_memory(std::ostream &f, std::string indent, RTLIL::Memory *memory)
|
void dump_memory(std::ostream &f, std::string indent, RTLIL::Memory *memory)
|
||||||
{
|
{
|
||||||
dump_attributes(f, indent, memory->attributes);
|
dump_attributes(f, indent, memory->attributes);
|
||||||
f << stringf("%s" "reg [%d:0] %s [%d:0];\n", indent.c_str(), memory->width-1, id(memory->name).c_str(), memory->size-1);
|
f << stringf("%s" "reg [%d:0] %s [%d:%d];\n", indent.c_str(), (memory->width-1), id(memory->name).c_str(), memory->size+memory->start_offset-1, memory->start_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dump_cell_expr_port(std::ostream &f, RTLIL::Cell *cell, std::string port, bool gen_signed = true)
|
void dump_cell_expr_port(std::ostream &f, RTLIL::Cell *cell, std::string port, bool gen_signed = true)
|
||||||
|
@ -952,6 +952,7 @@ bool dump_cell_expr(std::ostream &f, std::string indent, RTLIL::Cell *cell)
|
||||||
std::string mem_id = id(cell->parameters["\\MEMID"].decode_string());
|
std::string mem_id = id(cell->parameters["\\MEMID"].decode_string());
|
||||||
int abits = cell->parameters["\\ABITS"].as_int();
|
int abits = cell->parameters["\\ABITS"].as_int();
|
||||||
int size = cell->parameters["\\SIZE"].as_int();
|
int size = cell->parameters["\\SIZE"].as_int();
|
||||||
|
int offset = cell->parameters["\\OFFSET"].as_int();
|
||||||
int width = cell->parameters["\\WIDTH"].as_int();
|
int width = cell->parameters["\\WIDTH"].as_int();
|
||||||
bool use_init = !(RTLIL::SigSpec(cell->parameters["\\INIT"]).is_fully_undef());
|
bool use_init = !(RTLIL::SigSpec(cell->parameters["\\INIT"]).is_fully_undef());
|
||||||
|
|
||||||
|
@ -960,7 +961,7 @@ bool dump_cell_expr(std::ostream &f, std::string indent, RTLIL::Cell *cell)
|
||||||
// initial begin
|
// initial begin
|
||||||
// memid[0] = ...
|
// memid[0] = ...
|
||||||
// end
|
// end
|
||||||
f << stringf("%s" "reg [%d:%d] %s [%d:%d];\n", indent.c_str(), width-1, 0, mem_id.c_str(), size-1, 0);
|
f << stringf("%s" "reg [%d:%d] %s [%d:%d];\n", indent.c_str(), width-1, 0, mem_id.c_str(), size+offset-1, offset);
|
||||||
if (use_init)
|
if (use_init)
|
||||||
{
|
{
|
||||||
f << stringf("%s" "initial begin\n", indent.c_str());
|
f << stringf("%s" "initial begin\n", indent.c_str());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue