SILICON
Toggle main menu visibility
Loading...
Searching...
No Matches
component_registration.cpp
Go to the documentation of this file.
1
/*
2
Copyright (c) 2026. Giulio Cocconi
3
4
This program is free software: you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation, either version 3 of the License, or
7
(at your option) any later version.
8
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
13
14
You should have received a copy of the GNU General Public License
15
along with this program. If not, see <http://www.gnu.org/licenses/>.
16
*/
17
18
#include <
core/serialization/component_registry.hpp
>
19
20
#include <
core/component.hpp
>
21
#include <
core/flipflops.hpp
>
22
#include <
core/gates.hpp
>
23
#include <
core/io.hpp
>
24
#include <
core/memory.hpp
>
25
#include <
core/register.hpp
>
26
#include <
core/subcircuit.hpp
>
27
#include <
extraComponents/arithmetic.hpp
>
28
#include <
extraComponents/multiplexer.hpp
>
29
#include <
extraComponents/utils.hpp
>
30
31
namespace
SILICON::core
{
32
using namespace
SILICON::extra;
33
34
template
<
typename
T>
inline
void
registerComponent
(
ComponentRegistry
& registry)
35
{
36
static_assert
(
HasType<T>
,
37
"T must have a static constexpr std::string_view Type member"
);
38
registry.
registerType
(std::string(T::Type), [] {
return
std::make_shared<T>(); });
39
}
40
41
void
registerAllComponents
(
ComponentRegistry
& registry)
42
{
43
registerComponent<AndGate>
(registry);
44
registerComponent<OrGate>
(registry);
45
registerComponent<NotGate>
(registry);
46
registerComponent<NandGate>
(registry);
47
registerComponent<NorGate>
(registry);
48
registerComponent<XorGate>
(registry);
49
50
registerComponent<ConstantComponent>
(registry);
51
registerComponent<DummyInputComponent>
(registry);
52
registerComponent<DummyBusInputComponent>
(registry);
53
registerComponent<DummyOutputComponent>
(registry);
54
registerComponent<DummyBusOutputComponent>
(registry);
55
56
registerComponent<DFlipFlop>
(registry);
57
registerComponent<EFlipFlop>
(registry);
58
registerComponent<DLatch>
(registry);
59
registerComponent<JKFlipFlop>
(registry);
60
registerComponent<Register>
(registry);
61
registerComponent<ROM>
(registry);
62
registerComponent<SubcircuitComponent>
(registry);
63
64
registerComponent<Extender>
(registry);
65
registerComponent<Complementer>
(registry);
66
registerComponent<HalfAdder>
(registry);
67
registerComponent<FullAdder>
(registry);
68
registerComponent<AdderNBits>
(registry);
69
registerComponent<Shifter>
(registry);
70
registerComponent<Multiplier>
(registry);
71
registerComponent<Divider>
(registry);
72
registerComponent<Comparator>
(registry);
73
registerComponent<Multiplexer>
(registry);
74
registerComponent<Demultiplexer>
(registry);
75
registerComponent<Decoder>
(registry);
76
77
registerComponent<WireSplitter>
(registry);
78
registerComponent<WireMerger>
(registry);
79
}
80
81
}
// namespace SILICON::core
arithmetic.hpp
SILICON::core::ComponentRegistry
Definition
component_registry.hpp:35
SILICON::core::ComponentRegistry::registerType
void registerType(std::string type, Factory factory)
Definition
component_registry.cpp:49
component.hpp
component_registry.hpp
SILICON::core::HasType
Concept to check if a type has a Type static member.
Definition
component.hpp:133
utils.hpp
flipflops.hpp
gates.hpp
io.hpp
memory.hpp
multiplexer.hpp
SILICON::core
Definition
activeKeyGuard.hpp:28
SILICON::core::registerComponent
void registerComponent(ComponentRegistry ®istry)
Definition
component_registration.cpp:34
SILICON::core::registerAllComponents
void registerAllComponents(ComponentRegistry ®istry)
Definition
component_registration.cpp:41
register.hpp
subcircuit.hpp
src
core
serialization
component_registration.cpp
Generated by
1.17.0