cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
shijiluoben
Observer
Observer
4,742 Views
Registered: ‎04-10-2008

Read register value

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. 

Message Edited by shijiluoben on 05-14-2008 10:33 PM
0 Kudos
1 Reply
barriet
Xilinx Employee
Xilinx Employee
4,710 Views
Registered: ‎08-13-2007

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

0 Kudos