سلام .من مدت کمی هست با vhdl کار می کنم. کسی می تونه بهم کمک کنه تحلیل کاملی رو این کد انجام بدم؟اگه یه قسنت کوچیکی رو هم کمک کنید ممنون میشم.
begin
window_3x3x: window_3x3
generic map (
vwidth => 8
)
port map (
Clk => Clk,
RSTn => RSTn,
D => D,
w11 => w11,
w12 => w12,
w13 => w13,
w21 => w21,
w22 => w22,
w23 => w23,
w31 => w31,
w32 => w32,
w33 => w33,
DV => DVw
);
rc_counterx: rc_counter
generic map (
num_cols => 128,
num_rows => 128
)
port map (
Clk => Clk,
RSTn => RSTn,
En => RSTn,
ColPos => ColPos,
RowPos => RowPos
);
convproc: process(Clk,RSTn)
begin
if RSTn = '0' then
m0 <= (others=>'0'
;
m1 <= (others=>'0'
;
m2 <= (others=>'0'
;
m3 <= (others=>'0'
;
m4 <= (others=>'0'
;
m5 <= (others=>'0'
;
m6 <= (others=>'0'
;
m7 <= (others=>'0'
;
m8 <= (others=>'0'
;
a10 <= (others=>'0'
;
a11 <= (others=>'0'
;
a12 <= (others=>'0'
;
a13 <= (others=>'0'
;
a14 <= (others=>'0'
;
a20 <= (others=>'0'
;
a21 <= (others=>'0'
;
a22 <= (others=>'0'
;
a30 <= (others=>'0'
;
a31 <= (others=>'0'
;
a40 <= (others=>'0'
;
d0 <= (others=>'0'
;
Dout <= (others=>'0'
;
DV <= '0';
ColPos_c <= 0;
rt1 <= 0;
rt2 <= 0;
rt3 <= 0;
7 7
rt4 <= 0;
rt5 <= 0;
rt6 <= 0;
rt7 <= 0;
rt8 <= 0;
RowPos_c <= 0;
flag <= '0';
elsif rising_edge(Clk) then
-- counter correction
ColPos_c <= ((ColPos-8) mod 128);
rt1 <= ((RowPos-1) mod 128);
rt2 <= rt1;
rt3 <= rt2;
rt4 <= rt3;
rt5 <= rt4;
rt6 <= rt5;
rt7 <= rt6;
rt8 <= rt7;
RowPos_c <= rt8;
-- screen edge detection
if (ColPos_c = num_cols-1) or (RowPos_c = num_rows-1) or (ColPos_c
= num_cols-2) or (RowPos_c = 0) then
Dout <= (others=>'0'
;
end if;
if DVw = '1' then
-- window*kernel multipliers
-- this could be optimized by using hardware -specified multipliers
m0 <= signed('0'&w11)*signed(k0);
m1 <= signed('0'&w12)*signed(k1);
m2 <= signed('0'&w13)*signed(k2);
m3 <= signed('0'&w21)*signed(k3);
m4 <= signed('0'&w22)*signed(k4);
m5 <= signed('0'&w23)*signed(k5);
m6 <= signed('0'&w31)*signed(k6);
m7 <= signed('0'&w32)*signed(k7);
m8 <= signed('0'&w33)*signed(k8);
a10 <= (m0(16)&m0)+m1;
a11 <= (m2(16)&m2)+m3;
a12 <= (m4(16)&m4)+m5;
a13 <= (m6(16)&m6)+m7;
a14 <= m8(16)&m8;
a20 <= (a10(17)&a10)+a11;
a21 <= (a12(17)&a12)+a13;
a22 <= a14(17)&a14;
a30 <= (a20(18)&a20)+a21;
a31 <= a22(18)&a22;
a40 <= (a30(19)&a30)+a31;
d0 <= a40(20 downto 3);
if (ColPos_c = num_cols-1) or (RowPos_c = num_rows-1) or
(ColPos_c = num_cols-2) or (RowPos_c = 0) then
Dout <= (others=>'0'
;
else
Dout <= std_logic_vector(d0);
end if;
end if;
if ColPos >= 8 and RowPos >= 1 then
DV <= '1';
flag <= '1';
elsif flag = '1' then
DV <= '1';
else
DV <= '0';
end if;
end if;
end process;
end conv_3x3;
window_3x3x: window_3x3
generic map (
vwidth => 8
)
port map (
Clk => Clk,
RSTn => RSTn,
D => D,
w11 => w11,
w12 => w12,
w13 => w13,
w21 => w21,
w22 => w22,
w23 => w23,
w31 => w31,
w32 => w32,
w33 => w33,
DV => DVw
);
rc_counterx: rc_counter
generic map (
num_cols => 128,
num_rows => 128
)
port map (
Clk => Clk,
RSTn => RSTn,
En => RSTn,
ColPos => ColPos,
RowPos => RowPos
);
convproc: process(Clk,RSTn)
begin
if RSTn = '0' then
m0 <= (others=>'0'

m1 <= (others=>'0'

m2 <= (others=>'0'

m3 <= (others=>'0'

m4 <= (others=>'0'

m5 <= (others=>'0'

m6 <= (others=>'0'

m7 <= (others=>'0'

m8 <= (others=>'0'

a10 <= (others=>'0'

a11 <= (others=>'0'

a12 <= (others=>'0'

a13 <= (others=>'0'

a14 <= (others=>'0'

a20 <= (others=>'0'

a21 <= (others=>'0'

a22 <= (others=>'0'

a30 <= (others=>'0'

a31 <= (others=>'0'

a40 <= (others=>'0'

d0 <= (others=>'0'

Dout <= (others=>'0'

DV <= '0';
ColPos_c <= 0;
rt1 <= 0;
rt2 <= 0;
rt3 <= 0;
7 7
rt4 <= 0;
rt5 <= 0;
rt6 <= 0;
rt7 <= 0;
rt8 <= 0;
RowPos_c <= 0;
flag <= '0';
elsif rising_edge(Clk) then
-- counter correction
ColPos_c <= ((ColPos-8) mod 128);
rt1 <= ((RowPos-1) mod 128);
rt2 <= rt1;
rt3 <= rt2;
rt4 <= rt3;
rt5 <= rt4;
rt6 <= rt5;
rt7 <= rt6;
rt8 <= rt7;
RowPos_c <= rt8;
-- screen edge detection
if (ColPos_c = num_cols-1) or (RowPos_c = num_rows-1) or (ColPos_c
= num_cols-2) or (RowPos_c = 0) then
Dout <= (others=>'0'

end if;
if DVw = '1' then
-- window*kernel multipliers
-- this could be optimized by using hardware -specified multipliers
m0 <= signed('0'&w11)*signed(k0);
m1 <= signed('0'&w12)*signed(k1);
m2 <= signed('0'&w13)*signed(k2);
m3 <= signed('0'&w21)*signed(k3);
m4 <= signed('0'&w22)*signed(k4);
m5 <= signed('0'&w23)*signed(k5);
m6 <= signed('0'&w31)*signed(k6);
m7 <= signed('0'&w32)*signed(k7);
m8 <= signed('0'&w33)*signed(k8);
a10 <= (m0(16)&m0)+m1;
a11 <= (m2(16)&m2)+m3;
a12 <= (m4(16)&m4)+m5;
a13 <= (m6(16)&m6)+m7;
a14 <= m8(16)&m8;
a20 <= (a10(17)&a10)+a11;
a21 <= (a12(17)&a12)+a13;
a22 <= a14(17)&a14;
a30 <= (a20(18)&a20)+a21;
a31 <= a22(18)&a22;
a40 <= (a30(19)&a30)+a31;
d0 <= a40(20 downto 3);
if (ColPos_c = num_cols-1) or (RowPos_c = num_rows-1) or
(ColPos_c = num_cols-2) or (RowPos_c = 0) then
Dout <= (others=>'0'

else
Dout <= std_logic_vector(d0);
end if;
end if;
if ColPos >= 8 and RowPos >= 1 then
DV <= '1';
flag <= '1';
elsif flag = '1' then
DV <= '1';
else
DV <= '0';
end if;
end if;
end process;
end conv_3x3;