OpenASIP  2.0
SinglePortByteMaskSSRAMBlock.cc
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2015 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 SinglePortByteMaskSSRAMBlock.cc
26  *
27  * Implementation of SinglePortByteMaskSSRAMBlock class.
28  *
29  * Created on: 8.9.2015
30  * @author Henry Linjam�ki 2015 (henry.linjamaki-no.spam-tut.fi)
31  * @note rating: red
32  */
33 
35 
36 #include "NetlistPort.hh"
37 #include "NetlistPortGroup.hh"
38 #include "Parameter.hh"
39 #include "NetlistFactories.hh"
41 
42 #include "FileSystem.hh"
43 
44 namespace ProGe {
45 
46 /**
47  * Constructs Single port synchronous SRAM block.
48  *
49  * @param addressWidth The width of the address port.
50  * @param dataWidth The width of the data port.
51  * @param memInitFile Name of the memory initialization file loaded during
52  * RTL-simulation.
53  * @param isForSimulation Tells if the block is used in RTL simulation.
54  * Affects placement of the HDL source.
55  */
57  const std::string& addressWidth, const std::string& dataWidth,
58  const std::string& memInitFile, bool isForSimulation)
59  : BaseNetlistBlock("synch_byte_mask_sram", ""),
60  isForSimulation_(isForSimulation) {
61  addParameter(Parameter("DATAW", "integer", dataWidth));
62  addParameter(Parameter("ADDRW", "integer", addressWidth));
63  addParameter(Parameter("INITFILENAME", "string", memInitFile));
64  addParameter(Parameter("access_trace", "boolean", "false"));
66  Parameter("ACCESSTRACEFILENAME", "string", "\"access_trace\""));
67 
69 
70  // todo add memory ports via PortFactory
74  new InBitPort(
76  new OutBitPort(
78  new InPort("aaddr", "ADDRW", BIT_VECTOR, SignalType::AADDR),
79  new InBitPort(
81  new InPort(
82  "astrb", dataWidth + "/8", BIT_VECTOR, SignalType::ASTRB),
83  new InBitPort(
85  new OutPort("rdata", "DATAW", BIT_VECTOR, SignalType::RDATA),
86  new InPort("adata", "DATAW", BIT_VECTOR, SignalType::ADATA),
87  new OutBitPort(
89 }
90 
92 
93 /**
94  * Sets a file name where memory access trace is dumped for this memory.
95  */
96 void
98  this->setParameter(Parameter("access_trace", "boolean", "true"));
99  this->setParameter(Parameter("ACCESSTRACEFILENAME", "string", filename));
100 }
101 
102 const NetlistPortGroup&
104  assert(memoryPortGroup_ != nullptr);
105  return *memoryPortGroup_;
106 }
107 
108 void
110  const Path& targetBaseDir, HDL targetLang) const {
111  Path progeDataDir(Environment::dataDirPath("ProGe"));
112 
113  assert(targetLang == VHDL);
114 
115  std::string tempFile = std::string("synch_byte_mask_sram.vhdl");
116  std::string targetDir =
117  (isForSimulation_) ? std::string("tb")
118  : ((targetLang == VHDL) ? std::string("vhdl")
119  : std::string("verilog"));
121  (progeDataDir / "tb" / tempFile).string(),
122  (targetBaseDir / targetDir / tempFile).string());
123 }
124 
125 } /* namespace ProGe */
ProGe::BaseNetlistBlock::addPort
NetlistPort * addPort(NetlistPort *port)
Definition: BaseNetlistBlock.cc:467
ProGe::BaseNetlistBlock
Definition: BaseNetlistBlock.hh:59
Path
Definition: FileSystem.hh:197
ProGe::SignalType::AVALID
@ AVALID
Signal types for memory interface with separate valid/ready in address/data.
ProGe::BaseNetlistBlock::NetlistPortGroup
friend class NetlistPortGroup
Definition: BaseNetlistBlock.hh:62
FileSystem.hh
NetlistFactories.hh
ProGe::SignalGroupType::BYTEMASKED_SRAM_PORT
@ BYTEMASKED_SRAM_PORT
Signal group type for one port SRAM having read and write capability and bitmask for writing with sep...
HDLTemplateInstantiator
Definition: HDLTemplateInstantiator.hh:45
ProGe::BIT_VECTOR
@ BIT_VECTOR
Several bits.
Definition: ProGeTypes.hh:48
ProGe::SignalType::RVALID
@ RVALID
ProGe::BaseNetlistBlock::setParameter
void setParameter(const Parameter &param)
Definition: BaseNetlistBlock.cc:532
ProGe::OutBitPort
Convenience class for output bit ports.
Definition: NetlistPort.hh:181
ProGe::SignalType::ASTRB
@ ASTRB
ProGe::BaseNetlistBlock::addParameter
void addParameter(const Parameter &param)
Definition: BaseNetlistBlock.cc:547
HDLTemplateInstantiator.hh
ProGe::ActiveState::HIGH
@ HIGH
ProGe::BaseNetlistBlock::Parameter
friend class Parameter
Definition: BaseNetlistBlock.hh:63
ProGe::SignalType::AREADY
@ AREADY
NetlistPortGroup.hh
assert
#define assert(condition)
Definition: Application.hh:86
ProGe::BaseNetlistBlock::addPortGroup
void addPortGroup(NetlistPortGroup *portGroup)
Definition: BaseNetlistBlock.cc:508
ProGe::NetlistPortGroup
Definition: NetlistPortGroup.hh:53
ProGe::VHDL
@ VHDL
VHDL.
Definition: ProGeTypes.hh:41
ProGe::InPort
Convenience class for input ports.
Definition: NetlistPort.hh:193
NetlistPort.hh
ProGe::SignalType::AADDR
@ AADDR
ProGe::SinglePortByteMaskSSRAMBlock::memoryPort
const NetlistPortGroup & memoryPort() const
Definition: SinglePortByteMaskSSRAMBlock.cc:103
ProGe::SinglePortByteMaskSSRAMBlock::SinglePortByteMaskSSRAMBlock
SinglePortByteMaskSSRAMBlock()=delete
ProGe::SignalType::RDATA
@ RDATA
SinglePortByteMaskSSRAMBlock.hh
ProGe::PortFactory::clockPort
static NetlistPort * clockPort(Direction direction=IN)
Definition: NetlistFactories.cc:200
ProGe::SignalType::ADATA
@ ADATA
ProGe::SinglePortByteMaskSSRAMBlock::setAccessTraceFile
void setAccessTraceFile(const std::string filename)
Definition: SinglePortByteMaskSSRAMBlock.cc:97
ProGe::SinglePortByteMaskSSRAMBlock::isForSimulation_
bool isForSimulation_
Definition: SinglePortByteMaskSSRAMBlock.hh:66
ProGe
Definition: FUGen.hh:54
ProGe::SignalType::AWREN
@ AWREN
ProGe::HDL
HDL
HDLs supported by ProGe.
Definition: ProGeTypes.hh:40
ProGe::SinglePortByteMaskSSRAMBlock::memoryPortGroup_
NetlistPortGroup * memoryPortGroup_
Definition: SinglePortByteMaskSSRAMBlock.hh:64
ProGe::SinglePortByteMaskSSRAMBlock::write
virtual void write(const Path &targetBaseDir, HDL targetLang=VHDL) const override
Definition: SinglePortByteMaskSSRAMBlock.cc:109
HDLTemplateInstantiator::instantiateTemplateFile
void instantiateTemplateFile(const std::string &templateFile, const std::string &dstFile)
Definition: HDLTemplateInstantiator.cc:113
ProGe::Signal
Definition: Signal.hh:46
ProGe::InBitPort
Convenience class for input bit ports.
Definition: NetlistPort.hh:216
ProGe::OutPort
Convenience class for output ports.
Definition: NetlistPort.hh:158
Parameter.hh
Environment::dataDirPath
static std::string dataDirPath(const std::string &prog)
Definition: Environment.cc:176
ProGe::SignalType::RREADY
@ RREADY
ProGe::SinglePortByteMaskSSRAMBlock::~SinglePortByteMaskSSRAMBlock
virtual ~SinglePortByteMaskSSRAMBlock()
Definition: SinglePortByteMaskSSRAMBlock.cc:91