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

Subversion Repositories wishbone_uart_controller

[/] [wishbone_uart_controller/] [branches/] [uartcontroller/] [uart_to_instruction.vhd] - Blame information for rev 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 themassau
----------------------------------------------------------------------------------
2
-- Company: 
3
-- Engineer: 
4
-- 
5
-- Create Date:    23:03:15 04/17/2013 
6
-- Design Name: 
7
-- Module Name:    uart_to_instruction - Behavioral 
8
-- Project Name: 
9
-- Target Devices: 
10
-- Tool versions: 
11
-- Description: 
12
--
13
-- Dependencies: 
14
--
15
-- Revision: 
16
-- Revision 0.01 - File Created
17
-- Additional Comments: 
18
--
19
----------------------------------------------------------------------------------
20
library IEEE;
21
use IEEE.STD_LOGIC_1164.ALL;
22
 
23
-- Uncomment the following library declaration if using
24
-- arithmetic functions with Signed or Unsigned values
25
--use IEEE.NUMERIC_STD.ALL;
26
 
27
-- Uncomment the following library declaration if instantiating
28
-- any Xilinx primitives in this code.
29
--library UNISIM;
30
--use UNISIM.VComponents.all;
31
 
32
entity uart_to_instruction is
33
    Port (      uart_rx_data_out_stb : in  STD_LOGIC;
34
                                rd:out  STD_LOGIC;
35
                                data_in: IN std_logic_vector(7 downto 0);
36
                                next_instructie:in std_logic;
37
                                enable:out std_logic;
38
                                clock:in  STD_LOGIC;
39
                                send_data: out std_logic;
40
                                queue_empty:in std_logic;
41
                                opcode:out std_logic;
42
                                adress:out std_logic_vector(7 downto 0);
43
                                data:out std_logic_vector(7 downto 0)
44
                        );
45
end uart_to_instruction;
46
 
47
architecture Behavioral of uart_to_instruction is
48
signal count : integer range 0 to 3:=0;
49
signal send_data_int: std_logic:='0';
50
signal instructie_i:std_logic_vector(15 downto 0);
51
begin
52
process(clock)
53
begin
54
        if rising_edge(clock) then
55
                        if uart_rx_data_out_stb ='1' then
56
                                if count=0 then
57
                                        instructie_i(15 downto 8) <=data_in;
58
                                        if data_in(7)='0' then
59
                                                if data_in = x"00" then
60
                                                        count<=3;-- to pc
61
                                                else
62
                                                        count <=  2;
63
                                                end if;
64
                                        else
65
                                                count<=1;--write instructie wacht tot volgende byte.
66
                                        end if;
67
                                        rd<='1';
68
                                elsif count=1 then
69
                                        count<=2;
70
                                        instructie_i(7 downto 0) <=data_in;
71
                                        rd<='1';
72
                                end if;
73
                        elsif uart_rx_data_out_stb ='0' then
74
                                rd<='0';
75
                        end if;
76
                        if next_instructie ='1' then
77
                                if count=2 then
78
                                        opcode<=instructie_i(15);
79
                                        adress<='0'&instructie_i(14 downto 8);
80
                                        data<=instructie_i(7 downto 0);
81
                                        enable<='1';
82
                                        count<=0;
83
                                elsif count=3 then
84
                                        send_data_int<='1';
85
                                end if;
86
                        else
87
                                enable<='0';
88
                        end if;
89
                if count=3 and send_data_int='1' and queue_empty='1' then
90
                        count<=0;
91
                        send_data_int<='0';
92
                end if;
93
        end if;
94
end process;
95
send_data<=send_data_int;
96
end Behavioral;
97
 

powered by: WebSVN 2.1.0

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