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

Subversion Repositories uart2bus

[/] [uart2bus/] [trunk/] [verilog/] [rtl/] [uart2bus_top.v] - Blame information for rev 2

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

Line No. Rev Author Line
1 2 motilito
//---------------------------------------------------------------------------------------
2
// uart to internal bus top module 
3
//
4
//---------------------------------------------------------------------------------------
5
 
6
module uart2bus_top
7
(
8
        // global signals 
9
        clock, reset,
10
        // uart serial signals 
11
        ser_in, ser_out,
12
        // internal bus to register file 
13
        int_address, int_wr_data, int_write,
14
        int_rd_data, int_read
15
);
16
//---------------------------------------------------------------------------------------
17
// modules inputs and outputs 
18
input                   clock;                  // global clock input 
19
input                   reset;                  // global reset input 
20
input                   ser_in;                 // serial data input 
21
output                  ser_out;                // serial data output 
22
output  [15:0]   int_address;    // address bus to register file 
23
output  [7:0]    int_wr_data;    // write data to register file 
24
output                  int_write;              // write control to register file 
25
output                  int_read;               // read control to register file 
26
input   [7:0]    int_rd_data;    // data read from register file 
27
 
28
// baud rate configuration, see baud_gen.v for more details.
29
// baud rate generator parameters for 115200 baud on 44MHz clock 
30
`define D_BAUD_FREQ                     12'd23
31
`define D_BAUD_LIMIT            16'd527
32
// baud rate generator parameters for 115200 baud on 40MHz clock 
33
//`define D_BAUD_FREQ                   12'h90
34
//`define D_BAUD_LIMIT          16'h0ba5
35
// baud rate generator parameters for 9600 baud on 66MHz clock 
36
//`define D_BAUD_FREQ           12'h10
37
//`define D_BAUD_LIMIT          16'h1ACB
38
 
39
// internal wires 
40
wire    [7:0]    tx_data;                // data byte to transmit 
41
wire                    new_tx_data;    // asserted to indicate that there is a new data byte for transmission 
42
wire                    tx_busy;                // signs that transmitter is busy 
43
wire    [7:0]    rx_data;                // data byte received 
44
wire                    new_rx_data;    // signs that a new byte was received 
45
wire    [11:0]   baud_freq;
46
wire    [15:0]   baud_limit;
47
wire                    baud_clk;
48
 
49
//---------------------------------------------------------------------------------------
50
// module implementation 
51
// uart top module instance 
52
uart_top uart1
53
(
54
        .clock(clock), .reset(reset),
55
        .ser_in(ser_in), .ser_out(ser_out),
56
        .rx_data(rx_data), .new_rx_data(new_rx_data),
57
        .tx_data(tx_data), .new_tx_data(new_tx_data), .tx_busy(tx_busy),
58
        .baud_freq(baud_freq), .baud_limit(baud_limit),
59
        .baud_clk(baud_clk)
60
);
61
 
62
// assign baud rate default values 
63
assign baud_freq = `D_BAUD_FREQ;
64
assign baud_limit = `D_BAUD_LIMIT;
65
 
66
// uart parser instance 
67
uart_parser #(16) uart_parser1
68
(
69
        .clock(clock), .reset(reset),
70
        .rx_data(rx_data), .new_rx_data(new_rx_data),
71
        .tx_data(tx_data), .new_tx_data(new_tx_data), .tx_busy(tx_busy),
72
        .int_address(int_address), .int_wr_data(int_wr_data), .int_write(int_write),
73
        .int_rd_data(int_rd_data), .int_read(int_read)
74
);
75
 
76
endmodule
77
//---------------------------------------------------------------------------------------
78
//                                              Th.. Th.. Th.. Thats all folks !!!
79
//---------------------------------------------------------------------------------------

powered by: WebSVN 2.1.0

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