bharath_kumar
Newbie level 2
HI all ,
assume r1 = 182 , g1 = 180 ; b1 = 183 ;
Case 1 : I used the code
Case 2 : I used the code
In case (2) , i am getting the y0 180. ( this value is fine).
But in case (1) , i am getting 0 (zero) as out put.
I used the model SIM simulator.
Question : What is the problem with shift operator ???
Please answer me.
Best Regards
Bharath Kumar
Code:
reg [7:0] y0 ; // reg
// r1 , g1 and b1 are 8 bit inputs.
Case 1 : I used the code
Code:
yo <= ( ( 7'd77*r0 )+( 8'd150*g0 )+( 5'd29*b0 ) ) >> 8 ;
Case 2 : I used the code
Code:
y0 <= ( ( 7'd77*r0 )+( 8'd150*g0 )+( 5'd29*b0 ) ) / 256 ;
In case (2) , i am getting the y0 180. ( this value is fine).
But in case (1) , i am getting 0 (zero) as out put.
I used the model SIM simulator.
Question : What is the problem with shift operator ???
Please answer me.
Best Regards
Bharath Kumar
Last edited by a moderator: