HAL
netlist_internal_manager.h
Go to the documentation of this file.
1
// MIT License
2
//
3
// Copyright (c) 2019 Ruhr University Bochum, Chair for Embedded Security. All Rights reserved.
4
// Copyright (c) 2019 Marc Fyrbiak, Sebastian Wallat, Max Hoffmann ("ORIGINAL AUTHORS"). All rights reserved.
5
// Copyright (c) 2021 Max Planck Institute for Security and Privacy. All Rights reserved.
6
// Copyright (c) 2021 Jörn Langheinrich, Julian Speith, Nils Albartus, René Walendy, Simon Klix ("ORIGINAL AUTHORS"). All Rights reserved.
7
//
8
// Permission is hereby granted, free of charge, to any person obtaining a copy
9
// of this software and associated documentation files (the "Software"), to deal
10
// in the Software without restriction, including without limitation the rights
11
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
// copies of the Software, and to permit persons to whom the Software is
13
// furnished to do so, subject to the following conditions:
14
//
15
// The above copyright notice and this permission notice shall be included in all
16
// copies or substantial portions of the Software.
17
//
18
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
// SOFTWARE.
25
26
#pragma once
27
28
#include "
hal_core/defines.h
"
29
#include "
hal_core/netlist/event_system/event_handler.h
"
30
#include "
hal_core/netlist/pins/gate_pin.h
"
31
32
#include <map>
33
#include <vector>
34
35
namespace
hal
36
{
37
// forward declaration
38
class
Netlist;
39
class
Gate
;
40
class
GateType;
41
class
Net
;
42
class
Module
;
43
class
Endpoint;
44
class
Grouping;
45
class
BooleanFunction;
46
50
class
NETLIST_API
NetlistInternalManager
51
{
52
friend
class
Netlist
;
53
friend
class
Module
;
54
friend
class
Net
;
55
friend
class
Gate
;
56
friend
class
Grouping
;
57
58
private
:
59
Netlist
* m_netlist;
60
EventHandler
* m_event_handler;
61
62
explicit
NetlistInternalManager
(
Netlist
* nl,
EventHandler
* eh);
63
~
NetlistInternalManager
() =
default
;
64
65
// netlist functions
66
Result<std::unique_ptr<Netlist>
>
copy_netlist
(
const
Netlist
* nl)
const
;
67
68
// gate functions
69
Gate
* create_gate(
u32
id
,
GateType
* gt,
const
std::string&
name
,
i32
x,
i32
y);
70
bool
delete_gate(
Gate
* gate);
71
bool
is_gate_type_invalid(
GateType
* gt)
const
;
72
73
// net functions
74
Net
* create_net(
u32
id
,
const
std::string&
name
);
75
bool
delete_net(
Net
*
net
);
76
Endpoint
* net_add_source(
Net
*
net
,
Gate
* gate,
GatePin
* pin);
77
bool
net_remove_source(
Net
*
net
,
Endpoint
* ep);
78
Endpoint
* net_add_destination(
Net
*
net
,
Gate
* gate,
GatePin
* pin);
79
bool
net_remove_destination(
Net
*
net
,
Endpoint
* ep);
80
81
// module functions
82
Module
* create_module(
u32
id
,
Module
* parent,
const
std::string&
name
);
83
bool
delete_module(
Module
*
module
);
84
bool
module_assign_gate(
Module
* m,
Gate
*
g
);
85
bool
module_assign_gates(
Module
*
module
,
const
std::vector<Gate*>& gates);
86
bool
module_check_net(
Module
*
module
,
Net
*
net
,
bool
recursive =
false
);
87
88
// grouping functions
89
Grouping
* create_grouping(
u32
id
,
const
std::string
name
);
90
bool
delete_grouping(
Grouping
* grouping);
91
bool
grouping_assign_gate(
Grouping
* grouping,
Gate
* gate,
bool
force =
false
);
92
bool
grouping_remove_gate(
Grouping
* grouping,
Gate
* gate);
93
bool
grouping_assign_net(
Grouping
* grouping,
Net
*
net
,
bool
force =
false
);
94
bool
grouping_remove_net(
Grouping
* grouping,
Net
*
net
);
95
bool
grouping_assign_module(
Grouping
* grouping,
Module
*
module
,
bool
force =
false
);
96
bool
grouping_remove_module(
Grouping
* grouping,
Module
*
module
);
97
98
// caches
99
void
clear_caches();
100
mutable
std::map<std::pair<std::vector<GatePin*>,
u64
>,
BooleanFunction
> m_lut_function_cache;
101
bool
m_net_checks_enabled =
true
;
102
};
103
}
// namespace hal
NETLIST_API
#define NETLIST_API
Definition:
arch_linux.h:30
hal::BooleanFunction
Definition:
boolean_function.h:55
hal::Endpoint
Definition:
endpoint.h:43
hal::EventHandler
Definition:
event_handler.h:146
hal::Gate
Definition:
gate.h:58
hal::GatePin
Definition:
gate_pin.h:45
hal::GateType
Definition:
gate_type.h:52
hal::Grouping
Definition:
grouping.h:51
hal::Module
Definition:
module.h:66
hal::Net
Definition:
net.h:58
hal::Netlist
Definition:
netlist.h:56
hal::NetlistInternalManager
Definition:
netlist_internal_manager.h:51
hal::Result
Definition:
result.h:64
defines.h
u64
uint64_t u64
Definition:
defines.h:42
i32
int32_t i32
Definition:
defines.h:36
event_handler.h
gate_pin.h
hal::ItemType::Net
@ Net
hal::ItemType::Gate
@ Gate
hal::ItemType::Module
@ Module
hal::ShortestPath::module
const Module * module(const Gate *g, const NodeBoxes &boxes)
Definition:
graph_graphics_view.cpp:741
hal::netlist_utils::copy_netlist
std::unique_ptr< Netlist > copy_netlist(const Netlist *nl)
Definition:
netlist_utils.cpp:95
hal
Definition:
parser_liberty.cpp:10
test_plugin.g
g
Definition:
test_plugin.py:32
u32
quint32 u32
Definition:
net_layout_point.h:40
net
Net * net
Definition:
netlist_serializer.cpp:57
name
std::string name
Definition:
netlist_serializer.cpp:58
include
hal_core
netlist
netlist_internal_manager.h
Generated on Fri Feb 14 2025 14:22:41 for HAL by
1.9.1