Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

how to implement the decimal fraction in an equation

Status
Not open for further replies.

sevid

Member level 2
Joined
May 20, 2006
Messages
53
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,711
hi,all
i want to know how to RTL the expression listed as follows:
Y = 0.299R + 0.587G + 0.114B (1)

someone implement it in terms of this methodology:
always@(posedge clk)
if (ena)
begin
y1 <= #1 10'h132 * r + 10'h259 * g + 10'h074 * b;
end
always@(posedge clk)
if (ena)
begin
Y <= #1 (y1[19:10] & {10{!y1[21]}}) | {10{(!y1[21] && y1[20])}};
end
and the result generated is same as that calculated directly by (1),my questions are :
1. who can tell me the arithmetic of the implementation above.
2. any other methods to get it,pls tell me.

thanks in advance
sevid
 

Hi ,

I asked one of my friend who is a Designer .

The above aeqation is multiplied by 1024 and devide the same by 1024 ( which is equavalent to right shit by 10bits are discard 9:0) .


Thanks & Regards
yln
 

thanks

you are right.
i think what he wants is only to save the hardware,and it is a good methodology we should always use.

thanks a lot.
sevid
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top