OpenASIP  2.0
BlocksFU.cc
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2021 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 BlocksFU.cc
26  *
27  * Implementation of the virtual BlocksFU Class.
28  * This class is the parent class of ALU, LSU & MUL units.
29  *
30  * @author Maarten Molendijk 2020 (m.j.molendijk@tue.nl)
31  * @author Kanishkan Vadivel 2021 (k.vadivel@tue.nl)
32  */
33 
34 #include "BlocksFU.hh"
35 
36 #include "Segment.hh"
37 
38 using namespace TTAMachine;
39 
40 /**
41  * This constructor should not be called directly.
42  */
44  TTAMachine::Machine& mach, const std::string& name,
45  std::list<std::string> sources,
46  std::shared_ptr<TTAMachine::Socket> in1sock,
47  std::shared_ptr<TTAMachine::Socket> in2sock)
48  : in1sock(in1sock), in2sock(in2sock) {
49  // Function unit and ports
50  fu = new FunctionUnit(name);
51  this->name = name;
52  this->sources = sources;
53 
54  // output port suffix
55  std::string outputSuffix = name.substr(name.find("_") + 1);
56 
57  in1 = new FUPort("in1t", 32, *fu, true, true, true);
58  in2 = new FUPort("in2", 32, *fu, false, false, true);
59  out = new FUPort(outputSuffix, 32, *fu, false, false, false);
60 
61  // Add to machine
62  mach.addFunctionUnit(*(this->fu));
63 
64  // Create output socket
65  outsock = new Socket(name);
66  mach.addSocket(*outsock);
67  in1->attachSocket(*(in1sock.get()));
68  in2->attachSocket(*(in2sock.get()));
70 }
BlocksFU::in1
TTAMachine::FUPort * in1
Definition: BlocksFU.hh:61
BlocksFU::fu
TTAMachine::FunctionUnit * fu
Definition: BlocksFU.hh:60
BlocksFU.hh
TTAMachine::FunctionUnit
Definition: FunctionUnit.hh:55
TTAMachine::Port::attachSocket
virtual void attachSocket(Socket &socket)
Definition: Port.cc:191
TTAMachine::FUPort
Definition: FUPort.hh:46
BlocksFU::in2sock
std::shared_ptr< TTAMachine::Socket > in2sock
Definition: BlocksFU.hh:65
Segment.hh
BlocksFU::out
TTAMachine::FUPort * out
Definition: BlocksFU.hh:63
TTAMachine::Socket
Definition: Socket.hh:53
BlocksFU::sources
std::list< std::string > sources
Definition: BlocksFU.hh:67
BlocksFU::BlocksFU
BlocksFU(TTAMachine::Machine &mach, const std::string &name, std::list< std::string > sources, std::shared_ptr< TTAMachine::Socket > in1sock, std::shared_ptr< TTAMachine::Socket > in2sock)
Definition: BlocksFU.cc:43
TTAMachine::Machine::addFunctionUnit
virtual void addFunctionUnit(FunctionUnit &unit)
Definition: Machine.cc:202
BlocksFU::name
std::string name
Definition: BlocksFU.hh:68
BlocksFU::in2
TTAMachine::FUPort * in2
Definition: BlocksFU.hh:62
BlocksFU::outsock
TTAMachine::Socket * outsock
Definition: BlocksFU.hh:66
TTAMachine
Definition: Assembler.hh:48
TTAMachine::Machine::addSocket
virtual void addSocket(Socket &socket)
Definition: Machine.cc:157
TTAMachine::Machine
Definition: Machine.hh:73
BlocksFU::in1sock
std::shared_ptr< TTAMachine::Socket > in1sock
Definition: BlocksFU.hh:64