[Milkymist-devel] Is there any bugs in TMU2?

Sébastien Bourdeauducq sebastien.bourdeauducq at lekernel.net
Mon Mar 1 01:21:57 PST 2010


Hi,

On Monday 01 March 2010 10:06:30 FangJacky wrote:
> I make the test bench run in Cygwin today.
> 
> Using the origin tb_tmu2.v,  I  just make both the squarew and squareh to
>  100, the others settings keep originally.
> 
> I got a result out.png, please see the attached files. I think there is a
>  mapping error on the TMU2 core.
> 
> in the tb_tmu2.v, the CSR registers settings is:
> 
>  csrwrite(32'h04, 1); /* hmeshlast */
>  csrwrite(32'h08, 1); /* vmeshlast */
>  csrwrite(32'h1C, 640); /* texhres */
>  csrwrite(32'h20, 480); /* texhres */
>  csrwrite(32'h40, 100); /* squarew */
>  csrwrite(32'h44, 100); /* squareh */
> 
> and from the statements
> 
>   if(wbm_adr_o[2])
>    wbm_dat_i = y*640*64 ;//- 100*64;
>   else
>    wbm_dat_i = x*480*64 ;//-100*64;
> 
> texture coordinates will be:
> 
> v(0,0)  = (0, 0);
> 
> v(0,1)  = (640*64,0);
> 
> v(1,0)  = (0,480*64);
> 
> v(1,1)  = (640*64,480*64);
> 
> These settings will map the original picture(in size 640x480)  full into a
>  rectangle in size 100x100, Is it right?

No. You multiplied the X coordinate by 480*64 and the Y coordinate by 640*64, 
instead of doing the opposite.

> But from the result picture, it seems that it losts some pixels() in the
>  right of the picture? and it repeat the
> 
> last pixel line from 75 to 100.

This is the expected behaviour in this case. Repeating the last line is due to 
the texture clamping feature (enabled by default).

>  I don't know why the original picture can't
>  map into the destination mesh with 100x100 pixels?

Fix your texture coordinates and it should do it (works for me):

if(wbm_adr_o[2])
    wbm_dat_i = y*480*64;
else
    wbm_dat_i = x*640*64;

Can you try to simulate your other problem (with the 3x3 mesh)?

Thanks,
Sébastien


More information about the Devel mailing list