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

Subversion Repositories mblite

[/] [mblite/] [trunk/] [designs/] [core_decoder/] [mblite_stdio.vhd] - Diff between revs 6 and 8

Show entire file | Details | Blame | View Log

Rev 6 Rev 8
Line 9... Line 9...
--
--
--      Description        : Simulates standard output using stdio package
--      Description        : Simulates standard output using stdio package
--
--
----------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------
 
 
LIBRARY ieee;
library ieee;
USE ieee.std_logic_1164.ALL;
use ieee.std_logic_1164.all;
USE ieee.std_logic_unsigned.ALL;
use ieee.std_logic_unsigned.all;
 
 
LIBRARY mblite;
library mblite;
USE mblite.config_Pkg.ALL;
use mblite.config_Pkg.all;
USE mblite.core_Pkg.ALL;
use mblite.core_Pkg.all;
USE mblite.std_Pkg.ALL;
use mblite.std_Pkg.all;
 
 
USE std.textio.ALL;
use std.textio.all;
 
 
ENTITY mblite_stdio IS PORT
entity mblite_stdio is port
(
(
    dmem_i : OUT dmem_in_type;
    dmem_i : out dmem_in_type;
    dmem_o : IN dmem_out_type;
    dmem_o : in dmem_out_type;
    clk_i  : IN std_logic
    clk_i  : in std_logic
);
);
END mblite_stdio;
end mblite_stdio;
 
 
ARCHITECTURE arch OF mblite_stdio IS
architecture arch of mblite_stdio is
BEGIN
begin
    -- Character device
    -- Character device
    stdio: PROCESS(clk_i)
    stdio: process(clk_i)
            VARIABLE s    : line;
            variable s    : line;
            VARIABLE byte : std_logic_vector(7 DOWNTO 0);
            variable byte : std_logic_vector(7 downto 0);
            VARIABLE char : character;
            variable char : character;
        BEGIN
        begin
            dmem_i.dat_i <= (OTHERS => '0');
            dmem_i.dat_i <= (others => '0');
            dmem_i.ena_i <= '1';
            dmem_i.ena_i <= '1';
            IF rising_edge(clk_i) THEN
            if rising_edge(clk_i) then
                IF dmem_o.ena_o = '1' THEN
                if dmem_o.ena_o = '1' then
                    IF dmem_o.we_o = '1' THEN
                    if dmem_o.we_o = '1' then
                    -- WRITE STDOUT
                    -- WRITE STDOUT
                        CASE dmem_o.sel_o IS
                        case dmem_o.sel_o is
                            WHEN "0001" => byte := dmem_o.dat_o( 7 DOWNTO  0);
                            when "0001" => byte := dmem_o.dat_o( 7 downto  0);
                            WHEN "0010" => byte := dmem_o.dat_o(15 DOWNTO  8);
                            when "0010" => byte := dmem_o.dat_o(15 downto  8);
                            WHEN "0100" => byte := dmem_o.dat_o(23 DOWNTO 16);
                            when "0100" => byte := dmem_o.dat_o(23 downto 16);
                            WHEN "1000" => byte := dmem_o.dat_o(31 DOWNTO 24);
                            when "1000" => byte := dmem_o.dat_o(31 downto 24);
                            WHEN OTHERS => NULL;
                            when others => null;
                        END CASE;
                        end case;
                        char := character'val(my_conv_integer(byte));
                        char := character'val(my_conv_integer(byte));
                        IF byte = X"0D" THEN
                        if byte = x"0d" then
                            -- Ignore character 13
                            -- Ignore character 13
                        ELSIF byte = X"0A" THEN
                        elsif byte = x"0a" then
                            -- Writeline on character 10 (newline)
                            -- Writeline on character 10 (newline)
                            writeline(output, s);
                            writeline(output, s);
                        ELSE
                        else
                            -- Write to buffer
                            -- Write to buffer
                            write(s, char);
                            write(s, char);
                        END IF;
 
                    END IF;
 
                END IF;
 
            END IF;
 
    END PROCESS;
 
END arch;
 
 No newline at end of file
 No newline at end of file
 
                        end if;
 
                    end if;
 
                end if;
 
            end if;
 
    end process;
 
end arch;
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

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