if line.startswith("entity chip"):
found_chip = True
else:
- # covers in bit_vector and out bit_vector as well
- line = line.replace("in bit", "inout std_logic")
- line = line.replace("out bit", "inout std_logic")
+ is_power = False
+ for port in ['vss', 'vdd', 'iovss', 'iovdd']:
+ if ' %s ' % port in line and 'in bit' in line:
+ is_power = True
+ if not is_power:
+ # covers in bit_vector and out bit_vector as well
+ line = line.replace("in bit", "inout std_logic")
+ line = line.replace("out bit", "inout std_logic")
done_chip = line.startswith("end chip")
res.append(line)
# re-join lines
txt = '\n'.join(res)
- # easier to just post-process-correct the iovdd std_logic
- for port in ['vss', 'vdd', 'iovss', 'iovdd']:
- txt = txt.replace("%-9s: inout std_logic" % port,
- "%-9s: in bit" % port)
-
# write the file
with open(fname, "w") as f: