Hello Frank.
Some years ago I had a similar problem. I ended up using Python scripts
which generated Verilog and C header files on the fly from the same
template files written in Python.
The nice thing of using a script language is that you can build and
evaluate expressions easily on the fly and that is exactly what I
wanted (some other compiled languages allow you to do the same thing,
for example using reflection in Java, but you end up writing more
code). E.g.
e = "3*4+%(foo)s"
d = {'foo': 5}
n = eval(e % d)
your_function(n) ...
The template scripts were horrible --mixture of numbers, strings,
regexp strings, recursive evaluation of regexps...-- but it did the job
automatically and flawlessly, and therefore was worth the upfront
effort.
Also, Python's re package was very useful because it allows grouped
matches and you can perform simple parsing with them.
Luck with your project.
--
PabloBleyerKocik /"I believed that people would become programmers
pbleyer / and not need companies as much. You can see how
@embedded.cl / laughable that was." -- Steve Wozniak
|