I tried to use the library Veriloggen that can write Verilog in Python with Windows + Visual Studio. Then there was an error related to the simulation, so I fixed it.
Now that I'm free, I'll try using Veriloggen, which I've always been interested in. I also use Python for the first time.
Quickly install the VS Python extension for the time being I can't do anything without the support of the IDE because it's spacious.
Create a virtual environment on VS and install Veriloggen and dependent packages with pip
When I run the sample code
...
endmodule
C:\Users\*******\AppData\Local\Temp\tmp16lswu9y: Permission denied
No top level modules, and no -s option.
'.'Is an internal or external command,
It is not recognized as an operable program or batch file.
Ouf
It seems that something is wrong with the simulation, so
Take a look at Veriloggen's simulation.py
.
First of all, Permission.
simulation.py
tmp = tempfile.NamedTemporaryFile()
tmp.write(code.encode(encode))
tmp.read()
filename = tmp.name
cmd.append(filename)
# synthesis
p = subprocess.Popen(' '.join(cmd), shell=True, stdout=subprocess.PIPE)
Because Permission says something like this Something is wrong with this temporary file.
After a lot of research, about tempfile.NamedTemporaryFile ()
I glance at something disturbing about the Windows environment.
So, you can use mkstemp ()
(I'm not sure), so I'll try it.
Reference
simulation.py
# tmp = tempfile.NamedTemporaryFile()
fd, path = tempfile.mkstemp()
os.close(fd)
tmp = open(path, "w+b")
tmp.write(code.encode(encode))
tmp.read()
filename = tmp.name
#Omission
# close temporal source code file
tmp.close()
os.remove(path)
For the time being, I didn't say anything about Permission.
Then this line
simulation.py
# simulation
p = subprocess.Popen('./' + outputfile, shell=True, stdout=subprocess.PIPE)
Rewrite ./
to . \\
. that's all.
After executing so far, the simulation ran. Hooray
Recommended Posts