|
5 | 5 |
|
6 | 6 | #include <array> |
7 | 7 | #include <functional> |
| 8 | +#include <map> |
8 | 9 | #include <memory> |
9 | 10 | #include <string> |
10 | 11 | #include <utility> |
@@ -50,6 +51,29 @@ class TritonRoute; |
50 | 51 |
|
51 | 52 | namespace ram { |
52 | 53 |
|
| 54 | +enum class PortRoleType |
| 55 | +{ |
| 56 | + Clock, |
| 57 | + DataIn, |
| 58 | + DataOut, |
| 59 | + WriteEnable, |
| 60 | + TriEnable, |
| 61 | + Select, // for mux support in future |
| 62 | + Power, |
| 63 | + Ground |
| 64 | +}; |
| 65 | + |
| 66 | +struct PortRole |
| 67 | +{ |
| 68 | + PortRoleType type; |
| 69 | + int index; |
| 70 | + |
| 71 | +// for map so that keys are comparable |
| 72 | +#ifndef SWIG |
| 73 | + auto operator<=>(const PortRole&) const = default; |
| 74 | +#endif |
| 75 | +}; |
| 76 | + |
53 | 77 | class RamGen |
54 | 78 | { |
55 | 79 | public: |
@@ -96,15 +120,10 @@ class RamGen |
96 | 120 |
|
97 | 121 | private: |
98 | 122 | void findMasters(); |
| 123 | + std::map<PortRole, std::string> buildPortMap(odb::dbMaster*); |
99 | 124 | odb::dbMaster* findMaster(const std::function<bool(sta::LibertyPort*)>& match, |
100 | 125 | const char* name); |
101 | 126 | odb::dbNet* makeNet(const std::string& prefix, const std::string& name); |
102 | | - odb::dbInst* makeInst( |
103 | | - Layout* layout, |
104 | | - const std::string& prefix, |
105 | | - const std::string& name, |
106 | | - odb::dbMaster* master, |
107 | | - const std::vector<std::pair<std::string, odb::dbNet*>>& connections); |
108 | 127 | odb::dbInst* makeInst( |
109 | 128 | Cell* cell, |
110 | 129 | const std::string& prefix, |
@@ -168,6 +187,13 @@ class RamGen |
168 | 187 | odb::dbMaster* buffer_cell_{nullptr}; |
169 | 188 | odb::dbMaster* tapcell_{nullptr}; |
170 | 189 |
|
| 190 | + std::map<PortRole, std::string> storage_ports_; |
| 191 | + std::map<PortRole, std::string> tristate_ports_; |
| 192 | + std::map<PortRole, std::string> inv_ports_; |
| 193 | + std::map<PortRole, std::string> and2_ports_; |
| 194 | + std::map<PortRole, std::string> clock_gate_ports_; |
| 195 | + std::map<PortRole, std::string> buffer_ports_; |
| 196 | + |
171 | 197 | std::vector<odb::dbBTerm*> addr_inputs_; |
172 | 198 | std::vector<odb::dbBTerm*> data_inputs_; |
173 | 199 | std::vector<std::vector<odb::dbBTerm*>> q_outputs_; |
|
0 commit comments