OpenCores
URL https://opencores.org/ocsvn/uart_block/uart_block/trunk

Subversion Repositories uart_block

[/] [uart_block/] [trunk/] [hdl/] [iseProject/] [uart_control.vhd] - Diff between revs 10 and 11

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 10 Rev 11
Line 22... Line 22...
end uart_control;
end uart_control;
 
 
architecture Behavioral of uart_control is
architecture Behavioral of uart_control is
signal config_clk : std_logic_vector((nBitsLarge-1) downto 0);
signal config_clk : std_logic_vector((nBitsLarge-1) downto 0);
signal config_baud : std_logic_vector((nBitsLarge-1) downto 0);
signal config_baud : std_logic_vector((nBitsLarge-1) downto 0);
signal byte_to_receive : std_logic_vector((nBitsLarge-1) downto 0);
signal byte_to_receive : std_logic_vector((nBits-1) downto 0);
signal byte_to_transmitt : std_logic_vector((nBitsLarge-1) downto 0);
signal byte_to_transmitt : std_logic_vector((nBits-1) downto 0);
signal controlStates : uartControl;
signal controlStates : uartControl;
 
 
signal sigDivRst : std_logic;
signal sigDivRst : std_logic;
signal sigDivDone : std_logic;
signal sigDivDone : std_logic;
signal sigDivQuotient : std_logic_vector((nBitsLarge-1) downto 0);
signal sigDivQuotient : std_logic_vector((nBitsLarge-1) downto 0);
Line 68... Line 68...
                                                DAT_O <= config_clk;
                                                DAT_O <= config_clk;
                                        when "01" =>
                                        when "01" =>
                                                DAT_O <= config_baud;
                                                DAT_O <= config_baud;
                                        when "10" =>
                                        when "10" =>
                                                -- Byte that will be transmitted
                                                -- Byte that will be transmitted
                                                DAT_O <= "0000000000000000000000000" & byte_to_transmitt;
                                                DAT_O <= "000000000000000000000000" & byte_to_transmitt;
                                        when "11" =>
                                        when "11" =>
                                                -- Byte that will be received
                                                -- Byte that will be received
                                                DAT_O <= "0000000000000000000000000" & byte_to_receive;
                                                DAT_O <= "000000000000000000000000" & byte_to_receive;
                                        when others =>
                                        when others =>
                                                null;
                                                null;
                                end case;
                                end case;
                        end if;
                        end if;
                end if;
                end if;
Line 86... Line 86...
        begin
        begin
                if rst = '1' then
                if rst = '1' then
                        config_clk <= (others => '0');
                        config_clk <= (others => '0');
                        config_baud <= (others => '0');
                        config_baud <= (others => '0');
                        byte_to_transmitt <= (others => '0');
                        byte_to_transmitt <= (others => '0');
                        byte_to_receive <= (others => '0');
 
                elsif rising_edge(clk) then
                elsif rising_edge(clk) then
                        if (WE = '1') and (start = '1') then
                        if (WE = '1') and (start = '1') then
                                case reg_addr is
                                case reg_addr is
                                        when "00" =>
                                        when "00" =>
                                                config_clk <= DAT_I;
                                                config_clk <= DAT_I;
Line 112... Line 111...
        variable clk_configured : std_logic;
        variable clk_configured : std_logic;
        variable div_result_baud_wait : std_logic_vector ((nBitsLarge-1) downto 0);
        variable div_result_baud_wait : std_logic_vector ((nBitsLarge-1) downto 0);
        begin
        begin
                if rst = '1' then
                if rst = '1' then
                        controlStates <= idle;
                        controlStates <= idle;
                        baud_configured <= '0';
                        baud_configured := '0';
                        clk_configured <= '0';
                        clk_configured := '0';
                        div_result_baud_wait <= (others => '0');
                        div_result_baud_wait := (others => '0');
                        done <= '0';
                        done <= '0';
                elsif rising_edge(clk) then
                elsif rising_edge(clk) then
                        case controlStates is
                        case controlStates is
                                when idle =>
                                when idle =>
                                        done <= '0';
                                        done <= '0';
                                        -- Go to config state
                                        -- Go to config state
                                        if (reg_addr = "00") and (WE = '1') then
                                        if (reg_addr = "00") and (WE = '1') then
                                                controlStates <= config_state_clk;
                                                controlStates <= config_state_clk;
                                                clk_configured <= '1';
                                                clk_configured := '1';
                                        elsif (reg_addr = "01") and (WE = '1') then
                                        elsif (reg_addr = "01") and (WE = '1') then
                                                controlStates <= config_state_baud;
                                                controlStates <= config_state_baud;
                                                baud_configured <= '1';
                                                baud_configured := '1';
                                        end if;
                                        end if;
 
 
                                when config_state_clk =>
                                when config_state_clk =>
                                        sigDivRst <= '1';
                                        sigDivRst <= '1';
                                        sigDivNumerator <= config_clk;
                                        sigDivNumerator <= config_clk;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.