Skip to content

Code on Quarter Square Multiplication (RISC-V) using Ripes simulator

Notifications You must be signed in to change notification settings

dhatri2003/Quarter-Square-Multiplication-RISC-V

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Quarter Square Multiplication

Overview:

This project explores the concept of quarter square multiplication, an approach attributed to Babylonian mathematics. The method utilizes the property that if (x + y) is odd, then (x - y) will also be odd, allowing for a simplified calculation.

Formula:

The quarter square multiplication is performed using the following formula:

a*b = ¼(a+b)2 - ¼(a-b)2

Algorithm:

int res = 0;

// Quarter square for the sum of x and y
int q1 = (1/4) * ((x + y) ^ 2);

// Quarter square for the difference of x and y
int q2 = (1/4) * ((x - y) ^ 2);

// Formula for Quarter Square Multiplication
int result = q1 - q2;