Nios/7seg8

From ASMBits

nios/7segPrevious

Write a function that will return a 64-bit value that can be used to display a 32-bit number as 8 hexadecimal digits, on 8 seven-segment displays. The 8 displays are separated into two groups of four, with each group of four being controlled by a 32-bit bit pattern (as four groups of 8 bits, with the highest bit of each byte unused).

  • bit[6:0]: right-most digit
  • bit[14:8]
  • bit[22:16]
  • bit[30:24]: left-most digit
unsigned long long hexdisplay(unsigned int number);

Your function will be passed one parameter: The number to be displayed. It should return the 64-bit bit pattern in r2 (least-significant 32 bits) and r3 (most-significant 32 bits).

Use the following bit patterns for digits. You may wish to reuse nios/7seg. 7seg.png


Sample Input

r4=8

Sample Output

r3=0x3f3f3f3f, r2=0x3f3f3f7f

Write your solution here

Upload a source file...