diff options
author | Clifford Wolf <clifford@clifford.at> | 2018-10-19 13:05:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-19 13:05:51 +0200 |
commit | 2e32d05eabd1cf809fc01508be1951edad0680bf (patch) | |
tree | 4d9ff9f35e8601deab89f31ef2a69405e8d6eb68 | |
parent | 2a104b29fd7e504bdedb27c286cf9125d46dfd55 (diff) | |
parent | c7770d9eeaf9fba0c9d07e7cce020fe89ec71600 (diff) | |
download | yosys-2e32d05eabd1cf809fc01508be1951edad0680bf.tar.gz yosys-2e32d05eabd1cf809fc01508be1951edad0680bf.tar.bz2 yosys-2e32d05eabd1cf809fc01508be1951edad0680bf.zip |
Merge pull request #671 from rafaeltp/master
adding offset info to memories on verilog output
-rw-r--r-- | backends/verilog/verilog_backend.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/backends/verilog/verilog_backend.cc b/backends/verilog/verilog_backend.cc index ae9031510..dde03f920 100644 --- a/backends/verilog/verilog_backend.cc +++ b/backends/verilog/verilog_backend.cc @@ -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) { 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) @@ -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()); int abits = cell->parameters["\\ABITS"].as_int(); int size = cell->parameters["\\SIZE"].as_int(); + int offset = cell->parameters["\\OFFSET"].as_int(); int width = cell->parameters["\\WIDTH"].as_int(); 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 // memid[0] = ... // 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) { f << stringf("%s" "initial begin\n", indent.c_str()); |