Questions tagged [pygears]
А python framework that lets you design hardware using high-level Python constructs and compile it to synthesizable HDL code. Use this tag when you're having problems using or understanding the framework itself.
32
questions
0
votes
1
answer
57
views
how to create a module without dti interface?
from pygears import gear, Intf
from pygears.typing import Uint
from pygears.hdl import hdlgen
@gear
def add(a, b):
return a + b
a = Uint[8]
b = Uint[8]
inst = add(a, b)
hdlgen('/add', outdir='...
0
votes
2
answers
62
views
PyGears qrange gear - ValueError: [0], too many values to unpack (expected 2)
Below is the code in PyGears, the idea is to have DUT that will convert Array into Queue, but dut gear is dropping an error " VelueError too many values". As far as I understand qrange ...
1
vote
1
answer
20
views
PyGears how to send Queue as init for accum
I have bias for module my_dot which is Queue interface. Now, I would like to send this bias as init for accum but without EOT. How to do this?
@gear
def my_dot(din: Queue[Tuple[Fixp[9, 16], Fixp[9, 16]...
2
votes
1
answer
104
views
PyGears hdlgen generates top level module with DTI interfaces, Vivado is expecting Verilog which does not support this feature
I made my module whish looks like this
from pygears import gear
from pygears.typing import Fixp, Tuple
from pygears.lib import add, qround, saturate, drv, collect
from pygears.sim import sim
from ...
1
vote
1
answer
23
views
PyGears hdlgen not generating DTI definition files
This is my code
from pygears import gear
from pygears.typing import Fixp, Tuple
from pygears.lib import add, qround, saturate, drv, collect
from pygears.sim import sim
from pygears.hdl import hdlgen
@...
0
votes
1
answer
39
views
PyGears TypeMatchError: [0], Incomplete type: Tuple[Fixp[32], Fixp[32]]
I have a problem while working on simple module in PyGears. I would like to make simple add operation and after that to do rounding and saturation. Error I'm getting is:
File "/home/stefan/Test/...
2
votes
1
answer
50
views
PyGears difference between tuple and Tuple
What is difference between tuple and Tuple in PyGears python framework?
pygears.org doesn't mention anything about it.
1
vote
1
answer
34
views
How can I use GearBox in pyGears framework?
I was wondering how to run GearBox, is there any command or anything?
I checked website www.pygears.org but there are no information about it.
0
votes
1
answer
33
views
Running PyGears framework on Windows
I just started using pyGears and I find it easier working on Windows. I was wondering is it possible to run it on Windows or it's only Linux based?
1
vote
1
answer
43
views
PyGears How to make AND gate
Let's say I have two modules M1 and M2 and both of them are outputting 32 bits data. I would like to do logic AND for each bit. How to do it?
I have been looking into Library on GitHub but couldn't ...
2
votes
1
answer
75
views
PyGears How to make counter
I want to make a counter which can start counting at posedge of a specific signal (enable signal). And once it counts to 256, stop counting, set the counter to 0 and output something.
3
votes
1
answer
48
views
Compiling python code while using PyGears framework
At the moment I'm writing my first code in PyGears and I'm stuck with part how to compile the code. Do I compile it like normal python code or I need some fancy tools?
2
votes
1
answer
31
views
Is it possible to run PyGears in VS Code?
I just started with PyGears, and there is no recommendation in the documentation or any tutorial about which IDE should be used for it.
I saw in tutorials that others are using Emacs(Spacemacs), but ...
0
votes
1
answer
39
views
Trying to make a counter that will have its output multiplied by some fixed value
I'm trying to make a counter that will have its output multiplied by some fixed value; the code is below:
from pygears.lib import qrange, mul
qrange(10) | mul(2)
The error I'm getting is this one:
...
1
vote
1
answer
49
views
PyGears converting Integer to Fixed Point
I would like to convert my interface which is Uint[10] to Fixed Point 10.16, 16 bits in total, 10 for whole part and 6 bits for fraction. How to do it?
Code for interface is below:
from pygears.typing ...
1
vote
1
answer
26
views
Is it possible to set breakpoints in PyGears?
As far as I understood I can use any text editor for writing PyGears.
Actually, I need just Python IDE.
Does this mean that I can set breakpoints in any of these tools?
0
votes
1
answer
21
views
PyGears reordering bits
I would like to reorder bits before sending it to another module. I would like to make gear that will take 2 inputs pixel and weight and output called reordered should be:
reordered[0] = {pixel[0],...
2
votes
1
answer
29
views
How to integrate jinja module inside PyGears
I created jinja module as example, which looks like this
{% from 'snippet.j2' import module with context %}
{% call module() %}
logic [$size(din.data)-1 : 0] res;
assign res = din.data * din....
0
votes
1
answer
42
views
How to get bit width in PyGears?
How do I calculate in PyGears how many bits do I need to represent some numbers, for example:
4,6,-100 etc.
Is it possible to use log2 function?
1
vote
1
answer
38
views
How to generate HDL code without the simulation
I would like to generate HDL code without running the simulation. I managed to generate the code, but I had to run the simulation first. However, I would like to do it without this step. Is this ...
1
vote
1
answer
27
views
Pygears how to fix interface to some value?
Let's say I have this gear
@gear
def test(a: Uint, b: Uint):
return a + b
I would like to instantiate this module and connect port "a" to some interface but I also want to fix port &...
1
vote
1
answer
59
views
Pygears - Unresolved array argument when instantianting component
I am trying to implement and simulate a simple adder component that doubles the input value. Bellow is my code.
from pygears.typing import Uint
from pygears.hdl import *
from pygears.sim import sim
...
1
vote
1
answer
73
views
How to install PyGears on Linux
Is there any instruction on how to install PyGears on Linux? And which distributions are supported?
I tried looking on the official website pygears.org but couldn't find anything regarding this.
1
vote
1
answer
60
views
PyGears - Infinite while loop in import statement
When importing pygears:
from pygears import gear, Intf
The execution reaches __init__.py. In the __init__.py script, on line 54 the following function is called:
load_rc('.pygears')
This function is ...
2
votes
1
answer
64
views
PyGears - Can't run script, PYPY is undefined
I am trying to setup PyGears, I have installed the package using pip. I am trying to execute the bellow two lines of code using command line.
from pygears import gear, Intf
from pygears.typing import ...
2
votes
1
answer
39
views
How to leave interface unconnected?
Is there any way to leave interface unconnected when we are instantiating gear?
For example:
collect(val = ram_model(write_addr = None,
write_data = None,
...
2
votes
1
answer
61
views
Zero simulation time
I am creating some kind of RAM memory. Idea was firstly to create RAM "write" functionality, as you can see in code below. Beside RAM memory, there is RAM model driver, which was suposed to ...
1
vote
1
answer
38
views
How to use interface signal to iterate through numpy matrix?
I have troubles with iterating through numpy matrix using interface signal.
I tried to manually cast "addr" but it does not work.
This is my code:
@gear
async def ram_model_data_drv(addr:...
1
vote
1
answer
38
views
PyGears TypeError: [0], cannot saturate 'Int[10]' to a different base type 'Fixp[8, 16]'
I'm trying to make a simple module called Neuron. Idea is to multiply input pixel value with weight and then accumulate. After accumulation, the result should be added to the bias value and then send ...
1
vote
1
answer
63
views
PyGears is not generating output HDL files
This is the code I run, and it's not generating output HDL files:
from pygears import gear
from pygears.typing import Ufixp, Uint
from pygears.sim import call
from pygears.lib import drv, collect
@...
2
votes
1
answer
200
views
PyGears Error: No system libbz2 headers could be found. Make sure your system has a libz installed
I got error No system libbz2 headers could be found. Make sure your system has a libz installed while installing PyGears. Any suggestions?
1
vote
1
answer
180
views
How to install PyGears on WSL - Ubuntu 20.04 LTS
Is there any instruction on how to install PyGears from scratch on WSL? I tried to find it online but I was unsuccessful.