OpenASIP 2.2
Loading...
Searching...
No Matches
Stratix2SramGenerator.cc
Go to the documentation of this file.
1/*
2 Copyright (c) 2002-2010 Tampere University.
3
4 This file is part of TTA-Based Codesign Environment (TCE).
5
6 Permission is hereby granted, free of charge, to any person obtaining a
7 copy of this software and associated documentation files (the "Software"),
8 to deal in the Software without restriction, including without limitation
9 the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 and/or sell copies of the Software, and to permit persons to whom the
11 Software is furnished to do so, subject to the following conditions:
12
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 DEALINGS IN THE SOFTWARE.
23 */
24/**
25 * @file Stratix2SramGenerator.cc
26 *
27 * Implementation of Stratix2SramGenerator class.
28 *
29 * @author Otto Esko 2010 (otto.esko-no.spam-tut.fi)
30 * @note rating: red
31 */
32
33#include <iostream>
34#include <vector>
35#include "StringTools.hh"
36#include "PlatformIntegrator.hh"
37#include "MemoryGenerator.hh"
39#include "Netlist.hh"
40#include "NetlistBlock.hh"
41#include "NetlistPort.hh"
42#include "HDLPort.hh"
43using std::vector;
44using std::endl;
47
49 int memMauWidth,
50 int widthInMaus,
51 int addrWidth,
52 TCEString initFile,
53 const PlatformIntegrator* integrator,
54 std::ostream& warningStream,
55 std::ostream& errorStream) :
56 MemoryGenerator(memMauWidth, widthInMaus, addrWidth, initFile,
57 integrator, warningStream, errorStream) {
58
59 ProGe::Parameter dataw("sram_dataw", "integer", "32");
60 ProGe::Parameter addrw("sram_addrw", "integer", "18");
61 addParameter(dataw);
62 addParameter(addrw);
63 addPort("STRATIXII_SRAM_DQ",
64 new HDLPort("STRATIXII_SRAM_DQ", "sram_dataw", ProGe::BIT_VECTOR,
65 ProGe::BIDIR, false, 32));
66 addPort("STRATIXII_SRAM_ADDR",
67 new HDLPort("STRATIXII_SRAM_ADDR", "sram_addrw",
68 ProGe::BIT_VECTOR, ProGe::OUT, false, 18));
69 addPort("STRATIXII_SRAM_WE_N",
70 new HDLPort("STRATIXII_SRAM_WE_N", "1", ProGe::BIT_VECTOR,
71 ProGe::OUT, false, 1));
72 addPort("STRATIXII_SRAM_OE_N",
73 new HDLPort("STRATIXII_SRAM_OE_N", "1", ProGe::BIT_VECTOR,
74 ProGe::OUT, false, 1));
75 addPort("STRATIXII_SRAM_CS_N",
76 new HDLPort("STRATIXII_SRAM_CS_N", "1", ProGe::BIT_VECTOR,
77 ProGe::OUT, false, 1));
78 addPort("STRATIXII_SRAM_BE_N0",
79 new HDLPort("STRATIXII_SRAM_BE_N0", "1", ProGe::BIT_VECTOR,
80 ProGe::OUT, false, 1));
81 addPort("STRATIXII_SRAM_BE_N1",
82 new HDLPort("STRATIXII_SRAM_BE_N1", "1", ProGe::BIT_VECTOR,
83 ProGe::OUT, false, 1));
84 addPort("STRATIXII_SRAM_BE_N2",
85 new HDLPort("STRATIXII_SRAM_BE_N2", "1", ProGe::BIT_VECTOR,
86 ProGe::OUT, false, 1));
87 addPort("STRATIXII_SRAM_BE_N3",
88 new HDLPort("STRATIXII_SRAM_BE_N3", "1", ProGe::BIT_VECTOR,
89 ProGe::OUT, false, 1));
90}
91
92
95
96
97void
99 const ProGe::NetlistBlock& ttaCore,
100 ProGe::NetlistBlock& integratorBlock,
101 int /*memIndex*/,
102 int coreId) {
103
104 for (int i = 0; i < parameterCount(); i++) {
105 integratorBlock.setParameter(
106 parameter(i).name(),
107 parameter(i).type(),
108 parameter(i).value());
109 }
110
111 for (int i = 0; i < portCount(); i++) {
112 const HDLPort* hdlPort = port(i);
113 NetlistPort* memPort = hdlPort->convertToNetlistPort(integratorBlock);
114
116 const NetlistPort* corePort = ttaCore.port(corePortName);
117 assert(corePort != NULL);
118
120 integratorBlock, *memPort, *corePort,
121 hdlPort->needsInversion(), coreId);
122 }
123
124}
125
126bool
128
129 // Sram controller is integrated into the lsu itself
130 // No need to generate separate file
131 return false;
132}
133
134std::vector<TCEString>
136
137 vector<TCEString> noFileToGenerate;
138 return noFileToGenerate;
139}
140
141
144
145 return "stratixII_sram_comp";
146}
147
148
150Stratix2SramGenerator::instanceName(int coreId, int memIndex) const {
151
152 TCEString iname("stratixII_sram_");
153 return iname << memoryIndexString(coreId, memIndex);
154}
#define assert(condition)
ProGe::NetlistPort * convertToNetlistPort(ProGe::NetlistBlock &block) const
Definition HDLPort.cc:127
bool needsInversion() const
Definition HDLPort.cc:122
TCEString memoryIndexString(int coreId, int memIndex) const
TCEString portKeyName(const HDLPort *port) const
const ProGe::Parameter & parameter(int index) const
const HDLPort * port(int index) const
void addParameter(const ProGe::Parameter &add)
void addPort(const TCEString &name, HDLPort *port)
int parameterCount() const
virtual void connectPorts(ProGe::NetlistBlock &netlistBlock, const ProGe::NetlistPort &memPort, const ProGe::NetlistPort &corePort, bool inverted, int coreId)
TCEString corePortName(const TCEString &portBaseName, int coreId) const
int portCount() const
void setParameter(const std::string &name, const std::string &type, const std::string &value)
virtual NetlistPort * port(const std::string &portName, bool partialMatch=true)
const TCEString & value() const
Definition Parameter.cc:143
const TCEString & type() const
Definition Parameter.cc:138
const TCEString & name() const
Definition Parameter.cc:133
Stratix2SramGenerator(int memMauWidth, int widthInMaus, int addrWidth, TCEString initFile, const PlatformIntegrator *integrator, std::ostream &warningStream, std::ostream &errorStream)
virtual bool generatesComponentHdlFile() const
virtual std::vector< TCEString > generateComponentFile(TCEString outputPath)
virtual TCEString instanceName(int coreId, int memIndex) const
virtual void addMemory(const ProGe::NetlistBlock &ttaCore, ProGe::NetlistBlock &integratorBlock, int memIndex, int coreId)
virtual TCEString moduleName() const
@ BIT_VECTOR
Several bits.
Definition ProGeTypes.hh:48
@ OUT
Output port.
Definition ProGeTypes.hh:54
@ BIDIR
Bidirectional port.
Definition ProGeTypes.hh:55