Thank you, Jack. Incrementing the address less often and using struct.unpack worked.
Thanks, Matt On Mon, Sep 10, 2012 at 7:03 PM, Jack Hickish <[email protected]> wrote: > Hi Matt, > > Looking at your model, you have write enable pulses coinciding with every > second address location. Even though a write enable pulse writes two 36 bit > values, each address location addresses a full 72 bit data burst, so if you > want to write the entire qdr you need to increment the address line at half > the rate of your current model. > > I also think there might be an issue with your read code. I think when you > do bin(int(binascii.hexlify(data),16)) and carve up the result in 32 digit > chunks you end up with some bitstring offset errors, because bin(1) returns > 0b1, rather than 0b00000000000000000000000000000001. I'd guess there may > well be some endian issues too. > For reading integers from the qdr, you might be better off with > struct.unpack(), or numpy.fromstring() > > I compiled your model with the address line rate changed (and, FWIW, using > sys_clk2x as the clock source), and read the qdr with a: > data_str = roach.read('qdr0_memory',1024*4) > struct.unpack('>1024L', data_str) #or numpy.fromstring(data_str, > dtype=numpy.uint32).byteswap() > > The data looks like it should (i.e, a counter, starting at 1) > > Hope that helps, > Jack > > > On 10 September 2012 08:00, Matt Strader <[email protected]>wrote: > >> Hi all, >> >> I'm still working on a simple design to write to qdr in firmware and >> read it out using the CPU interface. I can read out the contents of >> qdr0_memory but the results are not what I expect. I have attached a >> model file in which I attempt to write a sequence from a counter to a >> qdr, and the python script that reads the result and prints the bits >> read. I expect the script to print out the simple sequence: >> >> 00000000000000000000000000000001 00000000000000000000000000000010 >> 00000000000000000000000000000011 00000000000000000000000000001000 >> 00000000000000000000000000001001 00000000000000000000000000001010 >> 00000000000000000000000000001011 00000000000000000000000000001100 >> 00000000000000000000000000001101 00000000000000000000000000001110 >> 00000000000000000000000000001111 00000000000000000000000000010000 >> ... >> >> Instead I see something like this: >> >> 10000000000000000001000000000000 10000000000000000010000000000000 >> 00000000000000000111000000000000 00000000000000001000000000000000 >> 10000000000000000011000000000000 10000000000000000100000000000000 >> 00000000000000001111000000000000 00000000000000010000000000000000 >> 10000000000000000101000000000000 10000000000000000110000000000000 >> 00000000000000010111000000000000 00000000000000011000000000000000 >> ... >> >> What am I missing this time? >> >> Thanks, >> Matt >> >> On Mon, Aug 27, 2012 at 12:09 AM, Matt Strader >> <[email protected]> wrote: >> > I have a simple model file that writes a constant value to all of >> > addresses in a QDR in the firmware and then reads it with katcp in >> > python. I thought I'd try this before putting QDR in more complicated >> > designs. When I try reading the QDR, I get all zeros. I have >> > attached my mdl and python script. Could someone tell me what I'm >> > missing? >> > >> > Thanks, >> > Matt >> > >

