Hi Jon,

To elaborate on Mark's suggestion, I include a python function I've
written to do just what you're trying to do:

def bramw(fpga, bname, odata, samples=2048):
        b_0=struct.pack('>'+str(samples)+'l',*odata)
        fpga.write(bname,b_0)
        return

Where 'fpga' is your FpgaClient variable, 'bname' is a string that
contains the name of the BRAM, 'odata' is an array that contains the
data you want to write, and 'samples' is an optional variable that
specifies the length of data with 2048 being default.

Usage:

>bramw(fpga, 'Shared_BRAM', test_data, 32)

Best,
Laura


On Thu, Jan 6, 2011 at 4:39 PM, Mark Wagner <[email protected]> wrote:
> Hi Jon,
> I think you may want to try using the struct.pack() method to format your
> data before the fpga.write() call.
> Best,
> Mark
>
> On Thu, Jan 6, 2011 at 1:22 PM, Jon Losh <[email protected]> wrote:
>>
>> Hi,
>>
>> I'm using Corr in Python to write test data to BRAMs on a roach, but
>> whenever I try to write something using the fpga.write() method, it writes
>> the ASCII codes rather than the numbers themselves. The fpga.write() method
>> also won't take anything but a string as its input, and I can't find any
>> detailed documentation for Corr for how to fix this.
>>
>> I found some references to an "ioreg" variable that I can set to make the
>> roach interpret things as binary rather than ASCII, but I can't figure out
>> what process number my BORPH file is.
>>
>> Anyone have any hot ideas?
>
>

Reply via email to