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

Subversion Repositories eco32

[/] [eco32/] [trunk/] [fpga/] [mc/] [boards/] [xsa-xst-3/] [src/] [bio/] [bio.v] - Blame information for rev 328

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

Line No. Rev Author Line
1 190 hellwig
//
2
// bio.v -- board specific I/O
3
//
4
 
5
 
6 290 hellwig
`timescale 1ns/10ps
7
`default_nettype none
8
 
9
 
10
module bio(clk, rst,
11
           stb, we, addr,
12 190 hellwig
           data_in, data_out,
13 290 hellwig
           ack,
14 192 hellwig
           sw1_1, sw1_2,
15
           sw1_3, sw1_4,
16 191 hellwig
           sw2_n, sw3_n);
17 190 hellwig
    // internal interface
18
    input clk;
19 290 hellwig
    input rst;
20
    input stb;
21
    input we;
22 190 hellwig
    input addr;
23
    input [31:0] data_in;
24
    output [31:0] data_out;
25 290 hellwig
    output ack;
26 190 hellwig
    // external interface
27 192 hellwig
    input sw1_1;
28
    input sw1_2;
29
    input sw1_3;
30
    input sw1_4;
31 191 hellwig
    input sw2_n;
32
    input sw3_n;
33 190 hellwig
 
34
  reg [31:0] bio_out;
35
  wire [31:0] bio_in;
36
 
37 192 hellwig
  reg sw1_1_p;
38
  reg sw1_1_s;
39
  reg sw1_2_p;
40
  reg sw1_2_s;
41
  reg sw1_3_p;
42
  reg sw1_3_s;
43
  reg sw1_4_p;
44
  reg sw1_4_s;
45 191 hellwig
  reg sw2_p_n;
46
  reg sw2_s_n;
47
  reg sw3_p_n;
48
  reg sw3_s_n;
49
 
50 190 hellwig
  always @(posedge clk) begin
51 290 hellwig
    if (rst) begin
52 190 hellwig
      bio_out[31:0] <= 32'h0;
53
    end else begin
54 290 hellwig
      if (stb & we & ~addr) begin
55 190 hellwig
        bio_out[31:0] <= data_in[31:0];
56
      end
57
    end
58
  end
59
 
60
  assign data_out[31:0] =
61
    (addr == 0) ? bio_out[31:0] : bio_in[31:0];
62 290 hellwig
  assign ack = stb;
63 190 hellwig
 
64 191 hellwig
  always @(posedge clk) begin
65 192 hellwig
    sw1_1_p <= sw1_1;
66
    sw1_1_s <= sw1_1_p;
67
    sw1_2_p <= sw1_2;
68
    sw1_2_s <= sw1_2_p;
69
    sw1_3_p <= sw1_3;
70
    sw1_3_s <= sw1_3_p;
71
    sw1_4_p <= sw1_4;
72
    sw1_4_s <= sw1_4_p;
73 191 hellwig
    sw2_p_n <= sw2_n;
74
    sw2_s_n <= sw2_p_n;
75
    sw3_p_n <= sw3_n;
76
    sw3_s_n <= sw3_p_n;
77
  end
78 190 hellwig
 
79 191 hellwig
  assign bio_in[31:0] =
80 192 hellwig
    { 26'h0,
81
      ~sw3_s_n, ~sw2_s_n,
82
      sw1_4_s, sw1_3_s, sw1_2_s, sw1_1_s };
83 191 hellwig
 
84 190 hellwig
endmodule

powered by: WebSVN 2.1.0

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