summaryrefslogtreecommitdiff
path: root/bin/generate-dummy-class.py
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2019-08-30 13:53:53 +0200
committerDaniel Friesel <daniel.friesel@uos.de>2019-08-30 13:53:53 +0200
commit855bc77bcf3a39859e590abc4b95311b317c1b49 (patch)
treeea4a95cb6d7a9ba30707ca2c4f4b27a3fe2ff182 /bin/generate-dummy-class.py
parent65491fab964b69416aa7f0bc96eff98a38b45fd9 (diff)
add codegen MVP for online model overhead analysis
Diffstat (limited to 'bin/generate-dummy-class.py')
-rwxr-xr-xbin/generate-dummy-class.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/bin/generate-dummy-class.py b/bin/generate-dummy-class.py
new file mode 100755
index 0000000..2200486
--- /dev/null
+++ b/bin/generate-dummy-class.py
@@ -0,0 +1,23 @@
+#!/usr/bin/env python3
+
+from aspectc import Repo
+from codegen import MultipassDriver
+from automata import PTA
+import yaml
+
+with open('/home/derf/var/projects/multipass/model/driver/nrf24l01.dfa', 'r') as f:
+ driver_definition = yaml.safe_load(f)
+ pta = PTA.from_yaml(driver_definition)
+repo = Repo('/home/derf/var/projects/multipass/build/repo.acp')
+
+enum = dict()
+
+if 'dummygen' in driver_definition and 'enum' in driver_definition['dummygen']:
+ enum = driver_definition['dummygen']['enum']
+
+drv = MultipassDriver('Nrf24l01', pta, repo.class_by_name['Nrf24l01'], enum=enum)
+
+with open('/home/derf/var/projects/multipass/src/driver/dummy.cc', 'w') as f:
+ f.write(drv.impl)
+with open('/home/derf/var/projects/multipass/include/driver/dummy.h', 'w') as f:
+ f.write(drv.header)