Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 04:32
    jahagirdar commented #3157
  • Dec 08 19:53
    ktbarrett commented #3157
  • Dec 08 19:27
    ktbarrett commented #3157
  • Dec 08 08:09
    jahagirdar opened #3157
  • Dec 05 17:39
    marlonjames commented #3154
  • Dec 05 17:03
    ktbarrett commented #3154
  • Dec 05 16:59
    ktbarrett commented #3154
  • Dec 04 22:28
    tianrui-wei commented #3150
  • Dec 04 20:26
    themperek commented #3150
  • Dec 04 20:26

    themperek on master

    Use shlex instead of manually i… (compare)

  • Dec 04 20:26
    themperek closed #3150
  • Dec 04 20:24

    themperek on master

    fix xcelium vpi and tmpdir flag… (compare)

  • Dec 04 20:24
    themperek closed #3148
  • Dec 02 17:20
    marlonjames commented #3154
  • Dec 02 17:09
    marlonjames closed #3154
  • Dec 02 17:09
    marlonjames commented #3154
  • Dec 02 13:40
    AntonBabundin opened #3154
  • Dec 01 13:05
    imphil closed #1391
  • Dec 01 13:05
    imphil commented #1391
  • Dec 01 11:59
    themperek commented #3149
Philipp Wagner
@imphil
Announcement: cocotb 1.7.2 has just been released with Python 3.11 support and two fixes (including one crash) that our users reported. Enjoy!
1 reply
Atheer-code
@Atheer-code
I am using numpy library in Cocotb to generate random numbers for A and B inputs which span from -2^32 to 0. The problem is I want python to be able to represent a negative value result within 32 bit register, no more than that, but I get an error that there is an Overflow......
1 reply
Ronan Rice
@ronancode
This is more of an xcelium question, but after scouring the docs I was unable to find an answer and hope maybe some of you can help me out. I used to save sim vars into VCD files using $dumpvars(), but am migrating to the native SHM databases using the $shm_open() command in my top level system verilog file. I notice this doesn't save any variables of type real, only digital signals. Is there a different command other than $shm_open() I have to use to save reals? I see in the documentation that .trn is for digital and .tran is for analog, but I am not seeing any .tran file in the database.
11 replies
Atheer-code
@Atheer-code

I have made a random function using numpy library that generate values in this range (-2^32 -0) to be used in input A and input B, the result is clearly a 64 bit value. Now my DUT accepts only 32 bit inputs and generates only 32 bits outputs, the operation is a multiplication that selects the lower 32 bit value of a 64 bits internal register (output register). for some reason I get an error of "Overflow" for my inputs received by the DUT...

this is the error message :
OverflowError: Int value (-3715553560) out of range for assignment of 32-bit signal ('opcode_ra_operand_i'). Notice "opcode_ra_operand_i" is the DUT input A....

My code is :

def generateRandom():
return np.random.randint(-2^32,0), np.random.randint(-2^32,0)

def NegativeNum(dut= None ,inputA = None, inputB = None):

inputA,inputB= generateRandom()

dut.A.value = inputA
dut.B.value = inputB
yield ClockCycles(dut.clk_i, 3, rising=True)

print("output = ")
print("inputA=",inputA," inputB=",inputB," (inputA*inputB)=",int(dut.result.value))
Neom5
@Neom5
I am starting to learn about coverage concept using Cocotb but I wish there is a simple example that performs simple coverage for say an adder ?
1 reply
Vijayvithal
@jahagirdar

I have opened PR #3137
This is an issue with generating reproducable test seed from RANDOM_SEED and qualname

I believed this issue was fixed in 7.0, has It resurfaced? or was my assumption incorrect.

Neom5
@Neom5
@jahagirdar In case I have 'a' and 'b' as randomly generated values, should it be the same ? what is coverage point in simple words ? Thx these videos are super helpful
5 replies
jwprice100
@jwprice100
Has anyone seen an issue with Riviera Pro and the latest cooctb and python 3.11 where Riviera crashes on a restart when using the GUI?
Well doesn't crash, hangs indefinitely to be more precise
imphil
@imphil:matrix.org
[m]
No I haven't seen that yet. Can you file an issue?
jwprice100
@jwprice100
yes sir
jwprice100
@jwprice100
Ah it's more of a python versin thing
jwprice100
@jwprice100
imphil
@imphil:matrix.org
[m]
Thanks a lot!
Leon Woestenberg
@likewise
Something regressed in my (pip3 user local) CocoTB installation, I'm getting these failures in all my previously working CocoTB tests.
To be sure it's not in my local projects, I cloned cocotbext-uart and ran make in tests/uart/
     0.00ns CRITICAL cocotb.regression                  Failed to import module test_uart: No module named 'cocotb._vendor.find_libpython'
~/cocotbext-uart/tests/uart$ ls -ald `cocotb-config --libpython`
-rw-r--r-- 1 root root 4683728 Jun 29 13:45 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0
Leon Woestenberg
@likewise
Disregard, I think the above comes up with a fix for cocotb-test.
Leon Woestenberg
@likewise

cocotb-test has this fixed in 0.2.3, but that requires Python 3.7+
Manually patching cocotb-test <0.2.3 as follows:

sed -i \
-e 's@import cocotb._vendor.find_libpython as find_libpython@import find_libpython@' \
-e 's@install_requires=["cocotb>=1.5", "pytest"],@install_requires=["cocotb>=1.5", "pytest", "find_libpython"],@' \
`find /usr/local/lib/python*/*-packages/cocotb_test/simulator.py`

or

sed -i \
-e 's@import cocotb._vendor.find_libpython as find_libpython@import find_libpython@' \
-e 's@install_requires=["cocotb>=1.5", "pytest"],@install_requires=["cocotb>=1.5", "pytest", "find_libpython"],@' \
`find ~/.local/lib/python*/*-packages/cocotb_test/simulator.py`

for pip3 user-local installs

Vladislav Borshch
@vborshch_gitlab

Hi there! Is there any chance to create AxiStreamSource/Sink by providing direct references to the signals?

I have something like that:

  input  logic      [W_TDATA-1:0] s_axis_tdata  [N_GRANTS] ,
  input  logic      [W_TDEST-1:0] s_axis_tdest  [N_GRANTS] ,
  input  logic                    s_axis_tvalid [N_GRANTS] ,
  output logic                    s_axis_tready [N_GRANTS] ,
  output logic                    s_axis_tlast  [N_GRANTS] ,

And I wanna go through the loop over N_GRANTS and get array of AxiStream objects like that:

for i in range(dut.N_GRANTS):
            self.axi_source = AxiStreamSource(AxiStreamBus.SOMEHOW(dut, s_axis*[i]), dut.i_clk, dut.i_rst_n, reset_active_level=False)
I definitely don't wanna go to the single-dimension arrays like: logic [N_GRANTS*W_TDATA-1:0] s_axis_tdata
Thanks!
Kaleb Barrett
@ktbarrett
@likewise you make an issue in cocotb-test about getting it to work with Python 3.6.
Kaleb Barrett
@ktbarrett
There should be a "could" in there. Sorry for the morning madlibs.
Vladislav Borshch
@vborshch_gitlab

I definitely don't wanna go to the single-dimension arrays like: logic [N_GRANTS*W_TDATA-1:0] s_axis_tdata

I found a solution for my previous messages about 2D AXIS ports. Looks like that:

self.axi_src_list = []
for i in range(N):
            self.axi_src_list.append(AxiStreamSource(AxiStreamBus.from_prefix(dut, "s_axis", array_idx=i), dut.i_clk, dut.i_rst))

Hope, it'll help somebody.

Leon Woestenberg
@likewise
@ktbarrett No problem, I interpreted it as +could :) I will drop an issue in cocotb-test.
jwprice100
@jwprice100
Does this make sense? If I reference dut.generic.value I get back an integer from Riviera, and a BinaryValue from GHDL
Kaleb Barrett
@ktbarrett
It doesn't make sense, but I'm not surprised. What's the type of the signal/constant being accessed?
jwprice100
@jwprice100
integer
Looks like GHDL support is still experimental, it doesn't seem to play nicely with timers (or I think more than one timer) and some other things
Kaleb Barrett
@ktbarrett
@jwprice100 Your problem: cocotb/cocotb#2596
jwprice100
@jwprice100
ah
not new issue :)
oh well, I was hoping it would work but not there yet
Kaleb Barrett
@ktbarrett
AFAIK there is no one working on improving the PLI support on GHDL. It currently offers the VPI, which is not an appropriate interface for a VHDL simulator. It could instead offer the VHPI. Although IMO we could and should improve and standardize the GPI (cocotb's abstraction over the various PLIs) and directly implement that in GHDL. However, there is little interest in that.
4 replies
jwprice100
@jwprice100
Yeah that is understandable but unfortunate
Dave Keeshan
@davekeeshan
Is it possible to test a variable result, have it fail, have the fact that the whole test fail at the end of the simulation. At the moment just raising an exception seems to stop the test dead at that point. I don't want to stop the test, I want to proceed so that I can see if the error persists or goes away.
5 replies
I also get the warning ".venv/Python-3.10.7/lib/python3.10/site-packages/cocotb/scheduler.py:585: FutureWarning: "Unwatched" tasks that throw exceptions will not cause the test to fail. See issue #2664 for more details.", after I raise an exception, great! But what does one do so that this FutureWarning is not issued?
2 replies
Vignesh Raja
@vigneshraja:matrix.org
[m]
hi, I am new to cocotb. How could I assign value to generic variable from cocotb?
Kaleb Barrett
@ktbarrett
@vigneshraja:matrix.org You cannot assign a generic value from a running simulation using the dut object. Instead, look up how to assign generics from your simulator's commandline and pass those flags to SIM_ARGS. For example, on Questa you would use -g/path/to/generic=value.
rakmo0001
@rakmo0001:matrix.org
[m]

Hi, I started using cocotb on windows through mingw.
I was able to run vhdl and verilog file separately and it worked fine with help of icarus and ghdl.
Now I need to simulate both files at a time i.e topmodule as vhdl and a verilog file as a sub module. So, downloaded modelsim starter edition (Intel 18.1).
Problem: Not able to locate modelsim inside mingw

C:\tdc_nfm>make SIM=modelsim
C:/msys64/mingw64/lib/python3.10/site-packages/cocotb/share/makefiles/simulators/Makefile.questa:42: * Unable to locate command >vsim<. Stop.

the cocotb version 0.2.2,
the operating system is windows (using cocotb through mingw64)
modelsim intel starter edition (18.1),
the Python version : 3.10.8
I am sure my path is not proper.....please someone suggest how to add path
jwprice100
@jwprice100

Question: I'm playing around with GHDL and cocotb. I've got a 2D array I'm attempting to access from python space. I'm getting a weird error:

dut.I_TERMS[idx].value = term
~~~~~~~~~~~^^^^^
File "/home/jprice/aps_env/lib/python3.11/site-packages/cocotb/handle.py", line 652, in __getitem__
  raise IndexError(IndexError: I_TERMS(GPI_ARRAY) contains no object at index 0

I'm confused by that error message that suggests it understands I_TERMS is an array but...can't index it?

Probably not supported but the error message gives me hope maybe it is :)
Marlon James
@marlonjames
Set log level to DEBUG to get more info on why the lookup is failing
7 replies
Neom5
@Neom5

I am testing a divider using Cocotb and for some reason I do not get the correct result from the DUT. The CPU I am testing supports only integers so it is ok to get only integer results, but I actually get really strange numbers... for example if I want to divide -1986754723 / 1860941349 the true result is = -1.0676073827192927 but from DUT I get 4294967295 knowing there is no mistake in the design code at all.

My code :

import cocotb
from cocotb.clock import Clock
from cocotb.triggers import ClockCycles
import numpy as np
import os

def generate_neg_pos_Random():
return np.random.randint(-231,0), np.random.randint(0,231)

@cocotb.test()
def Negative_number(dut= None ,ra_result = None, rb_result = None):

c = Clock(dut.clk_i, 10, 'ns')
yield cocotb.start(c.start())    

dut.rst_i.value = 0
yield RisingEdge(dut.clk_i)
dut.rst_i.value = 1
yield RisingEdge(dut.clk_i)
dut.rst_i.value = 0

print("Negative numbers) : ")

dut.opcode_valid_i.value = 1
yield ClockCycles(dut.clk_i, 1, rising=True)
dut.opcode_valid_i.value = 0

ra_result,rb_result= generate_neg_pos_Random()

print("output (python) = ")
result_ = ra_result/rb_result
print("ra=",ra_result," rb=",rb_result," (ra/rb)=",result_)
dut.opcode_ra_operand_i.value = ra_result
dut.opcode_rb_operand_i.value = rb_result
yield ClockCycles(dut.clk_i, 34, rising=True)

print("output (dut) = ")
print("ra=",ra_result," rb=",rb_result," (ra/rb)=",int(dut.writeback_value_o.value))
result1_dut = int(dut.writeback_value_o.value)

print(Negative_number())

Kaleb Barrett
@ktbarrett
@Neom5 If you use int() on a BinaryValue you get the unsigned representation of the bits. That value you listed is -1 in 32 bit unsigned representation, which matches your expected value. And unless the CPU you are testing works with floats, you wont get the fractional part, so you should change your testing logic to use flooring division (ra_result//rb_result).
jwprice100
@jwprice100
So, in my quest to actually make use of GHDL and cocotb, I've made some progress. One thing I've noticed is objects in a for generate loop end up with the name "generate_name(0)" which I can't directly access syntactically. I'm able to access it via getattr(dut, "generate_name(0)") but I first have to call dir(dut) otherwise cocotb fails to find it. Curious if there's a more elegant/correct way to do this.
Neom5
@Neom5
@ktbarrett But sometimes I get 0 from DUT when performing (-1150535179 / 1150535179 ) = -1.9162750371895474 , is it related too to the same issue you mentioned previously ? I tried using flooring division but it does not solve the problem fully since it rounds up values
Kaleb Barrett
@ktbarrett

(-1150535179 / 1150535179 ) = -1.9162750371895474

-1150535179 / 1150535179 would be -1. I'm not sure what the issue could be there. Is there potentially an implementation error in the CPU? Perhaps the latency through the CPU is not always 34 clock cycles like you have hardcoded in your test? Look at the waveforms dumped from your simulator.