05-14-2008 10:25 PM - edited 05-14-2008 10:33 PM
I used XEmac_mReadReg() to read the control register of 10/100 Emac. It returned 799145984 in decimal because the binary value can not be displayed. How does it match to the 32 bit register?
Or is there a way to read a spercific bit in the control register?
Thanks.
05-16-2008 11:31 PM
The actual register value is stored in binary in the FPGA (e.g. typically 32 discrete flip-flops). XEmac_mReadReg returned an unsigned 32-bit value.
Your print routine you used to display this used a decimal format.
You could either:
-convert this manually
-convert this some other way (e.g. Windows calculator in scientific mode),
799145984 decimal = 2FA20000 hex = 101111101000100000000000000000 binary
-use a hex format when you print (likely the preferred approach)
http://cermics.enpc.fr/~ts/C/FUNCTIONS/format.html
[Note that many of the "print" routines used do not have the full printf functionality to keep the footprint size down]
You generally read the entire 32-bit value and mask as necessary to look at the specific bits you want:
http://crasseux.com/books/ctutorial/Masks.html
http://en.wikipedia.org/wiki/Mask_(computing)#Uses_of_bitmasks
bt