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

Subversion Repositories openarty

[/] [openarty/] [trunk/] [rtl/] [wbuoutput.v] - Blame information for rev 39

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

Line No. Rev Author Line
1 3 dgisselq
////////////////////////////////////////////////////////////////////////////////
2
//
3
// Filename:    wbuoutput.v
4
//
5
// Project:     FPGA library
6
//
7
// Purpose:     Converts 36-bit codewords into bytes to be placed on the serial
8
//              output port.  The codewords themselves are the results of bus
9
//      transactions, which are then (hopefully) compressed within here and
10
//      carefully arranged into "lines" for visual viewing (if necessary).
11
//
12
//
13
// Creator:     Dan Gisselquist, Ph.D.
14
//              Gisselquist Technology, LLC
15
//
16
////////////////////////////////////////////////////////////////////////////////
17
//
18
// Copyright (C) 2015-2016, Gisselquist Technology, LLC
19
//
20
// This program is free software (firmware): you can redistribute it and/or
21
// modify it under the terms of  the GNU General Public License as published
22
// by the Free Software Foundation, either version 3 of the License, or (at
23
// your option) any later version.
24
//
25
// This program is distributed in the hope that it will be useful, but WITHOUT
26
// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
27
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
28
// for more details.
29
//
30
// License:     GPL, v3, as defined and found on www.gnu.org,
31
//              http://www.gnu.org/licenses/gpl.html
32
//
33
//
34
////////////////////////////////////////////////////////////////////////////////
35
//
36
//
37
module  wbuoutput(i_clk, i_rst, i_stb, i_codword,
38
                i_wb_cyc, i_int, i_bus_busy,
39
                o_stb, o_char, i_tx_busy, o_fifo_err);
40
        input                   i_clk, i_rst;
41
        input                   i_stb;
42
        input           [35:0]   i_codword;
43
        // Not Idle indicators
44
        input                   i_wb_cyc, i_int, i_bus_busy;
45
        // Outputs to our UART transmitter
46
        output  wire            o_stb;
47
        output  wire    [7:0]    o_char;
48
        // Miscellaneous I/O: UART transmitter busy, and fifo error
49
        input                   i_tx_busy;
50
        output  wire            o_fifo_err;
51
 
52
        wire            fifo_rd, dw_busy, fifo_empty_n, fifo_err;
53
        wire    [35:0]   fifo_codword;
54
 
55
        wire            cw_stb, cw_busy, cp_stb, dw_stb, ln_stb, ln_busy,
56
                        cp_busy, byte_busy;
57
        wire    [35:0]   cw_codword, cp_word;
58
        wire    [6:0]    dw_bits, ln_bits;
59
 
60
// `define      SKIP_FIFO
61
`ifdef  SKIP_FIFO
62
        assign  fifo_rd = i_stb;
63
        assign  fifo_codword = i_codword;
64
        assign  fifo_err = 1'b0;
65
`else
66
        assign  fifo_rd = (fifo_empty_n)&&(~cw_busy);
67
        wbufifo #(36,10) busoutfifo(i_clk, i_rst, i_stb, i_codword,
68
                                fifo_rd, fifo_codword, fifo_empty_n,
69
                                fifo_err);
70
`endif
71
 
72
        assign  o_fifo_err = fifo_err;
73
 
74
        wbuidleint      buildcw(i_clk, fifo_rd, fifo_codword,
75
                                i_wb_cyc, i_bus_busy, i_int,
76
                                cw_stb, cw_codword, cw_busy, cp_busy);
77
        // assign       o_dbg = dw_busy; // Always asserted ... ???
78
        // assign       o_dbg = { dw_busy, ln_busy, fifo_rd };
79
        // Stuck: dw_busy and ln_busy get stuck high after read attempt,
80
        //      fifo_rd is low
81
        // assign       o_dbg = { fifo_rd, cp_stb, cw_stb };
82
        // cw_stb and cp_stb get stuck high after one read
83
 
84
        //
85
        // cw_busy & cw_stb, not cp_stb, but dw_busy
86
        //
87
 
88
// `define      SKIP_COMPRESS
89
`ifdef  SKIP_COMPRESS
90
        assign  cp_stb = cw_stb;
91
        assign  cp_word = cw_codword;
92
        assign  cp_busy = dw_busy;
93
`else
94
        assign  cp_busy = cp_stb;
95
        wbucompress     packit(i_clk, cw_stb, cw_codword,
96
                                cp_stb, cp_word, dw_busy);
97
`endif
98
 
99
        wbudeword       deword(i_clk, cp_stb, cp_word, ln_busy,
100
                                        dw_stb, dw_bits, dw_busy);
101
 
102
        wbucompactlines linepacker(i_clk, dw_stb, dw_bits,
103
                        ln_stb, ln_bits,
104
                        (i_wb_cyc||i_bus_busy||fifo_empty_n||cw_busy),
105
                        byte_busy, ln_busy);
106
 
107
        wbusixchar      mkbytes(i_clk, ln_stb, ln_bits, o_stb, o_char, byte_busy, i_tx_busy);
108
 
109
endmodule

powered by: WebSVN 2.1.0

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