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

Subversion Repositories openverifla

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 46 laurentiud
/*
2
file: computer_input_of_verifla.v
3
license: GNU GPL
4
 
5
Revision history
6
- 20180827-1700
7
allow only USERCMD_RUN.
8
revision date: 2007/Sep/03; author: Laurentiu DUCA
9
- USERCMD_RESET
10
 
11
revision date: 2007/Jul/4; author: Laurentiu DUCA
12
- v01
13
*/
14
 
15
 
16
module computer_input_of_verifla (clk, rst_l,
17
        rec_dataH, rec_readyH, user_run);
18
// user commands
19
parameter USERCMD_RUN = 8'h01;
20
// CI_states
21
parameter       CI_STATES_BITS=4,
22
        CI_STATE_IDLE=0,
23
        CI_STATE_START_OF_NEW_CMD=1;
24
 
25
// input
26
input clk, rst_l;
27
input rec_readyH;
28
input [7:0] rec_dataH;
29
// output
30
output user_run;
31
reg user_run;
32
// locals
33
reg [CI_STATES_BITS-1:0] ci_state, next_ci_state;
34
reg [7:0] ci_indata, next_ci_indata;
35
wire ci_new_octet_received;
36
 
37
// T(clk)<<T(uart_clk)
38
single_pulse_of_verifla sp1(.clk(clk), .rst_l(rst_l), .ub(rec_readyH), .ubsing(ci_new_octet_received));
39
 
40
// set up next value
41
always @(posedge clk or negedge rst_l)
42
begin
43
        if(~rst_l)
44
        begin
45
                ci_state=CI_STATE_IDLE;
46
                ci_indata=0;
47
        end
48
        else
49
        begin
50
                ci_state=next_ci_state;
51
                ci_indata=next_ci_indata;
52
        end
53
end
54
 
55
// state machine
56
always @(ci_new_octet_received or rec_dataH or ci_state or ci_indata)
57
begin
58
        // implicit
59
        next_ci_state=ci_state;
60
        next_ci_indata=0;
61
        user_run=0;
62
 
63
        // state dependent
64
        case(ci_state)
65
        CI_STATE_IDLE:
66
        begin
67
                if(ci_new_octet_received)
68
                begin
69
                        next_ci_indata=rec_dataH;
70
                        next_ci_state=CI_STATE_START_OF_NEW_CMD;
71
                end
72
                else
73
                        next_ci_state=CI_STATE_IDLE;
74
        end
75
 
76
        CI_STATE_START_OF_NEW_CMD:
77
        begin
78
                next_ci_state=CI_STATE_IDLE;
79
                if(ci_indata == USERCMD_RUN)
80
                        user_run=1;
81
        end
82
 
83
        default: // should never get here
84
        begin
85
                next_ci_state=CI_STATE_IDLE;
86
        end
87
        endcase
88
end
89
 
90
endmodule

powered by: WebSVN 2.1.0

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