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

Subversion Repositories uart_block

[/] [uart_block/] [trunk/] [hdl/] [iseProject/] [SERIALMASTER.vhd] - Diff between revs 27 and 28

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

Rev 27 Rev 28
Line 32... Line 32...
signal byteIncome : std_logic_vector(7 downto 0);
signal byteIncome : std_logic_vector(7 downto 0);
begin
begin
 
 
        process (CLK_I)
        process (CLK_I)
        variable contWait : integer range 0 to 50000000;
        variable contWait : integer range 0 to 50000000;
 
        variable cycles2Wait : integer range 0 to 50000000;
        variable nextState: testMaster;
        variable nextState: testMaster;
        begin
        begin
                if rising_edge(CLK_I) then
                if rising_edge(CLK_I) then
                        if RST_I = '1' then
                        if RST_I = '1' then
                                masterSerialStates <= idle;
                                masterSerialStates <= idle;
                                nextState := idle;
                                nextState := idle;
                                contWait := 0;
                                contWait := 0;
                                byteIncome <= (others => '0');
                                cycles2Wait := 25000000;
 
                                byteIncome <= conv_std_logic_vector(64, (nBitsLarge));  --Send the '@';
                        else
                        else
                                case masterSerialStates is
                                case masterSerialStates is
                                        when idle =>
                                        when idle =>
                                                masterSerialStates <= config_clock;
                                                masterSerialStates <= config_clock;
                                                nextState := idle;
                                                nextState := idle;
Line 80... Line 82...
                                                --DAT_O <= conv_std_logic_vector(64, (nBitsLarge));     --Send the '@'
                                                --DAT_O <= conv_std_logic_vector(64, (nBitsLarge));     --Send the '@'
                                                DAT_O <= conv_std_logic_vector(0, (nBitsLarge-8)) & byteIncome;  --Send the '@'
                                                DAT_O <= conv_std_logic_vector(0, (nBitsLarge-8)) & byteIncome;  --Send the '@'
                                                if ACK_I = '1' then
                                                if ACK_I = '1' then
                                                        -- Byte received wait some cycles to continue
                                                        -- Byte received wait some cycles to continue
                                                        masterSerialStates <= wait_cycles;
                                                        masterSerialStates <= wait_cycles;
                                                        byte_rec        <= "00000100";
                                                        cycles2Wait     := 7000000;
                                                end if;
                                                end if;
 
 
                                        when receive_byte =>
                                        when receive_byte =>
                                                nextState := send_byte;
                                                nextState := send_byte;
                                                ADR_O <= "11";
                                                ADR_O <= "11";
Line 93... Line 95...
                                                if ACK_I = '1' then
                                                if ACK_I = '1' then
                                                        -- Byte received wait some cycles to continue
                                                        -- Byte received wait some cycles to continue
                                                        masterSerialStates <= wait_cycles;
                                                        masterSerialStates <= wait_cycles;
                                                        byte_rec        <= DAT_I(7 downto 0);
                                                        byte_rec        <= DAT_I(7 downto 0);
                                                        byteIncome <= DAT_I(7 downto 0);
                                                        byteIncome <= DAT_I(7 downto 0);
                                                        --byte_rec      <= "00001000";                                                  
                                                        cycles2Wait     := 7000000;
                                                end if;
                                                end if;
 
 
                                        when wait_cycles =>
                                        when wait_cycles =>
                                                -- wait some cycles (90)
                                                -- wait some cycles (90)
                                                if contWait < 25000000 then
                                                if contWait < cycles2Wait then
                                                        contWait := contWait + 1;
                                                        contWait := contWait + 1;
                                                        STB_O <= '0';
                                                        STB_O <= '0';
                                                else
                                                else
                                                        contWait := 0;
                                                        contWait := 0;
                                                        masterSerialStates <= nextState;
                                                        masterSerialStates <= nextState;

powered by: WebSVN 2.1.0

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