---------------------------------------------------------------------------------- -- Company: -- Engineer: -- -- Create Date: 11:41:21 05/16/2006 -- Design Name: -- Module Name: RoboShellRTL - Behavioral -- Project Name: -- Target Devices: -- Tool versions: -- Description: -- -- Dependencies: -- -- Revision: -- Revision 0.01 - File Created -- Additional Comments: -- ---------------------------------------------------------------------------------- library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity RoboShellRTL is Port ( RSTX : in std_logic; -- Master reset. (0:reset) PWM_LEX : in std_logic; -- PWM Latch Enable(Negedge: Latch) PWM_A : in std_logic_vector(2 downto 0); -- PWM Address[2:0] PWM_E1 : in std_logic; -- PWM Enable1 PWM_E2 : in std_logic; -- PWM Enable2 PWM_E3 : in std_logic; -- PWM Enable3 PWM_E4 : in std_logic; -- PWM Enable4 PWM_SOFT : in std_logic; -- PWM Enable from Soft PWM_IN_SEL : in std_logic; -- PWM Enable Select(0:E, 1:Soft) PWM_Y1 : inout std_logic_vector(7 downto 0); -- PWM Y1[7:0] Bidirectional PWM_Y2 : inout std_logic_vector(7 downto 0); -- PWM Y2[7:0] Bidirectional PWM_Y3 : inout std_logic_vector(7 downto 0); -- PWM Y3[7:0] Bidirectional PWM_Y4 : inout std_logic_vector(7 downto 0); -- PWM Y4[7:0] Bidirectional PWM_OESEL : in std_logic; -- PWM Y Output Enable Select(1:Output) FBSEL_CLK : in std_logic; -- Feedback Select Clock PWM_FB : out std_logic -- PWM Feedback Signal ); end RoboShellRTL; architecture Behavioral of RoboShellRTL is signal adr_latch : std_logic_vector(2 downto 0); signal decode : std_logic_vector(7 downto 0); signal pwm_yo1 : std_logic_vector(7 downto 0); signal pwm_yo2 : std_logic_vector(7 downto 0); signal pwm_yo3 : std_logic_vector(7 downto 0); signal pwm_yo4 : std_logic_vector(7 downto 0); signal pwm_fbi : std_logic_vector(31 downto 0); signal sel_cnt : std_logic_vector(4 downto 0); signal pwm_soft32 : std_logic_vector(31 downto 0); begin process(PWM_LEX) begin if(PWM_LEX'event and PWM_LEX='0')then adr_latch(2 downto 0) <= PWM_A(2 downto 0); end if; end process; process(adr_latch)begin case (adr_latch) is when "000" => decode <="00000001"; when "001" => decode <="00000010"; when "010" => decode <="00000100"; when "011" => decode <="00001000"; when "100" => decode <="00010000"; when "101" => decode <="00100000"; when "110" => decode <="01000000"; when others => decode <="10000000"; end case; end process; loop0 : for i in 0 to 7 generate pwm_yo1(i) <= decode(i) and PWM_E1 when(PWM_IN_SEL='0') else pwm_soft32(i); pwm_yo2(i) <= decode(i) and PWM_E2 when(PWM_IN_SEL='0') else pwm_soft32(i+8); pwm_yo3(i) <= decode(i) and PWM_E3 when(PWM_IN_SEL='0') else pwm_soft32(i+16); pwm_yo4(i) <= decode(i) and PWM_E4 when(PWM_IN_SEL='0') else pwm_soft32(i+24); PWM_Y1(i) <= pwm_yo1(i) when(PWM_OESEL='1') else 'Z'; PWM_Y2(i) <= pwm_yo2(i) when(PWM_OESEL='1') else 'Z'; PWM_Y3(i) <= pwm_yo3(i) when(PWM_OESEL='1') else 'Z'; PWM_Y4(i) <= pwm_yo4(i) when(PWM_OESEL='1') else 'Z'; end generate; process(FBSEL_CLK, RSTX) begin if(RSTX='0') then sel_cnt(4 downto 0) <= "00000"; elsif(FBSEL_CLK'event and FBSEL_CLK='1')then sel_cnt(4 downto 0) <= sel_cnt(4 downto 0) + '1'; end if; end process; pwm_fbi(31 downto 0) <= PWM_Y4(7 downto 0) & PWM_Y3(7 downto 0) & PWM_Y2(7 downto 0) & PWM_Y1(7 downto 0); process(sel_cnt, pwm_fbi)begin case (sel_cnt) is when "00000" => PWM_FB <= pwm_fbi(0); when "00001" => PWM_FB <= pwm_fbi(1); when "00010" => PWM_FB <= pwm_fbi(2); when "00011" => PWM_FB <= pwm_fbi(3); when "00100" => PWM_FB <= pwm_fbi(4); when "00101" => PWM_FB <= pwm_fbi(5); when "00110" => PWM_FB <= pwm_fbi(6); when "00111" => PWM_FB <= pwm_fbi(7); when "01000" => PWM_FB <= pwm_fbi(8); when "01001" => PWM_FB <= pwm_fbi(9); when "01010" => PWM_FB <= pwm_fbi(10); when "01011" => PWM_FB <= pwm_fbi(11); when "01100" => PWM_FB <= pwm_fbi(12); when "01101" => PWM_FB <= pwm_fbi(13); when "01110" => PWM_FB <= pwm_fbi(14); when "01111" => PWM_FB <= pwm_fbi(15); when "10000" => PWM_FB <= pwm_fbi(16); when "10001" => PWM_FB <= pwm_fbi(17); when "10010" => PWM_FB <= pwm_fbi(18); when "10011" => PWM_FB <= pwm_fbi(19); when "10100" => PWM_FB <= pwm_fbi(20); when "10101" => PWM_FB <= pwm_fbi(21); when "10110" => PWM_FB <= pwm_fbi(22); when "10111" => PWM_FB <= pwm_fbi(23); when "11000" => PWM_FB <= pwm_fbi(24); when "11001" => PWM_FB <= pwm_fbi(25); when "11010" => PWM_FB <= pwm_fbi(26); when "11011" => PWM_FB <= pwm_fbi(27); when "11100" => PWM_FB <= pwm_fbi(28); when "11101" => PWM_FB <= pwm_fbi(29); when "11110" => PWM_FB <= pwm_fbi(30); when others => PWM_FB <= pwm_fbi(31); end case; end process; pwm_soft32(0) <= PWM_SOFT when(sel_cnt="00000") else '0'; pwm_soft32(1) <= PWM_SOFT when(sel_cnt="00001") else '0'; pwm_soft32(2) <= PWM_SOFT when(sel_cnt="00010") else '0'; pwm_soft32(3) <= PWM_SOFT when(sel_cnt="00011") else '0'; pwm_soft32(4) <= PWM_SOFT when(sel_cnt="00100") else '0'; pwm_soft32(5) <= PWM_SOFT when(sel_cnt="00101") else '0'; pwm_soft32(6) <= PWM_SOFT when(sel_cnt="00110") else '0'; pwm_soft32(7) <= PWM_SOFT when(sel_cnt="00111") else '0'; pwm_soft32(8) <= PWM_SOFT when(sel_cnt="01000") else '0'; pwm_soft32(9) <= PWM_SOFT when(sel_cnt="01001") else '0'; pwm_soft32(10) <= PWM_SOFT when(sel_cnt="01010") else '0'; pwm_soft32(11) <= PWM_SOFT when(sel_cnt="01011") else '0'; pwm_soft32(12) <= PWM_SOFT when(sel_cnt="01100") else '0'; pwm_soft32(13) <= PWM_SOFT when(sel_cnt="01101") else '0'; pwm_soft32(14) <= PWM_SOFT when(sel_cnt="01110") else '0'; pwm_soft32(15) <= PWM_SOFT when(sel_cnt="01111") else '0'; pwm_soft32(16) <= PWM_SOFT when(sel_cnt="10000") else '0'; pwm_soft32(17) <= PWM_SOFT when(sel_cnt="10001") else '0'; pwm_soft32(18) <= PWM_SOFT when(sel_cnt="10010") else '0'; pwm_soft32(19) <= PWM_SOFT when(sel_cnt="10011") else '0'; pwm_soft32(20) <= PWM_SOFT when(sel_cnt="10100") else '0'; pwm_soft32(21) <= PWM_SOFT when(sel_cnt="10101") else '0'; pwm_soft32(22) <= PWM_SOFT when(sel_cnt="10110") else '0'; pwm_soft32(23) <= PWM_SOFT when(sel_cnt="10111") else '0'; pwm_soft32(24) <= PWM_SOFT when(sel_cnt="11000") else '0'; pwm_soft32(25) <= PWM_SOFT when(sel_cnt="11001") else '0'; pwm_soft32(26) <= PWM_SOFT when(sel_cnt="11010") else '0'; pwm_soft32(27) <= PWM_SOFT when(sel_cnt="11011") else '0'; pwm_soft32(28) <= PWM_SOFT when(sel_cnt="11100") else '0'; pwm_soft32(29) <= PWM_SOFT when(sel_cnt="11101") else '0'; pwm_soft32(30) <= PWM_SOFT when(sel_cnt="11110") else '0'; pwm_soft32(31) <= PWM_SOFT when(sel_cnt="11111") else '0'; end Behavioral;