Books | Codec_Books | Fig_19
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use work.components.all;
entity Structm is
port (
bit0 : in std_logic;
bitcnt_count : out std_logic;
bitcnt_reset : out std_logic;
br_en : out std_logic;
clk : in std_logic;
cnt_count : out std_logic;
cnt_elem_count : out std_logic;
cnt_elem_reset : out std_logic;
cnt_m1_m3_count : out std_logic;
cnt_m1_m3_en : out std_logic;
cnt_m1_m3_rcount : out std_logic;
cnt_m2_count : out std_logic;
cnt_m2_reset : out std_logic;
cnt_reset : out std_logic;
codcomplete_reset : out std_logic;
codcomplete_set : out std_logic;
comp16_1_dout : in std_logic;
comp16_2_dout : in std_logic;
comp16_5_dout : in std_logic;
comp16_7_dout : in std_logic;
comp4_12_dout : in std_logic;
comp8_10_dout : in std_logic;
comp8_11_dout : in std_logic;
comp8_13_dout : in std_logic;
comp8_14_dout : in std_logic;
comp8_3_dout : in std_logic;
comp8_4_dout : in std_logic;
comp8_6_dout : in std_logic;
comp8_8_dout : in std_logic;
comp8_9_dout : in std_logic;
ctr_mux0_0 : out std_logic;
ctr_mux0_1 : out std_logic;
ctr_mux1_0 : out std_logic;
ctr_mux1_1 : out std_logic;
ctr_mux1_2 : out std_logic;
ctr_mux2 : out std_logic;
ctr_mux3_0 : out std_logic;
ctr_mux3_1 : out std_logic;
ctr_mux3_2 : out std_logic;
ctr_mux3_3 : out std_logic;
ctr_mux4_0 : out std_logic;
ctr_mux4_1 : out std_logic;
ctr_mux4_2 : out std_logic;
ctr_mux5_0 : out std_logic;
ctr_mux5_1 : out std_logic;
ctr_mux5_2 : out std_logic;
ctr_mux5_3 : out std_logic;
ctr_mux6_0 : out std_logic;
ctr_mux6_1 : out std_logic;
decodcomplete_reset : out std_logic;
decodcomplete_set : out std_logic;
dma : in std_logic;
ext_rdwr : in std_logic;
idle : out std_logic;
m : in std_logic;
m1_wren : out std_logic;
m2_wren : out std_logic;
m3_wren : out std_logic;
mac1_count : out std_logic;
mac1_en : out std_logic;
mac1_reset : out std_logic;
mac2_count : out std_logic;
mac2_reset : out std_logic;
rbyte_en_0 : out std_logic;
rbyte_en_1 : out std_logic;
rd_en : out std_logic;
relem_en : out std_logic;
rfilelength_en : out std_logic;
rlengthd_en : out std_logic;
rmask_en : out std_logic;
rmax_en : out std_logic;
rmin_en : out std_logic;
rst : in std_logic;
rt1_en : out std_logic;
rt2_en : out std_logic;
rtemp1_en : out std_logic;
rwrite2m2_en : out std_logic;
rwrite2m3_en : out std_logic;
s : in std_logic;
shcnt_count : out std_logic;
shcnt_reset : out std_logic;
tempreg16_1_en : out std_logic;
tempreg8_1_en : out std_logic
);
end Structm;
architecture ARC_Structm of Structm is
type FSMStates is (
a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15,
a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28, a29, a30,
a31, a32, a33, a34, a35, a36, a37, a38, a39, a40, a41, a42, a43, a44, a45,
a46, a47, a48, a49, a50, a51, a52, a53, a54, a55, a56, a57, a58, a59, a60,
a61, a62, a63, a64, a65, a66, a67, a68, a69, a70, a71, a72, a73, a74, a75,
a76, a77, a78, a79, a80, a81, a82, a83, a84
);
signal currentState : FSMStates;
begin
process (clk , rst)
procedure proc_Structm is
begin
bitcnt_count <= '0';
bitcnt_reset <= '0';
br_en <= '0';
cnt_count <= '0';
cnt_elem_count <= '0';
cnt_elem_reset <= '0';
cnt_m1_m3_count <= '0';
cnt_m1_m3_en <= '0';
cnt_m1_m3_rcount <= '0';
cnt_m2_count <= '0';
cnt_m2_reset <= '0';
cnt_reset <= '0';
codcomplete_reset <= '0';
codcomplete_set <= '0';
ctr_mux0_0 <= '0';
ctr_mux0_1 <= '0';
ctr_mux1_0 <= '0';
ctr_mux1_1 <= '0';
ctr_mux1_2 <= '0';
ctr_mux2 <= '0';
ctr_mux3_0 <= '0';
ctr_mux3_1 <= '0';
ctr_mux3_2 <= '0';
ctr_mux3_3 <= '0';
ctr_mux4_0 <= '0';
ctr_mux4_1 <= '0';
ctr_mux4_2 <= '0';
ctr_mux5_0 <= '0';
ctr_mux5_1 <= '0';
ctr_mux5_2 <= '0';
ctr_mux5_3 <= '0';
ctr_mux6_0 <= '0';
ctr_mux6_1 <= '0';
decodcomplete_reset <= '0';
decodcomplete_set <= '0';
idle <= '0';
m1_wren <= '0';
m2_wren <= '0';
m3_wren <= '0';
mac1_count <= '0';
mac1_en <= '0';
mac1_reset <= '0';
mac2_count <= '0';
mac2_reset <= '0';
rbyte_en_0 <= '0';
rbyte_en_1 <= '0';
rd_en <= '0';
relem_en <= '0';
rfilelength_en <= '0';
rlengthd_en <= '0';
rmask_en <= '0';
rmax_en <= '0';
rmin_en <= '0';
rt1_en <= '0';
rt2_en <= '0';
rtemp1_en <= '0';
rwrite2m2_en <= '0';
rwrite2m3_en <= '0';
shcnt_count <= '0';
shcnt_reset <= '0';
tempreg16_1_en <= '0';
tempreg8_1_en <= '0';
case currentState is
when a1 =>
if (s and dma and ext_rdwr) = '1' then
ctr_mux6_1 <= '1';
m1_wren <= '1';
currentState <= a2;
elsif (s and dma and not ext_rdwr and m) = '1' then
ctr_mux6_1 <= '1';
currentState <= a5;
elsif (s and dma and not ext_rdwr and not m) = '1' then
ctr_mux6_1 <= '1';
currentState <= a6;
elsif (s and not dma and bit0) = '1' then
decodcomplete_reset <= '1';
currentState <= a3;
elsif (s and not dma and not bit0) = '1' then
codcomplete_reset <= '1';
relem_en <= '1';
currentState <= a4;
else
currentState <= a1;
idle <= '1';
end if;
when a2 =>
cnt_m1_m3_count <= '1';
currentState <= a1;
idle <= '1';
when a3 =>
decodcomplete_reset <= '1';
mac2_reset <= '1';
currentState <= a7;
when a4 =>
ctr_mux5_2 <= '1';
ctr_mux5_1 <= '1';
br_en <= '1';
cnt_reset <= '1';
cnt_m2_reset <= '1';
mac2_reset <= '1';
currentState <= a8;
when a5 =>
ctr_mux3_2 <= '1';
ctr_mux6_1 <= '1';
currentState <= a1;
idle <= '1';
when a6 =>
ctr_mux6_1 <= '1';
ctr_mux3_3 <= '1';
ctr_mux3_1 <= '1';
currentState <= a1;
idle <= '1';
when a7 =>
currentState <= a9;
when a8 =>
cnt_m2_count <= '1';
m2_wren <= '1';
currentState <= a10;
when a9 =>
br_en <= '1';
mac2_count <= '1';
currentState <= a11;
when a10 =>
mac2_count <= '1';
currentState <= a12;
when a11 =>
if (comp8_6_dout) = '1' then
currentState <= a13;
else
currentState <= a9;
end if;
when a12 =>
if (comp8_3_dout) = '1' then
rfilelength_en <= '1';
currentState <= a14;
else
cnt_count <= '1';
currentState <= a8;
end if;
when a13 =>
br_en <= '1';
mac2_count <= '1';
currentState <= a15;
when a14 =>
cnt_elem_reset <= '1';
rtemp1_en <= '1';
currentState <= a16;
when a15 =>
if (comp8_6_dout) = '1' then
currentState <= a18;
else
currentState <= a9;
end if;
when a16 =>
ctr_mux6_0 <= '1';
currentState <= a17;
when a17 =>
ctr_mux5_1 <= '1';
br_en <= '1';
mac1_count <= '1';
currentState <= a19;
when a18 =>
br_en <= '1';
mac2_count <= '1';
currentState <= a20;
when a19 =>
cnt_elem_count <= '1';
rmin_en <= '1';
rmax_en <= '1';
currentState <= a21;
when a20 =>
if (comp8_6_dout) = '1' then
currentState <= a23;
else
currentState <= a9;
end if;
when a21 =>
ctr_mux6_0 <= '1';
currentState <= a22;
when a22 =>
ctr_mux5_1 <= '1';
br_en <= '1';
mac1_count <= '1';
currentState <= a24;
when a23 =>
br_en <= '1';
mac2_count <= '1';
currentState <= a25;
when a24 =>
if (comp8_10_dout) = '1' then
rmax_en <= '1';
currentState <= a26;
elsif (not comp8_10_dout and comp8_9_dout) = '1' then
rmin_en <= '1';
currentState <= a26;
elsif (not comp8_10_dout and not comp8_9_dout and comp16_5_dout) = '1' then
br_en <= '1';
ctr_mux5_3 <= '1';
currentState <= a29;
else
cnt_elem_count <= '1';
currentState <= a21;
end if;
when a25 =>
if (comp8_6_dout) = '1' then
mac1_reset <= '1';
shcnt_reset <= '1';
currentState <= a27;
else
currentState <= a9;
end if;
when a26 =>
if (comp16_5_dout) = '1' then
br_en <= '1';
ctr_mux5_3 <= '1';
currentState <= a29;
else
cnt_elem_count <= '1';
currentState <= a21;
end if;
when a27 =>
currentState <= a28;
when a28 =>
br_en <= '1';
mac2_count <= '1';
currentState <= a30;
when a29 =>
cnt_m2_count <= '1';
m2_wren <= '1';
currentState <= a31;
when a30 =>
rmin_en <= '1';
currentState <= a32;
when a31 =>
mac2_count <= '1';
currentState <= a33;
when a32 =>
currentState <= a34;
when a33 =>
ctr_mux3_3 <= '1';
ctr_mux5_0 <= '1';
ctr_mux1_1 <= '1';
ctr_mux3_0 <= '1';
ctr_mux4_0 <= '1';
rd_en <= '1';
currentState <= a35;
when a34 =>
br_en <= '1';
mac2_count <= '1';
currentState <= a36;
when a35 =>
cnt_reset <= '1';
cnt_elem_reset <= '1';
currentState <= a37;
when a36 =>
ctr_mux3_3 <= '1';
shcnt_reset <= '1';
rmask_en <= '1';
ctr_mux4_0 <= '1';
ctr_mux4_1 <= '1';
rlengthd_en <= '1';
currentState <= a38;
when a37 =>
if (comp8_14_dout) = '1' then
ctr_mux3_2 <= '1';
ctr_mux5_2 <= '1';
br_en <= '1';
ctr_mux5_0 <= '1';
ctr_mux3_0 <= '1';
rlengthd_en <= '1';
currentState <= a40;
else
ctr_mux3_1 <= '1';
ctr_mux1_1 <= '1';
ctr_mux3_0 <= '1';
ctr_mux1_0 <= '1';
tempreg8_1_en <= '1';
currentState <= a41;
end if;
when a38 =>
cnt_elem_reset <= '1';
currentState <= a39;
when a39 =>
if (comp8_4_dout) = '1' then
br_en <= '1';
ctr_mux5_3 <= '1';
currentState <= a44;
else
currentState <= a45;
end if;
when a40 =>
cnt_m2_count <= '1';
m2_wren <= '1';
currentState <= a42;
when a41 =>
ctr_mux5_2 <= '1';
rd_en <= '1';
currentState <= a43;
when a42 =>
mac2_count <= '1';
currentState <= a46;
when a43 =>
cnt_count <= '1';
currentState <= a37;
when a44 =>
cnt_m1_m3_count <= '1';
m3_wren <= '1';
ctr_mux6_0 <= '1';
currentState <= a47;
when a45 =>
br_en <= '1';
mac2_count <= '1';
currentState <= a48;
when a46 =>
if (comp8_4_dout) = '1' then
tempreg16_1_en <= '1';
currentState <= a51;
else
shcnt_reset <= '1';
rmask_en <= '1';
mac1_en <= '1';
currentState <= a52;
end if;
when a47 =>
mac1_count <= '1';
currentState <= a49;
when a48 =>
ctr_mux5_1 <= '1';
ctr_mux5_0 <= '1';
rt2_en <= '1';
currentState <= a50;
when a49 =>
cnt_elem_count <= '1';
currentState <= a53;
when a50 =>
bitcnt_reset <= '1';
currentState <= a54;
when a51 =>
cnt_m1_m3_en <= '1';
currentState <= a55;
when a52 =>
if (comp8_8_dout) = '1' then
ctr_mux6_0 <= '1';
currentState <= a57;
else
ctr_mux3_0 <= '1';
shcnt_count <= '1';
tempreg8_1_en <= '1';
currentState <= a58;
end if;
when a53 =>
if (comp16_7_dout and comp16_2_dout) = '1' then
decodcomplete_set <= '1';
rwrite2m3_en <= '1';
currentState <= a1;
idle <= '1';
elsif (comp16_7_dout and not comp16_2_dout) = '1' then
currentState <= a28;
else
br_en <= '1';
ctr_mux5_3 <= '1';
currentState <= a44;
end if;
when a54 =>
ctr_mux5_0 <= '1';
ctr_mux3_0 <= '1';
rt1_en <= '1';
ctr_mux1_0 <= '1';
ctr_mux4_1 <= '1';
currentState <= a56;
when a55 =>
if (comp16_1_dout) = '1' then
codcomplete_set <= '1';
rwrite2m2_en <= '1';
currentState <= a1;
idle <= '1';
else
cnt_elem_reset <= '1';
rtemp1_en <= '1';
currentState <= a16;
end if;
when a56 =>
ctr_mux3_1 <= '1';
tempreg8_1_en <= '1';
currentState <= a59;
when a57 =>
ctr_mux5_1 <= '1';
br_en <= '1';
mac1_count <= '1';
currentState <= a60;
when a58 =>
ctr_mux4_2 <= '1';
rmask_en <= '1';
currentState <= a52;
when a59 =>
ctr_mux5_2 <= '1';
rt2_en <= '1';
currentState <= a61;
when a60 =>
ctr_mux5_1 <= '1';
ctr_mux5_0 <= '1';
rt1_en <= '1';
currentState <= a62;
when a61 =>
tempreg8_1_en <= '1';
currentState <= a63;
when a62 =>
ctr_mux3_2 <= '1';
ctr_mux3_1 <= '1';
ctr_mux5_0 <= '1';
rt2_en <= '1';
ctr_mux1_1 <= '1';
ctr_mux4_0 <= '1';
cnt_m1_m3_rcount <= '1';
currentState <= a64;
when a63 =>
ctr_mux2 <= '1';
rbyte_en_1 <= '1';
ctr_mux0_1 <= '1';
rbyte_en_0 <= '1';
currentState <= a65;
when a64 =>
shcnt_reset <= '1';
currentState <= a66;
when a65 =>
if (comp8_13_dout) = '1' then
bitcnt_count <= '1';
shcnt_count <= '1';
currentState <= a68;
else
rbyte_en_0 <= '1';
ctr_mux0_0 <= '1';
currentState <= a69;
end if;
when a66 =>
ctr_mux5_0 <= '1';
ctr_mux3_0 <= '1';
rt1_en <= '1';
ctr_mux1_0 <= '1';
ctr_mux4_1 <= '1';
currentState <= a67;
when a67 =>
ctr_mux3_1 <= '1';
tempreg8_1_en <= '1';
currentState <= a70;
when a68 =>
if (comp8_11_dout) = '1' then
shcnt_reset <= '1';
br_en <= '1';
ctr_mux5_0 <= '1';
ctr_mux4_0 <= '1';
ctr_mux1_2 <= '1';
currentState <= a72;
elsif (not comp8_11_dout and comp4_12_dout and comp16_7_dout and comp16_2_dout) = '1' then
decodcomplete_set <= '1';
rwrite2m3_en <= '1';
currentState <= a1;
idle <= '1';
elsif (not comp8_11_dout and comp4_12_dout and comp16_7_dout and not comp16_2_dout) = '1' then
currentState <= a28;
elsif (not comp8_11_dout and comp4_12_dout and not comp16_7_dout) = '1' then
currentState <= a45;
else
ctr_mux5_0 <= '1';
ctr_mux3_0 <= '1';
rt1_en <= '1';
ctr_mux1_0 <= '1';
ctr_mux4_1 <= '1';
currentState <= a56;
end if;
when a69 =>
bitcnt_count <= '1';
shcnt_count <= '1';
currentState <= a68;
when a70 =>
ctr_mux5_2 <= '1';
rt2_en <= '1';
currentState <= a71;
when a71 =>
tempreg8_1_en <= '1';
currentState <= a73;
when a72 =>
cnt_m1_m3_count <= '1';
m3_wren <= '1';
ctr_mux6_0 <= '1';
currentState <= a74;
when a73 =>
ctr_mux2 <= '1';
rbyte_en_1 <= '1';
ctr_mux0_1 <= '1';
rbyte_en_0 <= '1';
currentState <= a75;
when a74 =>
mac1_count <= '1';
currentState <= a76;
when a75 =>
if (comp8_13_dout) = '1' then
bitcnt_count <= '1';
shcnt_count <= '1';
currentState <= a78;
else
rbyte_en_0 <= '1';
ctr_mux0_0 <= '1';
currentState <= a79;
end if;
when a76 =>
cnt_elem_count <= '1';
rbyte_en_1 <= '1';
rbyte_en_0 <= '1';
currentState <= a77;
when a77 =>
if (comp4_12_dout and comp16_7_dout and comp16_2_dout) = '1' then
decodcomplete_set <= '1';
rwrite2m3_en <= '1';
currentState <= a1;
idle <= '1';
elsif (comp4_12_dout and comp16_7_dout and not comp16_2_dout) = '1' then
currentState <= a28;
elsif (comp4_12_dout and not comp16_7_dout) = '1' then
currentState <= a45;
else
ctr_mux5_0 <= '1';
ctr_mux3_0 <= '1';
rt1_en <= '1';
ctr_mux1_0 <= '1';
ctr_mux4_1 <= '1';
currentState <= a56;
end if;
when a78 =>
if (comp4_12_dout) = '1' then
br_en <= '1';
ctr_mux5_0 <= '1';
ctr_mux5_3 <= '1';
currentState <= a80;
elsif (not comp4_12_dout and comp8_11_dout and comp16_5_dout and comp16_1_dout) = '1' then
codcomplete_set <= '1';
rwrite2m2_en <= '1';
currentState <= a1;
idle <= '1';
elsif (not comp4_12_dout and comp8_11_dout and comp16_5_dout and not comp16_1_dout) = '1' then
cnt_elem_reset <= '1';
rtemp1_en <= '1';
currentState <= a16;
elsif (not comp4_12_dout and comp8_11_dout and not comp16_5_dout) = '1' then
cnt_elem_count <= '1';
currentState <= a83;
else
ctr_mux5_0 <= '1';
ctr_mux3_0 <= '1';
rt1_en <= '1';
ctr_mux1_0 <= '1';
ctr_mux4_1 <= '1';
currentState <= a67;
end if;
when a79 =>
bitcnt_count <= '1';
shcnt_count <= '1';
currentState <= a78;
when a80 =>
cnt_m2_count <= '1';
m2_wren <= '1';
currentState <= a81;
when a81 =>
mac2_count <= '1';
currentState <= a82;
when a82 =>
rbyte_en_1 <= '1';
rbyte_en_0 <= '1';
bitcnt_reset <= '1';
currentState <= a84;
when a83 =>
ctr_mux6_0 <= '1';
currentState <= a57;
when a84 =>
if (comp8_11_dout and comp16_5_dout and comp16_1_dout) = '1' then
codcomplete_set <= '1';
rwrite2m2_en <= '1';
currentState <= a1;
idle <= '1';
elsif (comp8_11_dout and comp16_5_dout and not comp16_1_dout) = '1' then
cnt_elem_reset <= '1';
rtemp1_en <= '1';
currentState <= a16;
elsif (comp8_11_dout and not comp16_5_dout) = '1' then
cnt_elem_count <= '1';
currentState <= a83;
else
ctr_mux5_0 <= '1';
ctr_mux3_0 <= '1';
rt1_en <= '1';
ctr_mux1_0 <= '1';
ctr_mux4_1 <= '1';
currentState <= a67;
end if;
end case;
end proc_Structm;
begin
if (rst = '1') then
bitcnt_count <= '0';
bitcnt_reset <= '0';
br_en <= '0';
cnt_count <= '0';
cnt_elem_count <= '0';
cnt_elem_reset <= '0';
cnt_m1_m3_count <= '0';
cnt_m1_m3_en <= '0';
cnt_m1_m3_rcount <= '0';
cnt_m2_count <= '0';
cnt_m2_reset <= '0';
cnt_reset <= '0';
codcomplete_reset <= '0';
codcomplete_set <= '0';
ctr_mux0_0 <= '0';
ctr_mux0_1 <= '0';
ctr_mux1_0 <= '0';
ctr_mux1_1 <= '0';
ctr_mux1_2 <= '0';
ctr_mux2 <= '0';
ctr_mux3_0 <= '0';
ctr_mux3_1 <= '0';
ctr_mux3_2 <= '0';
ctr_mux3_3 <= '0';
ctr_mux4_0 <= '0';
ctr_mux4_1 <= '0';
ctr_mux4_2 <= '0';
ctr_mux5_0 <= '0';
ctr_mux5_1 <= '0';
ctr_mux5_2 <= '0';
ctr_mux5_3 <= '0';
ctr_mux6_0 <= '0';
ctr_mux6_1 <= '0';
decodcomplete_reset <= '0';
decodcomplete_set <= '0';
idle <= '0';
m1_wren <= '0';
m2_wren <= '0';
m3_wren <= '0';
mac1_count <= '0';
mac1_en <= '0';
mac1_reset <= '0';
mac2_count <= '0';
mac2_reset <= '0';
rbyte_en_0 <= '0';
rbyte_en_1 <= '0';
rd_en <= '0';
relem_en <= '0';
rfilelength_en <= '0';
rlengthd_en <= '0';
rmask_en <= '0';
rmax_en <= '0';
rmin_en <= '0';
rt1_en <= '0';
rt2_en <= '0';
rtemp1_en <= '0';
rwrite2m2_en <= '0';
rwrite2m3_en <= '0';
shcnt_count <= '0';
shcnt_reset <= '0';
tempreg16_1_en <= '0';
tempreg8_1_en <= '0';
currentState <= a1;
idle <= '1';
elsif (clk'event and clk = '0') then
idle <= '0';
proc_Structm;
end if;
end process;
end ARC_Structm;