56 "interconnection by adding separate RF for each distinct bus width.");
59 wipeRegisterFile_(
false),
60 shortImmediateWidth_(6),
61 longImmediateBusCount_(1) {
62 addParameter(shortImmediateWidthPN_,
INT,
false,
"6",
63 "Short immediate width for each bus.");
64 addParameter(longImmediateBusCountPN_,
INT,
false,
"1",
65 "Number of dummy buses for long immediates. (power-of-2)");
66 addParameter(wipeRegisterFilePN_,
BOOL,
false,
"true",
67 "Generate a VLIW-style register file.");
82 virtual std::vector<RowID>
86 std::vector<RowID> result;
98 std::ostringstream msg(std::ostringstream::out);
100 <<
"Error loading the adf." << std::endl;
110 for (
int i = 0; i < rfNavi.
count(); i++) {
112 if (rf->
width() == 1) {
119 if (wipeRegisterFile_) {
120 for (
int i = 0; i < rfNavi.
count(); i++) {
122 if (rf->
width() != 1) {
132 for (
int i = 0; i < socketNavi.
count(); i++) {
133 if (socketNavi.
item(i)->portCount() == 0 ) {
145 std::vector<int>::iterator iter;
147 for (
int i = 0; i < socketNavi.
count(); i++) {
159 iter = std::find(distinctBusWidths_.begin(),
160 distinctBusWidths_.end(), width);
161 if (iter == distinctBusWidths_.end()) {
162 distinctBusWidths_.push_back(width);
166 sort(distinctBusWidths_.begin(), distinctBusWidths_.end());
167 int numDistinctBusWidths = distinctBusWidths_.size();
170 std::vector<Socket::Direction> directions;
171 std::vector< std::vector<int> > readSockets(numDistinctBusWidths),
172 writeSockets(numDistinctBusWidths),
173 controlSockets(numDistinctBusWidths);
175 for (
int i = 0; i < socketNavi.
count(); i++) {
178 directions.push_back(dir);
183 int widx = widthIndex(width);
186 &&
dynamic_cast<ControlUnit*
>(parentUnit) == NULL) {
188 readSockets[widx].push_back(i);
191 writeSockets[widx].push_back(i);
195 controlSockets[widx].push_back(i);
203 for (
int i = 0; i < busNavi.
count(); i++) {
209 std::vector< std::vector<int> > readBuses(numDistinctBusWidths),
210 writeBuses(numDistinctBusWidths);
213 for (
int widx = 0; widx < numDistinctBusWidths; ++widx) {
214 int width = distinctBusWidths_[widx];
219 for (
unsigned int i = 0; i < controlSockets[widx].size(); i++) {
220 int idx = controlSockets[widx][i];
222 socketNavi.
item(idx)->setDirection(directions[idx]);
224 readBuses[widx].push_back(busCount);
225 writeBuses[widx].push_back(busCount++);
228 for (
unsigned int i = 0; i < readSockets[widx].size(); i++) {
229 int idx = readSockets[widx][i];
232 socketNavi.
item(idx)->setDirection(directions[idx]);
233 readBuses[widx].push_back(busCount++);
236 for (
unsigned int i = 0; i < writeSockets[widx].size(); i++) {
237 int idx = writeSockets[widx][i];
240 socketNavi.
item(idx)->setDirection(directions[idx]);
241 writeBuses[widx].push_back(busCount++);
246 for (
int widx = 0; widx < numDistinctBusWidths; ++widx) {
247 if (readBuses[widx].size() == 0 && writeBuses[widx].size() == 0) {
251 if (wipeRegisterFile_) {
252 int width = distinctBusWidths_[widx];
258 readBuses[widx].size(),
259 writeBuses[widx].size(),
265 for (
unsigned int i = 0; i < readBuses[widx].size(); i++) {
273 busNavi.
item(readBuses[widx][i])->segment(0)->
274 attachSocket(*newSocket);
279 for (
unsigned int i = 0; i < writeBuses[widx].size(); i++) {
287 busNavi.
item(writeBuses[widx][i])->segment(0)->
288 attachSocket(*newSocket);
295 for (
int widx = 0; widx < numDistinctBusWidths; ++widx) {
296 for (
unsigned int i = 0; i < writeSockets[widx].size(); i++) {
297 Socket* output = socketNavi.
item(writeSockets[widx][i]);
298 for (
unsigned int j = 0; j < readBuses[widx].size(); j++) {
299 Bus* readBus = busNavi.
item(readBuses[widx][j]);
305 for (
int i = 0; i < busNavi.
count(); i++) {
315 for (
int i = 0; i < busNavi.
count(); i++) {
339 for (
int i = 0; i < longImmediateBusCount_; i++) {
343 limm->
addSlot(newBus->
name(), 32/longImmediateBusCount_, *immu);
352 result.push_back(confID);
372 readOptionalParameter(wipeRegisterFilePN_, wipeRegisterFile_);
373 readOptionalParameter(shortImmediateWidthPN_, shortImmediateWidth_);
374 readOptionalParameter(longImmediateBusCountPN_, longImmediateBusCount_);
407 for (
auto const& busW : distinctBusWidths_) {