Comments (4)
Try :
compile_args = ["-f", "/home/cmds.f"]
Should probably split this in code before passing to subprocess.
from cocotb-test.
This worked fine, thanks!
Related to this, would it make sense to add a default cmds.f file with decent timescale directive? I believe Icarus is mostly not usable as it is for most people and they will all have to figure out the funny way to set the timescale...
Something along those lines, but I'm sure there is a better way.
class icarus_custom(Icarus):
def compile_command(self):
if '-f' in self.compile_args:
print('A command file is already provided.')
else:
print('Override default icarus timescale to 1ns/1ns. Create cmds.f file and add to compile_args')
with open(self.sim_dir+"/cmds.f", 'w') as f:
f.write("+timescale+1ns/1ns")
self.compile_args.extend(["-f", self.sim_dir+"/cmds.f"])
cmd_compile = (
["iverilog", "-o", self.sim_file, "-D", "COCOTB_SIM=1", "-s", self.toplevel, "-g2012"]
+ self.get_define_commands(self.defines)
+ self.get_include_commands(self.includes)
+ self.compile_args
+ self.verilog_sources
)
return cmd_compile
from cocotb-test.
I am closing it.
In case it is still an issue please reopen.
from cocotb-test.
This is one of the things I imagine every Icarus user has to solve when moving from cocotb
to cocotb-test
- why is Icarus now complaining about timescales?
The Cocotb Makefile takes care of writing a default timescale to cmds.f
file and including it here: https://github.com/cocotb/cocotb/blob/master/cocotb/share/makefiles/simulators/Makefile.icarus#L69
When cocotb-test invokes icarus it has no equivalent to set timescale https://github.com/themperek/cocotb-test/blob/master/cocotb_test/simulator.py#L421
Setting compile_args
on every test is clunky, and it's not obvious how to replace SIM=icarus pytest .
with a custom Icarus
subclass (like icarus_custom
above) without losing the ability to switch simulators from the command line. Here is one way:
from cocotb_test.simulator import run, Icarus
from cocotb_test import simulator
class IcarusAutoTimescale(Icarus):
def compile_command(self):
with open(self.sim_dir+"/cmds.f", 'w') as f:
f.write("+timescale+1ns/1ns\n")
self.compile_args.extend(["-f", self.sim_dir+"/cmds.f"])
return super().compile_command()
simulator.Icarus = IcarusAutoTimescale
def test_fen_decode():
run(
verilog_sources=["hw/fen_decode.sv", "hw/ascii_int_to_bin.sv", "hw/onehot_to_bin.v"],
toplevel="fen_decode",
module="cocotb_fen_decode"
)
It's especially odd given all the support to handle Icarus.waves = True
which writes a custom modules and adds a new top level.
from cocotb-test.
Related Issues (20)
- Riviera VHDL simulation not working
- Support three step simulation with VCS HOT 1
- cocotb-test not working when using Altera libraries HOT 2
- Compile args provided to both `ghdl import` and `ghdl make` HOT 1
- The `work_dir` in `simulator.py` is not optional HOT 1
- non-cocotb testbenches HOT 3
- Vivado simulator support HOT 1
- Questa does not generate vsim.wlf when waves=True HOT 6
- Unconditional add vhpi options to Xcelium simulator HOT 1
- Incorrect cmd_build creation for VCS HOT 4
- for Questa/Modelsim is mixedsvvh flag necessary for verilog compilation? HOT 1
- Case sensitive architecture name fail with ghdl HOT 1
- Verilator errors (ex: lint errors when verilating) are suppressed when they should be displayed
- Timescale should also support fs HOT 1
- libcocotbfli_modelsim.so: wrong ELF class HOT 2
- Discussion: cucumber test framework with cocotb-test
- Verilator wave simulation requires c++20 HOT 2
- `TypeError` exception when running simulation
- Discussion: plus_args as a dict rather than a list HOT 3
- ValueError: '/usr/local/bin/cocotb-clean' does not start with '/usr/local/lib/python3.7/site-packages' HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cocotb-test.