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

Subversion Repositories xulalx25soc

[/] [xulalx25soc/] [trunk/] [rtl/] [wbusixchar.v] - Blame information for rev 9

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

Line No. Rev Author Line
1 2 dgisselq
///////////////////////////////////////////////////////////////////////////
2
//
3
// Filename:    wbusixchar.v
4
//
5
// Project:     XuLA2 board
6
//
7
// Purpose:     Supports a conversion from a six digit bus to a printable
8
//              ASCII character representing those six bits.  The encoding is
9
//              as follows:
10
//
11
//              0-9     ->      0-9
12
//              A-Z     ->      10-35
13
//              a-z     ->      36-61
14
//              @       ->      62
15
//              %       ->      63
16
//
17
//              Note that decoding is stateless, yet requires one clock.
18
//
19
//
20
// Creator:     Dan Gisselquist, Ph.D.
21
//              Gisselquist Technology, LLC
22
//
23
///////////////////////////////////////////////////////////////////////////
24
//
25
// Copyright (C) 2015, Gisselquist Technology, LLC
26
//
27
// This program is free software (firmware): you can redistribute it and/or
28
// modify it under the terms of  the GNU General Public License as published
29
// by the Free Software Foundation, either version 3 of the License, or (at
30
// your option) any later version.
31
//
32
// This program is distributed in the hope that it will be useful, but WITHOUT
33
// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
34
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
35
// for more details.
36
//
37
// License:     GPL, v3, as defined and found on www.gnu.org,
38
//              http://www.gnu.org/licenses/gpl.html
39
//
40
//
41
///////////////////////////////////////////////////////////////////////////
42
//
43
//
44
//
45
module  wbusixchar(i_clk, i_stb, i_bits, o_stb, o_char, o_busy, i_busy);
46
        input                   i_clk;
47
        input                   i_stb;
48
        input           [6:0]    i_bits;
49
        output  reg             o_stb;
50
        output  reg     [7:0]    o_char;
51
        output  wire            o_busy;
52
        input                   i_busy;
53
 
54 9 dgisselq
        initial o_char = 8'h00;
55 2 dgisselq
        always @(posedge i_clk)
56
                if ((i_stb)&&(~o_busy))
57
                begin
58
                        if (i_bits[6])
59
                                o_char <= 8'h0a;
60
                        else if (i_bits[5:0] <= 6'h09) // A digit, WORKS
61
                                o_char <= "0" + { 4'h0, i_bits[3:0] };
62
                        else if (i_bits[5:0] <= 6'd35) // Upper case
63
                                o_char <= "A" + { 2'h0, i_bits[5:0] } - 8'd10; // -'A'+10
64
                        else if (i_bits[5:0] <= 6'd61)
65
                                o_char <= "a" + { 2'h0, i_bits[5:0] } - 8'd36;// -'a'+(10+26)
66
                        else if (i_bits[5:0] == 6'd62) // An '@' sign
67
                                o_char <= 8'h40;
68
                        else // if (i_char == 6'h63) // A '%' sign
69
                                o_char <= 8'h25;
70
                end
71
 
72
        always @(posedge i_clk)
73
                if ((o_stb)&&(~i_busy))
74
                        o_stb <= 1'b0;
75
                else if ((i_stb)&&(~o_stb))
76
                        o_stb <= 1'b1;
77
 
78
        assign  o_busy = o_stb;
79
 
80
endmodule
81
 

powered by: WebSVN 2.1.0

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