# help me with the interview quiz pls!

Status
Not open for further replies.

#### ecse

##### Junior Member level 2
write synthesizable code for the equation below:

A[4:0]=B[8:0]*218/( 64*8 )-90/8

It is up to you to figure out the format of the A and B, just using minimum
number of the sythesizable gate counts.

Any good suggestion? or a link of reference?

ecse

#### penrico

##### Full Member level 5
I vote use a look up table, like a simple 256x4 bit flash or eeprom, in address you can put the B data, and result is in data lines. Data in flash is the result of formula you posted.

#### roli

##### Full Member level 5
Usualy when asked this kind of Quiz - people DO NOT expect you to propose an EPROM based solution. This is too easy.

They want to check your ability to design logic for Arithmetic functions, deal with Signed Arithmetic, Saturation of vectors, etc.

Hint: In the formula above you MUST saturate correctly [signed saturation] the result 5-bit vector AFTER the signed 2's complement arithmetic was done [correctly] for the 9-bit (and other) vectors. You also must correctly relate to the sign bit.

Why ? Because the above is not straight-forward with Synthesizable code !!!

#### Al Farouk

##### Full Member level 4
I suggest the following
1- put 90/8 (45/2) as a constant in 2's complement form.
2- define A,B as integeres with restricted range.
3- 218/64*8 = 109/64*4 = 109/ 2exp7 --->
a: express 109 as a constant
b: use one of the techniques used for contant multiplication as (Booth algorithem) for example.
c: shift the output of multiplication left by 7 position. (note the output of shift operation it may cancel steos of multipication in the previous step)
4- do the final substraction operation.

regards

Status
Not open for further replies.