Nios/tiling
From ASMBits
nios/shiftlPrevious
Nextnios/bswap
You are given a rectangle with width w and height h. There are also rectangular tiles of width w2 and height h2. How many columns and rows of these w2×h2 tiles does it take to completely cover the w×h rectangle?
Write a function that computes the number of columns and rows needed. The function has four parameters: w, h, w2, and h2. Return the number of columns (i.e., in the w direction) in r2, and the number of rows (in the h direction) in r3.
The tiles cannot be rotated. The four input parameters are 32-bit unsigned integers. w2 and h2 are guaranteed to not be zero.
Expected solution length: Around 10 lines.
Sample Input
9 × 8 rectangle, 3 × 2 tiles
Sample Output
r2=3, r3=4
nios/shiftlPrevious
Nextnios/bswap