Develop and Download Open Source Software

Browse Subversion Repository

Contents of /trunk/Toriya/func_util.v

Parent Directory Parent Directory | Revision Log Revision Log


Revision 118 - (show annotations) (download)
Wed Apr 11 04:55:06 2007 UTC (17 years, 1 month ago) by chapuni
File size: 3222 byte(s)
「本物の鳥屋」ついに公開です。
たぶん 2005/09 頃のものです。
もしかするとあと一度ほど、改良するかもね。
1 /**********************************************************-*-verilog-*-
2 *
3 * Utility functions
4 *
5 * $Id$
6 *
7 */
8
9 /***************************************************************
10 *
11 * ハッシュのclassifyのために必要になるかもしれない。
12 *
13 * 0 ./012345
14 * 1 6789ABCD
15 * 2 EFGHIJKL
16 * 3 MNOPQRST
17 * 4 UVWXYZab
18 * 5 cdefghij
19 * 6 klmnopqr
20 * 7 stuvwxyz
21 *
22 */
23
24 /*
25 * 文字を6+1ビットにエンコードする
26 */
27 function [6:0] enc64;
28 input c;
29 case (c)
30 ".": enc64 = 7'o00;
31 "/": enc64 = 7'o01;
32 "0": enc64 = 7'o02;
33 "1": enc64 = 7'o03;
34 "2": enc64 = 7'o04;
35 "3": enc64 = 7'o05;
36 "4": enc64 = 7'o06;
37 "5": enc64 = 7'o07;
38 "6": enc64 = 7'o10;
39 "7": enc64 = 7'o11;
40 "8": enc64 = 7'o12;
41 "9": enc64 = 7'o13;
42 "A": enc64 = 7'o14;
43 "B": enc64 = 7'o15;
44 "C": enc64 = 7'o16;
45 "D": enc64 = 7'o17;
46 "E": enc64 = 7'o20;
47 "F": enc64 = 7'o21;
48 "G": enc64 = 7'o22;
49 "H": enc64 = 7'o23;
50 "I": enc64 = 7'o24;
51 "J": enc64 = 7'o25;
52 "K": enc64 = 7'o26;
53 "L": enc64 = 7'o27;
54 "M": enc64 = 7'o30;
55 "N": enc64 = 7'o31;
56 "O": enc64 = 7'o32;
57 "P": enc64 = 7'o33;
58 "Q": enc64 = 7'o34;
59 "R": enc64 = 7'o35;
60 "S": enc64 = 7'o36;
61 "T": enc64 = 7'o37;
62 "U": enc64 = 7'o40;
63 "V": enc64 = 7'o41;
64 "W": enc64 = 7'o42;
65 "X": enc64 = 7'o43;
66 "Y": enc64 = 7'o44;
67 "Z": enc64 = 7'o45;
68 "a": enc64 = 7'o46;
69 "b": enc64 = 7'o47;
70 "c": enc64 = 7'o50;
71 "d": enc64 = 7'o51;
72 "e": enc64 = 7'o52;
73 "f": enc64 = 7'o53;
74 "g": enc64 = 7'o54;
75 "h": enc64 = 7'o55;
76 "i": enc64 = 7'o56;
77 "j": enc64 = 7'o57;
78 "k": enc64 = 7'o60;
79 "l": enc64 = 7'o61;
80 "m": enc64 = 7'o62;
81 "n": enc64 = 7'o63;
82 "o": enc64 = 7'o64;
83 "p": enc64 = 7'o65;
84 "q": enc64 = 7'o66;
85 "r": enc64 = 7'o67;
86 "s": enc64 = 7'o70;
87 "t": enc64 = 7'o71;
88 "u": enc64 = 7'o72;
89 "v": enc64 = 7'o73;
90 "w": enc64 = 7'o74;
91 "x": enc64 = 7'o75;
92 "y": enc64 = 7'o76;
93 "z": enc64 = 7'o77;
94 default: enc64 = 7'o177;
95 endcase
96 endfunction
97
98 /*
99 * case insensitive用
100 * ABcdEFgh のように変換する
101 * 下2ビットをいじらなくて済むからである。
102 */
103 function [5:0] toupper;
104 input [5:0] d;
105 case (d)
106 // 6'o01: toupper = 6'o00; // / -> .
107
108 6'o46: toupper = 6'o14; // A
109 6'o47: toupper = 6'o15; // B
110 6'o16: toupper = 6'o50; // c
111 6'o17: toupper = 6'o51; // d
112
113 6'o52: toupper = 6'o20; // E
114 6'o53: toupper = 6'o21; // F
115 6'o22: toupper = 6'o54; // g
116 6'o23: toupper = 6'o55; // h
117
118 6'o56: toupper = 6'o24; // I
119 6'o57: toupper = 6'o25; // J
120 6'o26: toupper = 6'o60; // k
121 6'o27: toupper = 6'o61; // l
122
123 6'o62: toupper = 6'o30; // M
124 6'o63: toupper = 6'o31; // N
125 6'o32: toupper = 6'o64; // o
126 6'o33: toupper = 6'o65; // p
127
128 6'o66: toupper = 6'o34; // Q
129 6'o67: toupper = 6'o35; // R
130 6'o36: toupper = 6'o70; // s
131 6'o37: toupper = 6'o71; // t
132
133 6'o72: toupper = 6'o40; // U
134 6'o73: toupper = 6'o41; // V
135 6'o42: toupper = 6'o74; // w
136 6'o43: toupper = 6'o75; // x
137
138 6'o76: toupper = 6'o44; // Y
139 6'o77: toupper = 6'o45; // Z
140
141 default: toupper = d;
142 endcase
143 endfunction
144
145 /*
146 * Local variables:
147 * tab-width: 4
148 * End:
149 */

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Rev URL

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26