orca-sim
SignalSet.hpp
Go to the documentation of this file.
1 /******************************************************************************
2  * This file is part of project ORCA. More information on the project
3  * can be found at the following repositories at GitHub's website.
4  *
5  * http://https://github.com/andersondomingues/orca-sim
6  * http://https://github.com/andersondomingues/orca-software
7  * http://https://github.com/andersondomingues/orca-mpsoc
8  * http://https://github.com/andersondomingues/orca-tools
9  *
10  * Copyright (C) 2018-2020 Anderson Domingues, <ti.andersondomingues@gmail.com>
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 2 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License along
23  * with this program; if not, write to the Free Software Foundation, Inc.,
24  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 ******************************************************************************/
26 #ifndef ORCASIM_MODELING_INCLUDE_SIGNALSET_HPP_
27 #define ORCASIM_MODELING_INCLUDE_SIGNALSET_HPP_
28 
29 // lib dependent includes
30 #include <stdint.h>
31 #include <iostream>
32 #include <vector>
33 #include <string>
34 
35 // api includes
36 #include "UntimedModel.hpp"
37 #include "MemoryType.hpp"
38 
40 
41 namespace orcasim::modeling {
42 
46 template <typename T>
47 class SignalSet : public UntimedModel {
48  private:
50  uint32_t _num_signals;
51 
56 
60 
62  std::string _t_name;
63 
64  public:
70  SignalSet(std::string name, uint32_t nsig);
71 
77  ~SignalSet();
78 
84  Signal<T>* GetSignal(uint32_t index);
85 
93  void MapTo(MemoryType* mptr, MemoryAddr addr);
94 };
95 
96 // Some of the most used instances. More can be added later.
97 // for larger data size, consider using a Memory instead.
98 template class SignalSet<bool>; // wire
99 template class SignalSet<uint8_t>; // mem word
100 template class SignalSet<uint16_t>; // dmni/noc word
101 template class SignalSet<uint32_t>; // proc word
102 template class SignalSet<uint64_t>; // double word
103 template class SignalSet<int8_t>; // mem word
104 template class SignalSet<int16_t>; // dmni/noc word
105 template class SignalSet<int32_t>; // proc word
106 template class SignalSet<int64_t>; // double word
107 
108 } // namespace orcasim::modeling
109 #endif // ORCASIM_MODELING_INCLUDE_SIGNALSET_HPP_
The Signal class models a generic bus of width equals to the sizeof(T)
Definition: Signal.hpp:45
SignalSet(std::string name, uint32_t nsig)
Constructor.
Definition: SignalSet.cpp:46
std::string _t_name
an optional name to identify this model during runtime
Definition: SignalSet.hpp:62
#define MemoryAddr
Definition: MemoryType.hpp:34
MemoryAddr _mem_addr
memory position of the first signal.
Definition: SignalSet.hpp:54
uint32_t _num_signals
number of signals in the set.
Definition: SignalSet.hpp:50
Untimed models represent hardware models whose clock period is irrelevant for the simulation...
void MapTo(MemoryType *mptr, MemoryAddr addr)
Maps the signal set to a given memory address.
Definition: SignalSet.cpp:64
Signal< T > ** _signals
a pointer to the first signal.
Definition: SignalSet.hpp:59
Signal< T > * GetSignal(uint32_t index)
Get the a signal from the set.
Definition: SignalSet.cpp:83
The SignalSet class models a generic set of busses of type T.
Definition: SignalSet.hpp:47
#define MemoryType
Definition: MemoryType.hpp:33