-
Notifications
You must be signed in to change notification settings - Fork 2
/
VhdlLyxEntityGeneratorWrapper.py
102 lines (78 loc) · 2.94 KB
/
VhdlLyxEntityGeneratorWrapper.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
################################################################################
##
## Register map generation tool
##
## Copyright (C) 2018 Ondrej Ille <ondrej.ille@gmail.com>
##
## Permission is hereby granted, free of charge, to any person obtaining a copy
## of this SW component and associated documentation files (the "Component"),
## to deal in the Component without restriction, including without limitation
## the rights to use, copy, modify, merge, publish, distribute, sublicense,
## and/or sell copies of the Component, and to permit persons to whom the
## Component is furnished to do so, subject to the following conditions:
##
## The above copyright notice and this permission notice shall be included in
## all copies or substantial portions of the Component.
##
## THE COMPONENT IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
## IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
## AUTHORS OR COPYRIGHTHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
## FROM, OUT OF OR IN CONNECTION WITH THE COMPONENT OR THE USE OR OTHER DEALINGS
## IN THE COMPONENT.
##
###############################################################################
###############################################################################
##
## Class for generation of Lyx tables from VHDL entity interfaces!
##
## Revision history:
## 17.3.2019 First implementation
##
################################################################################
import argparse
import sys
import time
import importlib.util
import os
import inspect
import math
from .gen_lib import *
from .doc_gen.vhdl_lyx_interface_gen import VhdlLyxEntityGenerator
class VhdlLyxEntityGeneratorWrapper():
# Output where to write the VHDL package.
config = None
# Lyx template path
lyxTemplate = ""
# Lyx generator
gen = None
def set_config(self, config):
self.config = config
def do_update(self):
"""
"""
if (not "source_list" in self.config):
print("Source list for conversion is not defined")
return
if (not "template" in self.config):
print("Lyx template for conversion is not defined")
return
self.lyxTemplate = self.config["template"]
for (name, cfg) in self.config["source_list"].items():
print("*" * 80)
print("Processing {} entity".format(name))
print("*" * 80)
self.gen = VhdlLyxEntityGenerator()
out_f = open(cfg["lyx_output"], 'w')
self.gen.set_of(out_f)
self.gen.lyxGen.load_lyx_template(self.lyxTemplate)
in_f = open(cfg["vhdl_file"], 'r')
self.gen.set_vhdlFile(in_f)
self.gen.generate_lyx_table_from_vhdl_entity()
self.gen.lyxGen.commit_append_lines_all()
self.gen.commit_to_file()
out_f.close()
in_f.close()
if __name__ == '__main__':
self.do_update()