Re: [casper] Reading ROACH2 FPGA BRAMs on PowerPC

2015-02-19 Thread Danny Price

Thanks Glenn, Dave and Rurik!

To conclude this thread, there is a C-based example of reading the mmap 
/dev/roach/mem file here:

https://github.com/shanlyrajan/roach2_linux/blob/master/test_mmap_RW.c
which can be found from that link that Glenn sent:
https://casper.berkeley.edu/wiki/FPGA_Device_Driver_Memo

I had already gotten my teeth in before getting that email, so I wrote 
some Python code that is more than fast enough for our needs and simple 
to use. I've created a github gist in case it comes in handy for anyone 
else:

https://gist.github.com/telegraphic/37de73d5227017582c17

What this example code does is parse the core_info.tab file and creates 
a set of 'cores' specific to that core_info.tab file. Each core has a 
read method that uses mmap to access the data, taking care of read 
offsets and such (I haven't implemented write). There's also some 
example usage with a quick 'n dirty UDP packetizer specific for our needs.


Cheers
Danny

PS: I suggest adding katcp / corr / spead / numpy / zmq etc to the 
default filesystem if licenses allow? Our filesystems are mounted as 
read-only so I couldn't easily install packages that require 
compilation, hence my shoddy UDP approach as opposed to using something 
more robust.


G Jones wrote:

Hi Danny,
Have you seen this page on the wiki? 
https://casper.berkeley.edu/wiki/FPGA_Device_Driver_Memo
The example code in the links provided there worked well as a good 
starting point.


Glenn

On Mon, Feb 16, 2015 at 10:04 PM, Danny Price > wrote:


Hi all

I'd like to read data from the FPGA on the ROACH2 powerpc, then
pack it into UDP and send it out over Ethernet. Is there a
straightforward and reasonably efficient way to read
registers/bram from the FPGA on the ROACH2 powerpc? Better yet,
has anyone implemented something already that they're happy to
share? We need a ~0.5MB transfer, triggered when a register is
incremented (once per second), so speed shouldn't be a major issue.

I know on the ROACH1 the BRAMs were available in /proc, and that
the new tcpborphserver3 on the ROACH2 memory maps through the
'device nodes' in /dev/roach, but I'm not clear on how to read
desired registers on the PPC though this...

Thanks
Danny






Re: [casper] Reading ROACH2 FPGA BRAMs on PowerPC

2015-02-18 Thread G Jones
Hi Danny,
Have you seen this page on the wiki?
https://casper.berkeley.edu/wiki/FPGA_Device_Driver_Memo
The example code in the links provided there worked well as a good starting
point.

Glenn

On Mon, Feb 16, 2015 at 10:04 PM, Danny Price 
wrote:

> Hi all
>
> I'd like to read data from the FPGA on the ROACH2 powerpc, then pack it
> into UDP and send it out over Ethernet. Is there a straightforward and
> reasonably efficient way to read registers/bram from the FPGA on the ROACH2
> powerpc? Better yet, has anyone implemented something already that they're
> happy to share? We need a ~0.5MB transfer, triggered when a register is
> incremented (once per second), so speed shouldn't be a major issue.
>
> I know on the ROACH1 the BRAMs were available in /proc, and that the new
> tcpborphserver3 on the ROACH2 memory maps through the 'device nodes' in
> /dev/roach, but I'm not clear on how to read desired registers on the PPC
> though this...
>
> Thanks
> Danny
>
>


Re: [casper] Reading ROACH2 FPGA BRAMs on PowerPC

2015-02-16 Thread David MacMahon
Hi, Danny,

I think you have two options:

1) Learn about mmap ("man mmap" is a good place to start) and use the info in 
core_info.tab (or the newer "*.info" files) to find the offsets to the 
device(s) you want.

OR

2) Use the KATCP "read" command which should be fairly fast if you run the 
client software on the ROACH2 and connect via "localhost".

Option 1 will run faster, but option 2 may be more than fast enough.  Option 2 
will be easier to develop provided you can find a KATCP client library that is 
compatible with your other (existing?) PPC codebase.  Option 2 will also be 
easier to manage long term since KATCP handles all the bof file specific 
details (e.g. device offsets) for you.

HTH,
Dave

On Feb 16, 2015, at 7:04 PM, Danny Price wrote:

> Hi all
> 
> I'd like to read data from the FPGA on the ROACH2 powerpc, then pack it into 
> UDP and send it out over Ethernet. Is there a straightforward and reasonably 
> efficient way to read registers/bram from the FPGA on the ROACH2 powerpc? 
> Better yet, has anyone implemented something already that they're happy to 
> share? We need a ~0.5MB transfer, triggered when a register is incremented 
> (once per second), so speed shouldn't be a major issue.
> 
> I know on the ROACH1 the BRAMs were available in /proc, and that the new 
> tcpborphserver3 on the ROACH2 memory maps through the 'device nodes' in 
> /dev/roach, but I'm not clear on how to read desired registers on the PPC 
> though this...
> 
> Thanks
> Danny
> 




[casper] Reading ROACH2 FPGA BRAMs on PowerPC

2015-02-16 Thread Danny Price

Hi all

I'd like to read data from the FPGA on the ROACH2 powerpc, then pack it 
into UDP and send it out over Ethernet. Is there a straightforward and 
reasonably efficient way to read registers/bram from the FPGA on the 
ROACH2 powerpc? Better yet, has anyone implemented something already 
that they're happy to share? We need a ~0.5MB transfer, triggered when a 
register is incremented (once per second), so speed shouldn't be a major 
issue.


I know on the ROACH1 the BRAMs were available in /proc, and that the new 
tcpborphserver3 on the ROACH2 memory maps through the 'device nodes' in 
/dev/roach, but I'm not clear on how to read desired registers on the 
PPC though this...


Thanks
Danny