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

Subversion Repositories uart2bus_testbench

[/] [uart2bus_testbench/] [trunk/] [rtl/] [uart2bus_top.v] - Blame information for rev 7

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

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

powered by: WebSVN 2.1.0

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