@@ -33,8 +33,10 @@ ARCHITECTURE behavior OF tb_design_top IS
3333 constant c_img_pxls : natural := c_img_cols * c_img_rows;
3434 -- $clog2(c_img_pxls), //160*120=19200 -> 2^15
3535 constant c_nb_img_pxls :natural := 15 ;
36+ constant c_nb_img_cols :natural := 8 ; -- 8 bits to count 160
3637
3738 signal cnt_pxl : unsigned (c_nb_img_pxls- 1 downto 0 );
39+ signal cnt_col : unsigned (c_nb_img_cols- 1 downto 0 );
3840 --Inputs
3941 signal clk : std_logic := '0' ;
4042 signal rst : std_logic := '0' ;
9597 pxl_proc: process
9698 begin
9799 cnt_pxl <= (others => '0' );
100+ cnt_col <= (others => '0' );
98101 capture_newframe <= '0' ;
99102 wea <= '0' ;
100103 wait until rst = '0' ;
@@ -103,6 +106,12 @@ BEGIN
103106 capture_newframe <= '0' ;
104107 wea <= '1' ;
105108 wait until clk'event and clk = '1' ;
109+ if cnt_col < c_img_cols- 1 then
110+ cnt_col <= cnt_col + 1 ;
111+ else
112+ cnt_col <= (others => '0' );
113+ end if ;
114+
106115 if cnt_pxl < c_img_pxls- 1 then
107116 cnt_pxl <= cnt_pxl + 1 ;
108117 else
@@ -115,7 +124,9 @@ BEGIN
115124 end process ;
116125
117126 addrin <= std_logic_vector (cnt_pxl);
118- datain <= std_logic_vector (cnt_pxl(11 downto 0 ));
127+ --datain <= std_logic_vector(cnt_pxl(11 downto 0));
128+ datain <= std_logic_vector (cnt_pxl(11 downto 0 )) when cnt_col < c_img_cols/ 2
129+ else (others => '0' );
119130 addrout <= std_logic_vector (cnt_pxl);
120131
121132END ;
0 commit comments