Skip to content

Commit d18d4c2

Browse files
committed
Merge branch 'master' of github.com:emsec/hal
2 parents 8e68f2c + 18b6260 commit d18d4c2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1484
-770
lines changed

include/hal_core/hal_version.h.in

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,28 +35,28 @@ namespace hal
3535
const std::string version = "@HAL_VERSION_RETURN@";
3636

3737
// Major Version Number
38-
const int major = @HAL_VERSION_MAJOR @;
38+
const int major = @HAL_VERSION_MAJOR@;
3939

4040
// Minor Version Number
41-
const int minor = @HAL_VERSION_MINOR @;
41+
const int minor = @HAL_VERSION_MINOR@;
4242

4343
// Patch Version Number
44-
const int patch = @HAL_VERSION_PATCH @;
44+
const int patch = @HAL_VERSION_PATCH@;
4545

4646
// Tweak Version Number
47-
const int tweak = @HAL_VERSION_TWEAK @;
47+
const int tweak = @HAL_VERSION_TWEAK@;
4848

4949
// Additional number of commits since last assigned version number
50-
const int additional_commits = @HAL_VERSION_ADDITIONAL_COMMITS @;
50+
const int additional_commits = @HAL_VERSION_ADDITIONAL_COMMITS@;
5151

5252
// Git Hash used for the current build
5353
const std::string git_hash = "@HAL_VERSION_HASH@";
5454

5555
// Is it build from a dirty source directory?
56-
const bool is_dirty = @HAL_VERSION_DIRTY @;
56+
const bool is_dirty = @HAL_VERSION_DIRTY@;
5757

5858
// Is the git repository broken on the development machine?
59-
const bool is_broken = @HAL_VERSION_BROKEN @;
59+
const bool is_broken = @HAL_VERSION_BROKEN@;
6060

6161
// Build Timestamp.
6262
const std::string build_timestamp = "@BUILD_TIMESTAMP@";

include/hal_core/netlist/gate.h

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -443,14 +443,31 @@ namespace hal
443443
*/
444444
Endpoint* get_successor(const GatePin* pin) const;
445445

446+
/**
447+
* Get the INIT data of the gate, if available.
448+
* An error is returned in case the gate does not hold any INIT data.
449+
*
450+
* @return The INIT data as a vector on success, an error message otherwise.
451+
*/
452+
Result<std::vector<std::string>> get_init_data() const;
453+
454+
/**
455+
* Set the INIT data of the gate, if available.
456+
* An error is returned in case the gate does not hold any INIT data.
457+
*
458+
* @param[in] init_data - The INIT data as a vector.
459+
* @returns Ok on success, an error message otherwise.
460+
*/
461+
Result<std::monostate> set_init_data(const std::vector<std::string>& init_data);
462+
446463
private:
447464
friend class NetlistInternalManager;
448465
Gate(NetlistInternalManager* mgr, EventHandler* event_handler, u32 id, GateType* gt, const std::string& name, i32 x, i32 y);
449466

450-
Gate(const Gate&) = delete;
451-
Gate(Gate&&) = delete;
467+
Gate(const Gate&) = delete;
468+
Gate(Gate&&) = delete;
452469
Gate& operator=(const Gate&) = delete;
453-
Gate& operator=(Gate&&) = delete;
470+
Gate& operator=(Gate&&) = delete;
454471

455472
BooleanFunction get_lut_function(const GatePin* pin) const;
456473

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
// MIT License
2+
//
3+
// Copyright (c) 2019 Ruhr University Bochum, Chair for Embedded Security. All Rights reserved.
4+
// Copyright (c) 2021 Max Planck Institute for Security and Privacy. All Rights reserved.
5+
//
6+
// Permission is hereby granted, free of charge, to any person obtaining a copy
7+
// of this software and associated documentation files (the "Software"), to deal
8+
// in the Software without restriction, including without limitation the rights
9+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
// copies of the Software, and to permit persons to whom the Software is
11+
// furnished to do so, subject to the following conditions:
12+
//
13+
// The above copyright notice and this permission notice shall be included in all
14+
// 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 THE
19+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
// SOFTWARE.
23+
24+
#pragma once
25+
26+
#include "hal_core/utilities/enums.h"
27+
28+
namespace hal
29+
{
30+
/**
31+
* A set of available properties for a gate type.
32+
*/
33+
enum class GateTypeProperty
34+
{
35+
combinational, /**< Combinational gate type. **/
36+
sequential, /**< Sequential gate type. **/
37+
tristate, /**< Tristate gate type. **/
38+
power, /**< Power gate type. **/
39+
ground, /**< Ground gate type. **/
40+
ff, /**< Flip-flop gate type. **/
41+
latch, /**< Latch gate type. **/
42+
ram, /**< RAM gate type. **/
43+
io, /**< IO gate type. **/
44+
dsp, /**< DSP gate type. **/
45+
pll, /**< PLL gate type. **/
46+
oscillator, /**< Oscillator gate type. **/
47+
scan, /**< Scan gate type. **/
48+
c_buffer, /**< Buffer gate type. **/
49+
c_inverter, /**< Inverter gate type. **/
50+
c_and, /**< AND gate type. **/
51+
c_nand, /**< NAND gate type. **/
52+
c_or, /**< OR gate type. **/
53+
c_nor, /**< NOR gate type. **/
54+
c_xor, /**< XOR gate type. **/
55+
c_xnor, /**< XNOR gate type. **/
56+
c_aoi, /**< AOI gate type. **/
57+
c_oai, /**< OAI gate type. **/
58+
c_mux, /**< MUX gate type. **/
59+
c_carry, /**< Carry gate type. **/
60+
c_half_adder, /**< Half adder gate type. **/
61+
c_full_adder, /**< Full adder gate type. **/
62+
c_lut /**< LUT gate type. **/
63+
};
64+
65+
template<>
66+
std::map<GateTypeProperty, std::string> EnumStrings<GateTypeProperty>::data;
67+
} // namespace hal

include/hal_core/netlist/gate_library/enums/pin_type.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ namespace hal
4747
data, /**< Data pin. **/
4848
address, /**< Address pin. **/
4949
io_pad, /**< IO pad pin. **/
50-
select /**< Select pin. **/
50+
select, /**< Select pin. **/
51+
carry, /**< Carry pin. **/
52+
sum /**< Sum pin. **/
5153
};
5254

5355
template<>

include/hal_core/netlist/gate_library/gate_type.h

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#pragma once
2727

2828
#include "hal_core/netlist/boolean_function.h"
29+
#include "hal_core/netlist/gate_library/enums/gate_type_property.h"
2930
#include "hal_core/netlist/gate_library/gate_type_component/gate_type_component.h"
3031
#include "hal_core/netlist/pins/gate_pin.h"
3132
#include "hal_core/netlist/pins/pin_group.h"
@@ -41,31 +42,6 @@ namespace hal
4142
{
4243
class GateLibrary;
4344

44-
/**
45-
* A set of available properties for a gate type.
46-
*/
47-
enum class GateTypeProperty
48-
{
49-
combinational, /**< Combinational gate type. **/
50-
sequential, /**< Sequential gate type. **/
51-
power, /**< Power gate type. **/
52-
ground, /**< Ground gate type. **/
53-
lut, /**< LUT gate type. **/
54-
ff, /**< Flip-flop gate type. **/
55-
latch, /**< Latch gate type. **/
56-
ram, /**< RAM gate type. **/
57-
io, /**< IO gate type. **/
58-
dsp, /**< DSP gate type. **/
59-
mux, /**< MUX gate type. **/
60-
buffer, /**< Buffer gate type. **/
61-
carry, /**< Carry gate type. **/
62-
pll, /**< PLL gate type. **/
63-
oscillator, /**< Oscillator gate type. **/
64-
};
65-
66-
template<>
67-
std::map<GateTypeProperty, std::string> EnumStrings<GateTypeProperty>::data;
68-
6945
/**
7046
* A gate type contains information about its internals such as input and output pins as well as its Boolean functions.
7147
*

0 commit comments

Comments
 (0)