Skip to content

Commit 90a90f2

Browse files
authored
Merge pull request #9991 from braydenlouie/pdk-support
ram: Cross platform testing and support
2 parents 2849539 + 5b53d5a commit 90a90f2

15 files changed

Lines changed: 2504 additions & 57 deletions

src/ram/include/ram/ram.h

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
#include <array>
77
#include <functional>
8+
#include <map>
89
#include <memory>
910
#include <string>
1011
#include <utility>
@@ -50,6 +51,29 @@ class TritonRoute;
5051

5152
namespace ram {
5253

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+
5377
class RamGen
5478
{
5579
public:
@@ -96,15 +120,10 @@ class RamGen
96120

97121
private:
98122
void findMasters();
123+
std::map<PortRole, std::string> buildPortMap(odb::dbMaster*);
99124
odb::dbMaster* findMaster(const std::function<bool(sta::LibertyPort*)>& match,
100125
const char* name);
101126
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);
108127
odb::dbInst* makeInst(
109128
Cell* cell,
110129
const std::string& prefix,
@@ -168,6 +187,13 @@ class RamGen
168187
odb::dbMaster* buffer_cell_{nullptr};
169188
odb::dbMaster* tapcell_{nullptr};
170189

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+
171197
std::vector<odb::dbBTerm*> addr_inputs_;
172198
std::vector<odb::dbBTerm*> data_inputs_;
173199
std::vector<std::vector<odb::dbBTerm*>> q_outputs_;

0 commit comments

Comments
 (0)