PYNQ: PYTHON PRODUCTIVITY

Registers Addressing for .HWH file

Hello,
I’v written an AXI Stream IP core in verilog and successfully used it in verilog. Before getting to my question I would like to thank the pynq staff for the amazing platform they created.
So let’s get to my problem. I’m trying to convert that AXI Stream code mentioned above to an AXI Lite IP Core. Before that I wrote a simple AXI Lite adder in verilog and connected it to the zynq PS (Block Design Picture is attached). when i try to access it’s registers with “add_ip.register_map” I get the following error : "AttributeError: register_map only available if the .hwh is provided"
after searchin in the PYNQ support topic I found this link :


I found out that I have to specify my registers in the vivado IP packager’s “addressing and memory” tab.
is there any manual on how to do that?
when i click add register it just want’s a name for the register. what other parts should I fill and how should I address my registers and memory?

Thank You in advance.

After you enter the name (and press OK) a new sub-table will appear in which you can enter other properties of the register.

You also need to upload the hwh file along with the bitstream to the PYNQ device, These need to be in the same folder and have the same name except for the .bit and .hwh extensions.

The .hwh file can be found by exporting the hardware (File>Export>Export_Hardware) from the project that the block diagram you posted is in, after it is implemented. The hardware files are in a zip archive but with a different extension, .xsa if you are using Vivado 2019.x.

.

Dear ggillett,
thank you for your response.
I have done the things you said so far.
I just don’t know how to enter the properties of the registers. for example the base address of the address blocks and the address offset of the registers.
I have two 32 bit registers for my adder (adds two 16 bit nIumber in the first register and puts the output in the second register).
I’ve uploaded all three .bit, .tcl and the .hwh file into my PYNQ overlay folder.

Addressing and Memory 2

same problem i have ,i cannot know the address offset register to use it in driver for PYNQ, if any one can help me ?

UPDATE:
I’ve added two registers like this :
2
now the error is gone, but the result of the adder is not correct. I’m assuming the addressing is wrong.
Untitled

Any Help is appreciated.

I don’t think this is really a PYNQ question. You may be better checking the Xilinx documentation or searching on the Xilinx forums for more info.

These registers need to match the address or decode logic in your IP. In your Verilog, it woudl need to use 0x10 and 0x18 for the register 0 and 1.

Cathal

I agree with cathalmccabe,

It is about your address decoding matching the register offsets used… You could try setting the register offsets to 0 and 1, not sure if you used the AXI lite peripheral flow in the packager. I’ve never used that my self.

Thank you for your response.
I asked this question in the xilinx Forum and found out this configuration is correct. 32 bit registers needs 4Byte for addressing so in my verilog code I need to check the address[3:2] for address decoding. so this is my config so far.
Untitled

Now when i write data to my first register (slv_reg0) via add_ip.register_map.slv_reg0 the second register also get’s this value and I don’t get the result of the adder in the second register.
any thoughts on this?

Adding named registers only makes the design easier to use in PYNQ. It doesn’t change the way your hardware works.

I’m guessing your Verilog is wrong. Did you simulate it?

I’m assuming you are you writing this from scratch yourself. I would suggest you use the AXI IP Wizard from the Vivado IP packager to create and AXI template. Simulate this and understand how it works, and then modify it for your design.

Cathal

I used the AXI IP Wizard in vivado to generate my code. I attached the verilog files below. I checked the files and found nothing wrong. I’d appreciate it if you could take a look at them also.

again Thank you for guiding me.

adder.v (705 Bytes) axiLite_adder_v1_0.v (2.1 KB) axiLite_adder_v1_0_S_AXI.v (14.3 KB)

UPDATE:
the correct register addressing is attached below.
everything is working fine.
Untitled

1 Like