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

Subversion Repositories s6soc

[/] [s6soc/] [trunk/] [rtl/] [spio.v] - Blame information for rev 2

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 dgisselq
module  spio(i_clk, i_wb_cyc, i_wb_stb, i_wb_we, i_wb_data, o_wb_data,
2
        o_kp_col, i_kp_row, i_btn, o_led,
3
        o_kp_int, o_btn_int);
4
        //
5
        input                   i_clk;
6
        //
7
        input                   i_wb_cyc, i_wb_stb, i_wb_we;
8
        input           [31:0]   i_wb_data;
9
        output  wire    [31:0]   o_wb_data;
10
        //
11
        output  reg     [3:0]    o_kp_col;
12
        input           [3:0]    i_kp_row;
13
        input           [1:0]    i_btn;
14
        output  reg     [3:0]    o_led;
15
        output  reg             o_kp_int, o_btn_int;
16
 
17
        initial o_kp_col = 4'h0;
18
        initial o_led    = 4'h0;
19
        always @(posedge i_clk)
20
                if ((i_wb_cyc)&&(i_wb_stb)&&(i_wb_we))
21
                begin
22
                        o_kp_col <= ((o_kp_col)&(~i_wb_data[11:8]))
23
                                        |((i_wb_data[15:12])&(i_wb_data[11:8]));
24
                        // o_led <= ((o_led)&(~i_wb_data[7:4]))
25
                                        // |((i_wb_data[3:0])&(i_wb_data[7:4]));
26
                        o_led[0] <= (i_wb_data[4])?i_wb_data[0]:o_led[0];
27
                        o_led[1] <= (i_wb_data[5])?i_wb_data[1]:o_led[1];
28
                        o_led[2] <= (i_wb_data[6])?i_wb_data[2]:o_led[2];
29
                        o_led[3] <= (i_wb_data[7])?i_wb_data[3]:o_led[3];
30
                end
31
 
32
        reg     [3:0]    x_kp_row, r_kp_row;
33
        reg     [1:0]    x_btn, r_btn;
34
 
35
        always @(posedge i_clk)
36
        begin
37
                x_kp_row <= i_kp_row;
38
                x_btn    <= i_btn;
39
                r_kp_row <= x_kp_row;
40
                r_btn    <= x_btn;
41
                o_kp_int <= ~(&r_kp_row);
42
                o_btn_int <= |(r_btn);
43
        end
44
 
45
        assign  o_wb_data = { 16'h00, o_kp_col, r_kp_row, 2'b00, r_btn, o_led };
46
 
47
endmodule

powered by: WebSVN 2.1.0

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