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

Subversion Repositories rtftextcontroller

[/] [rtftextcontroller/] [trunk/] [rtl/] [verilog/] [rfTextShiftRegister.sv] - Blame information for rev 31

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 31 robfinch
// ============================================================================
2
//        __
3
//   \\__/ o\    (C) 2006-2022  Robert Finch, Waterloo
4
//    \  __ /    All rights reserved.
5
//     \/_//     robfinch@finitron.ca
6
//       ||
7
//
8
//
9
//      rfTextShiftRegister.v
10
//              Parallel to serial data converter (shift register).
11
//  - shifts one or two bits at a time depending on color mode
12
//
13
// BSD 3-Clause License
14
// Redistribution and use in source and binary forms, with or without
15
// modification, are permitted provided that the following conditions are met:
16
//
17
// 1. Redistributions of source code must retain the above copyright notice, this
18
//    list of conditions and the following disclaimer.
19
//
20
// 2. Redistributions in binary form must reproduce the above copyright notice,
21
//    this list of conditions and the following disclaimer in the documentation
22
//    and/or other materials provided with the distribution.
23
//
24
// 3. Neither the name of the copyright holder nor the names of its
25
//    contributors may be used to endorse or promote products derived from
26
//    this software without specific prior written permission.
27
//
28
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
29
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
31
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
32
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
34
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
35
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
36
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
37
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38
//
39
// ============================================================================
40
//
41
module rfTextShiftRegister(rst, clk, mcm, ce, ld, a, qin, d, qh);
42
localparam WID=64;
43
input rst;                      // reset
44
input clk;                      // clock
45
input mcm;
46
input ce;                       // clock enable
47
input ld;                       // load
48
input [5:0] a;  // bits 0-5 of the font width
49
input qin;                      // serial shifting input
50
input [WID-1:0] d;      // data to load
51
output reg [1:0] qh;    // serial output
52
 
53
reg [WID-1:0] q;
54
 
55
always_ff @(posedge clk)
56
        if (rst)
57
                q <= {WID{1'b0}};
58
        else if (ce) begin
59
                if (ld)
60
                        q <= d;
61
                else if (mcm)
62
                  q <= {q[WID-3:0],2'b0};
63
                else
64
                  q <= {q[WID-2:0],qin};
65
        end
66
 
67
always_ff @(posedge clk)
68
if (ce)
69
        // ToDo: fill in other sizes. However, glyph edit does not support sizes over
70
        // 32x32. Also we support only even widths since they may be multi-color mode.
71
        case(a)
72
  6'b011111:    qh <= q[31:30];
73
  6'b011101:    qh <= q[29:28];
74
  6'b011011:    qh <= q[27:26];
75
  6'b011001:    qh <= q[25:24];
76
  6'b010111:    qh <= q[23:22];
77
  6'b010101:    qh <= q[21:20];
78
  6'b010011:    qh <= q[19:18];
79
  6'b010001:    qh <= q[17:16];
80
  6'b001111:    qh <= q[15:14];
81
  6'b001101:    qh <= q[13:12];
82
  6'b001011:    qh <= q[11:10];
83
  6'b001001:    qh <= q[ 9:8];
84
  6'b000111:    qh <= q[ 7:6];
85
  6'b000101:    qh <= q[ 5:4];
86
  default:              qh <= q[ 7:6];
87
  endcase
88
 
89
endmodule

powered by: WebSVN 2.1.0

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