cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Visitor
Visitor
238 Views
Registered: ‎06-11-2019

Sending binary data from CPU to FPGA Zynq

Hi guys,

I have connected a custom AXI-4 peripheral implemented on the PL part of a Zynq-7000 processor to the PS part. I need to send data from the PS part to the PL part and vice versa. To do that, I know I can employ the functions Xil_Out32(address, data) and Xil_In32(addr). For example, if I want to send a 3 to the PL from the PS part I'd write something like:

Xil_Out32(my_addr, 0x00000003)

My question is: How can I instead send  data in binary format? Is there anyway to do something like this Xil_Out32(my_addr, 100101010001001) ?

Thanks in advance.

Tags (3)
0 Kudos
4 Replies
Highlighted
Teacher
Teacher
216 Views
Registered: ‎07-09-2009

Have think, how do you convert in C from "binary" to hex ?
<== If this was helpful, please feel free to give Kudos, and close if it answers your question ==>
0 Kudos
Highlighted
Visitor
Visitor
211 Views
Registered: ‎06-11-2019

Obviously I know I can do that, if I'm asking here is because I wanted to know if there's any way to avoid that conversion.

0 Kudos
Highlighted
Xilinx Employee
Xilinx Employee
200 Views
Registered: ‎08-13-2007

0x is for hex in C... 0b is for binary - I think the latter was introduced in C++14 and isn't official C but there's a gcc page that says 0b is supported for a binary literal.

Though many would argue you should likely be able to write this in hex.

It is also worth noting your example below only had 15 bits... I'd specify all 32-bit to avoid ambiguity on justification/padding.

To be clear, i haven't tried 0b myself - I personally usually use 0x.

 

Highlighted
Visitor
Visitor
197 Views
Registered: ‎06-11-2019

Thanks, I'll try using 0b to see if it works. I had no idea that was posible.

 

0 Kudos