5 # ________ _________ ____ / __ \/ ___/
6 # / ___/ _ \/ ___/ __ \/ __ \/ / / /\__ \
7 # / / / __/ /__/ /_/ / / / / /_/ /___/ /
8 # /_/ \___/\___/\____/_/ /_/\____//____/
10 # ======================================================================
13 # author: Christoph RĂ¼thing, University of Paderborn
14 # description: A simple preprocessor which handles "GENERATE LOOP"
16 # ======================================================================
20 def generate_loop(filename
, num_hwts
):
24 fin
= open(filename
, "r")
33 if "END GENERATE LOOP" in line
:
36 if state
== STATE_COPY
:
37 sys
.stdout
.write(line
)
39 for i
in range(num_hwts
):
40 loopline
= line
.replace("#i#", str(i
))
41 sys
.stdout
.write(loopline
)
43 if "BEGIN GENERATE LOOP" in line
:
49 generate_loop(sys
.argv
[1], int(sys
.argv
[2]))