HAL
py_code_provider.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 
30 #include <QString>
31 
32 namespace hal
33 {
35  {
36 
37  public:
38 
39  static QString pyCodeGate(u32 gateId);
40  static QString pyCodeGateId(u32 gateId);
41  static QString pyCodeGateName(u32 gateId);
42  static QString pyCodeGateType(u32 gateId);
43  static QString pyCodeGateTypePinByName(u32 gateId, QString pin);
44  static QString pyCodeGateTypePinDirection(u32 gateId, QString pin);
45  static QString pyCodeGateTypePinType(u32 gateId, QString pin);
46  static QString pyCodeGateInputPins(u32 gateId);
47  static QString pyCodeGateOutputPins(u32 gateId);
48  static QString pyCodeProperties(u32 gateId);
49  static QString pyCodeGateLocation(u32 gateId);
50  static QString pyCodeGateModule(u32 gateId);
51  static QString pyCodeGateBooleanFunction(u32 gateId, QString booleanFunctionName);
53  static QString pyCodeGateData(u32 gateId, QString category, QString key);
54  static QString pyCodeGateDataMap(u32 gateId);
55 
56  static QString pyCodeStateComp(u32 gateId);
57  static QString pyCodeStateCompPosState(u32 gateId);
58  static QString pyCodeStateCompNegState(u32 gateId);
59 
60  static QString pyCodeFFComp(u32 gateId);
61  static QString pyCodeFFCompClockFunc(u32 gateId);
62  static QString pyCodeFFCompNextStateFunc(u32 gateId);
63  static QString pyCodeFFCompAsyncSetFunc(u32 gateId);
64  static QString pyCodeFFCompAsyncResetFunc(u32 gateId);
65  static QString pyCodeFFCompSetResetBehav(u32 gateId);
66 
67  static QString pyCodeLatchComp(u32 gateId);
68  static QString pyCodeLatchCompEnableFunc(u32 gateId);
69  static QString pyCodeLatchCompDataInFunc(u32 gateId);
73 
74 
75  static QString pyCodeNet(u32 netId);
76  static QString pyCodeNetId(u32 netId);
77  static QString pyCodeNetName(u32 netId);
78  static QString pyCodeNetType(u32 netId);
79  static QString pyCodeNetSources(u32 netId);
80  static QString pyCodeNetDestinations(u32 netId);
81  static QString pyCodeNetData(u32 netId, QString category, QString key);
82  static QString pyCodeNetDataMap(u32 netId);
83 
84  static QString pyCodeModule(u32 moduleId);
85  static QString pyCodeModuleId(u32 moduleId);
86  static QString pyCodeModuleName(u32 moduleId);
87  static QString pyCodeModuleType(u32 moduleId);
88  static QString pyCodeModuleModule(u32 moduleId);
89  static QString pyCodeModuleSubmodules(u32 moduleId);
90  static QString pyCodeModuleGates(u32 moduleId, bool recursively = false);
91  static QString pyCodeModuleNets(u32 moduleId);
92  static QString pyCodeModuleInputNets(u32 moduleId);
93  static QString pyCodeModuleOutputNets(u32 moduleId);
94  static QString pyCodeModuleInputPins(u32 moduleId);
95  static QString pyCodeModuleOutputPins(u32 moduleId);
96  static QString pyCodeModuleInternalNets(u32 moduleId);
97  static QString pyCodeModuleIsTopModule(u32 moduleId);
98  static QString pyCodeModuleData(u32 moduleId, QString category, QString key);
99  static QString pyCodeModuleDataMap(u32 moduleId);
100  static QString pyCodeModulePinGroup(u32 moduleId, u32 groupId);
101  static QString pyCodeModulePinGroups(u32 moduleId);
102  static QString pyCodeModulePinGroupName(u32 moduleId, u32 groupId);
103  static QString pyCodeModulePinById(u32 moduleId, u32 pinId);
104  static QString pyCodeModulePinName(u32 moduleId, u32 pinId);
105  static QString pyCodeModulePinDirection(u32 moduleId, u32 pinId);
106  static QString pyCodeModulePinType(u32 moduleId, u32 pinId);
107  static QString pyCodeModulePins(u32 moduleId);
108 
109  static QString pyCodeGrouping(u32 groupingId);
110  static QString pyCodeGroupingName(u32 groupingId);
111  static QString pyCodeGroupingId(u32 groupingId);
112 
113  private:
114  static QString buildPyCode(const QString& prefix, const QString& suffix, u32 id);
115 
116  static const QString gateCodePrefix;
117  static const QString netCodePrefix;
118  static const QString moduleCodePrefix;
119  static const QString groupingCodePrefix;
120 
121  };
122 }
static QString pyCodeModulePinDirection(u32 moduleId, u32 pinId)
static QString pyCodeModuleIsTopModule(u32 moduleId)
static QString pyCodeFFComp(u32 gateId)
static QString pyCodeGateLocation(u32 gateId)
static QString pyCodeGateTypePinDirection(u32 gateId, QString pin)
static QString pyCodeNetSources(u32 netId)
static QString pyCodeGrouping(u32 groupingId)
static QString pyCodeStateCompNegState(u32 gateId)
static QString pyCodeModulePinType(u32 moduleId, u32 pinId)
static QString pyCodeModuleType(u32 moduleId)
static QString pyCodeLatchCompAsyncSetFunc(u32 gateId)
static QString pyCodeStateCompPosState(u32 gateId)
static QString pyCodeLatchCompAsyncResetFunc(u32 gateId)
static QString pyCodeGateTypePinByName(u32 gateId, QString pin)
static QString pyCodeGateTypePinType(u32 gateId, QString pin)
static QString pyCodeModuleOutputNets(u32 moduleId)
static QString pyCodeLatchComp(u32 gateId)
static QString pyCodeGateInputPins(u32 gateId)
static QString pyCodeLatchCompEnableFunc(u32 gateId)
static QString pyCodeModule(u32 moduleId)
static QString pyCodeModuleInternalNets(u32 moduleId)
static QString pyCodeGateType(u32 gateId)
static QString pyCodeLatchCompDataInFunc(u32 gateId)
static QString pyCodeGateData(u32 gateId, QString category, QString key)
static QString pyCodeProperties(u32 gateId)
static QString pyCodeNet(u32 netId)
static QString pyCodeGateBooleanFunction(u32 gateId, QString booleanFunctionName)
static QString pyCodeGroupingName(u32 groupingId)
static QString pyCodeModuleInputNets(u32 moduleId)
static QString pyCodeModuleDataMap(u32 moduleId)
static QString pyCodeGate(u32 gateId)
static QString pyCodeModulePinGroup(u32 moduleId, u32 groupId)
static QString pyCodeGateModule(u32 gateId)
static QString pyCodeNetType(u32 netId)
static QString pyCodeModuleNets(u32 moduleId)
static QString pyCodeModulePins(u32 moduleId)
static QString pyCodeModulePinById(u32 moduleId, u32 pinId)
static QString pyCodeModulePinName(u32 moduleId, u32 pinId)
static QString pyCodeNetDataMap(u32 netId)
static QString pyCodeModuleInputPins(u32 moduleId)
static QString pyCodeStateComp(u32 gateId)
static QString pyCodeGroupingId(u32 groupingId)
static QString pyCodeNetId(u32 netId)
static QString pyCodeModuleModule(u32 moduleId)
static QString pyCodeFFCompSetResetBehav(u32 gateId)
static QString pyCodeFFCompAsyncSetFunc(u32 gateId)
static QString pyCodeModulePinGroupName(u32 moduleId, u32 groupId)
static QString pyCodeNetDestinations(u32 netId)
static QString pyCodeModuleOutputPins(u32 moduleId)
static QString pyCodeFFCompAsyncResetFunc(u32 gateId)
static QString pyCodeModuleId(u32 moduleId)
static QString pyCodeNetData(u32 netId, QString category, QString key)
static QString pyCodeModuleSubmodules(u32 moduleId)
static QString pyCodeModuleData(u32 moduleId, QString category, QString key)
static QString pyCodeModuleGates(u32 moduleId, bool recursively=false)
static QString pyCodeGateOutputPins(u32 gateId)
static QString pyCodeGateName(u32 gateId)
static QString pyCodeGateAsyncSetResetBehavior(u32 gateId)
static QString pyCodeGateId(u32 gateId)
static QString pyCodeFFCompNextStateFunc(u32 gateId)
static QString pyCodeModulePinGroups(u32 moduleId)
static QString pyCodeModuleName(u32 moduleId)
static QString pyCodeFFCompClockFunc(u32 gateId)
static QString pyCodeLatchCompSetResetBehav(u32 gateId)
static QString pyCodeGateDataMap(u32 gateId)
static QString pyCodeNetName(u32 netId)
quint32 u32