SILICON
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
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>
30
31namespace SILICON::core {
32using namespace SILICON::extra;
33
34template <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
42{
49
55
61 registerComponent<ROM>(registry);
63
76
79}
80
81} // namespace SILICON::core
void registerType(std::string type, Factory factory)
Concept to check if a type has a Type static member.
void registerComponent(ComponentRegistry &registry)
void registerAllComponents(ComponentRegistry &registry)