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

Subversion Repositories openverifla

[/] [openverifla/] [trunk/] [openverifla_2.4/] [vhdl/] [verifla/] [computer_input_of_verifla.vhd] - Blame information for rev 46

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 46 laurentiud
-- 20180820-1740
2
-- Author: Laurentiu Duca
3
-- License: GNU GPL
4
-----------------------------------------------------
5
 
6
library IEEE;
7
use IEEE.STD_LOGIC_1164.ALL;
8
use IEEE.NUMERIC_STD.ALL;
9
--use ieee.std_logic_arith.all;  
10
use ieee.std_logic_unsigned.all;
11
use work.common_internal_verifla.all;
12
 
13
-----------------------------------------------------
14
 
15
entity computer_input_of_verifla is
16
        port (clk, rst_l: in std_logic;
17
                rec_dataH: in std_logic_vector(7 downto 0);
18
                rec_readyH: in std_logic;
19
                user_run: out std_logic);
20
end computer_input_of_verifla;
21
 
22
-----------------------------------------------------
23
 
24
architecture computer_input_of_verifla_arch of computer_input_of_verifla is
25
 
26
--constant USERCMD_RESET: std_logic_vector(7 downto 0) :=x"00";
27
constant USERCMD_RUN: std_logic_vector(7 downto 0) :=x"01";
28
type state_type is (CI_STATE_IDLE, CI_STATE_START_OF_NEW_CMD);
29
signal ci_state, next_ci_state: state_type;
30
signal ci_indata, next_ci_indata: std_logic_vector(7 downto 0);
31
signal ci_new_octet_received:std_logic;
32
signal next_user_run: std_logic;
33
 
34
begin
35
 
36
        -- T(clk)<<T(uart_clk)
37
        sp1: entity work.single_pulse_of_verifla(single_pulse_of_verifla_arch)
38
                port map (clk=>clk, rst_l=>rst_l, ub=>rec_readyH, ubsing=>ci_new_octet_received);
39
 
40
        -- set up next value
41
   state_reg: process(clk, rst_l)
42
   begin
43
                if (rst_l='0') then
44
                        ci_state<=CI_STATE_IDLE;
45
                        ci_indata<=x"00";
46
                        user_run <= '0';
47
                elsif (rising_edge(clk)) then
48
                        ci_state<=next_ci_state;
49
                        ci_indata<=next_ci_indata;
50
                        user_run <= next_user_run;
51
                end if;
52
        end process;
53
 
54
        -- state machine
55
   comb_logic: process(ci_new_octet_received, rec_dataH, ci_state, ci_indata)
56
        begin
57
                -- implicit
58
                next_ci_state <= ci_state;
59
                next_ci_indata <= x"00";
60
                next_user_run <= '0';
61
                case ci_state is
62
                        when CI_STATE_IDLE =>
63
                                if(ci_new_octet_received = '1') then
64
                                        next_ci_indata <= rec_dataH;
65
                                        next_ci_state <= CI_STATE_START_OF_NEW_CMD;
66
                                else
67
                                        next_ci_state<=CI_STATE_IDLE;
68
                                end if;
69
                        when CI_STATE_START_OF_NEW_CMD =>
70
                                next_ci_state<=CI_STATE_IDLE;
71
                                if (ci_indata = USERCMD_RUN) then
72
                                        next_user_run<='1';
73
                                end if;
74
                        when others =>
75
                                -- this is forced by the vhdl compiler
76
                end case;
77
   end process;
78
 
79
end computer_input_of_verifla_arch;

powered by: WebSVN 2.1.0

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