/images/avatar.webp

RISC-V Instruction Immediates - Notes

RISC-V ISA has efficient instructions encodings which are devised to reduce the hardware complexity. Important portion of instruction encoding includes immediates which are sign-extended and packed towards the leftmost available bits in the instruction. To make immediate encoding efficient the sign-bit for all immediates in all applicable formats is always 31st bit in the 32-bit instruction. Assembler encodes the numbers in instructions as per the ISA when code is assembled. When code is executed those encodings are converted into 32-bit immediate values by the CPU which are then used to generate the addresses/offsets/numbers according to the executed instruction.

Numpy Refresher

Numpy is a package used for scientific computing in python. Numpy’s core is implemented in C/C++ providing fast implementations of matrices operations. Numpy also utilizes the processors SIMD and other instructions to make implementation faster 1 What is NumpyNumpy is a package used for scientific computing in python. Numpy’s core is implemented in C/C++ providing fast implementations of matrices operations. Numpy also utilizes the processors SIMD and other instructions to make implementation faster.

RGB Image Channels Plot using Numpy

My curiosity of understanding pixels better made me plot the color channels of an RGB image separately. I was not in pursuit of any hi-fi results but just 3 plots of Red, Green, Blue channels separately. To accomplish this all I needed was slicing and chopping of Numpy arrays. In starting, I was only looking for a simple way to achieve this - but found 3 ways, each little different in terms of numpy function used.