2 * yosys -- Yosys Open SYnthesis Suite
4 * Copyright (C) 2020 Marcelina KoĆcielnicka <mwk@0x04.net>
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23 #include "kernel/yosys.h"
28 dict
<IdString
, Const
> attributes
;
30 bool clk_enable
, clk_polarity
;
32 SigSpec clk
, en
, addr
, data
;
33 MemRd() : cell(nullptr) {}
37 dict
<IdString
, Const
> attributes
;
39 bool clk_enable
, clk_polarity
;
40 SigSpec clk
, en
, addr
, data
;
41 MemWr() : cell(nullptr) {}
45 dict
<IdString
, Const
> attributes
;
49 MemInit() : cell(nullptr) {}
55 dict
<IdString
, Const
> attributes
;
59 int width
, start_offset
, size
;
60 std::vector
<MemInit
> inits
;
61 std::vector
<MemRd
> rd_ports
;
62 std::vector
<MemWr
> wr_ports
;
66 void remove_wr_port(int idx
);
67 void remove_rd_port(int idx
);
69 Const
get_init_data() const;
70 static std::vector
<Mem
> get_all_memories(Module
*module
);
71 static std::vector
<Mem
> get_selected_memories(Module
*module
);
72 Cell
*extract_rdff(int idx
);
73 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
) {}