3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-06-06 14:13:23 +00:00

kernel/mem: Add read-first semantic emulation code.

This commit is contained in:
Marcelina Kościelnicka 2022-01-27 23:26:56 +01:00
parent 9a2294f285
commit bac750fb99
2 changed files with 116 additions and 0 deletions

View file

@ -74,6 +74,9 @@ struct MemWr : RTLIL::AttrObject {
res[i] = State(sub >> i & 1);
return res;
}
std::pair<SigSpec, std::vector<int>> compress_en();
SigSpec decompress_en(const std::vector<int> &swizzle, SigSpec sig);
};
struct MemInit : RTLIL::AttrObject {
@ -209,6 +212,15 @@ struct Mem : RTLIL::AttrObject {
// emulation logic.
void emulate_rd_srst_over_ce(int idx);
// Returns true iff emulate_read_first makes sense to call.
bool emulate_read_first_ok();
// Emulates all read-first read-write port relationships in terms of
// all-transparent ports, by delaying all write ports by one cycle.
// This can only be used when all read ports and all write ports are
// in the same clock domain.
void emulate_read_first(FfInitVals *initvals);
Mem(Module *module, IdString memid, int width, int start_offset, int size) : module(module), memid(memid), packed(false), mem(nullptr), cell(nullptr), width(width), start_offset(start_offset), size(size) {}
};