OpenASIP 2.2
Loading...
Searching...
No Matches
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
44namespace 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 */
96void
98 this->setParameter(Parameter("access_trace", "boolean", "true"));
99 this->setParameter(Parameter("ACCESSTRACEFILENAME", "string", filename));
100}
101
102const NetlistPortGroup&
107
108void
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 / std::string("tb") / tempFile).string(),
122 (targetBaseDir / targetDir / tempFile).string());
123}
124
125} /* namespace ProGe */
#define assert(condition)
static std::string dataDirPath(const std::string &prog)
void instantiateTemplateFile(const std::string &templateFile, const std::string &dstFile)
NetlistPort * addPort(NetlistPort *port)
void addParameter(const Parameter &param)
void addPortGroup(NetlistPortGroup *portGroup)
void setParameter(const Parameter &param)
Convenience class for input bit ports.
Convenience class for input ports.
Convenience class for output bit ports.
Convenience class for output ports.
static NetlistPort * clockPort(Direction direction=IN)
void setAccessTraceFile(const std::string filename)
virtual void write(const Path &targetBaseDir, HDL targetLang=VHDL) const override
Definition FUGen.hh:54
@ BIT_VECTOR
Several bits.
Definition ProGeTypes.hh:48
@ BYTEMASKED_SRAM_PORT
Signal group type for one port SRAM having read and write capability and bitmask for writing with sep...
@ AVALID
Signal types for memory interface with separate valid/ready in address/data.
HDL
HDLs supported by ProGe.
Definition ProGeTypes.hh:40
@ VHDL
VHDL.
Definition ProGeTypes.hh:41