Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing array as an output from Python to System verilog #32

Open
naveensrinat opened this issue Nov 8, 2024 · 0 comments
Open

Passing array as an output from Python to System verilog #32

naveensrinat opened this issue Nov 8, 2024 · 0 comments

Comments

@naveensrinat
Copy link

Hi,
I want to pass an array as output from Python to SV and get it as a dynamic array in SV.

My code is as below :

@sv(A_in=DataType.IntArray[1], return_type=DataType.IntArray[1])
def pass_array(A_in):
#A_out = []
A_out = arr.array('i',[])

print("Array Lenght=%d"%(len(A_in)))

#input
for ii in range(0,len(A_in)):
    print("%d"%(A_in[ii]))

#output
print("Output gen")
for ii in range(0,len(A_in)):
    print(ii)
    A_out.append(ii+10)

return A_out

When I tried running it i got the below error ::
(py_3_10_4) [283] ip-10-2-26-119 ../MY_SVTB > python3 my_test.py
/grid/common/pkgs/python/v3.10.4/lib/python3.10
/projects/cascade/cln12ffcll_a0/work/naveenna/cascade_plus_01052024/cascade/design/mpu/mpu_tb/MY_SVTB/pysv/init.py
Traceback (most recent call last):
File "/projects/cascade/cln12ffcll_a0/work/naveenna/cascade_plus_01052024/cascade/design/mpu/mpu_tb/MY_SVTB/my_test.py", line 22, in
@sv(A_in=DataType.IntArray[1], return_type=DataType.IntArray[1])
File "/projects/cascade/cln12ffcll_a0/work/naveenna/cascade_plus_01052024/cascade/design/mpu/mpu_tb/MY_SVTB/pysv/function.py", line 70, in init
assert self.return_type != DataType.IntArray, "Returning an array is not supported"
AssertionError: Returning an array is not supported

Can u please help resolve the error ? Does PYSV allow passing array as output from Py->SV ?

Thanks
Naveen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant