Develop and Download Open Source Software

Browse Subversion Repository

Contents of /trunk/Toriya/comparators.v

Parent Directory Parent Directory | Revision Log Revision Log


Revision 118 - (show annotations) (download)
Wed Apr 11 04:55:06 2007 UTC (17 years ago) by chapuni
File size: 2557 byte(s)
「本物の鳥屋」ついに公開です。
たぶん 2005/09 頃のものです。
もしかするとあと一度ほど、改良するかもね。
1 /**********************************************************-*-verilog-*-
2 *
3 * 比較スロットがいっぱい並んでいる
4 * いずれかにヒットするかどうかの条件を返す
5 *
6 * $Id$
7 *
8 */
9
10 module comparators(rst,
11 clk, // シーケンサ用クロック
12 men, // 比較有効ゲート
13 fk0, fh0, // 入力
14 fk1, matched, // 出力
15 regclk, // レジスタ設定用クロック
16 c_we, c_wu, c_txd);
17
18 parameter NCAP = 2;
19 parameter NCAP_THRESHOLD = 1;
20
21 input rst;
22
23 input clk;
24 input men; // 比較有効かどうか
25 input [55:0] fk0;
26 input [1:66] fh0;
27 output [55:0] fk1;
28 output matched; // unbuffered, 比較器が輝いたら1
29
30 // レジスタ設定用; regclk 同期でいじれ
31 input regclk; // レジスタ書き込み用; hostclk が妥当
32 input c_we;
33 input [7:0] c_wu;
34 input [7:0] c_txd;
35
36 `include "func_util.v"
37
38 /*
39 * 区別ナシにするために細工を施す
40 */
41 wire [99:64] mc0; // 埋め込みターゲット
42 reg men1;
43 reg [99:64] mc1;
44 reg [55:0] fk1;
45 reg [1:66] fh1;
46 always @(posedge clk)
47 begin
48 men1 <= men;
49 mc1 <= mc0;
50 fk1 <= fk0;
51 fh1 <= {toupper(fh0[ 1: 6]),
52 toupper(fh0[ 7:12]),
53 toupper(fh0[13:18]),
54 toupper(fh0[19:24]),
55 toupper(fh0[25:30]),
56 toupper(fh0[31:36]),
57 toupper(fh0[37:42]),
58 toupper(fh0[43:48]),
59 toupper(fh0[49:54]),
60 toupper(fh0[55:60]),
61 toupper(fh0[61:66])};
62 end
63
64 /*
65 * 区別ありCOMPARATOR
66 * いずれかにヒットした場合、後に伝播する
67 */
68
69 cmp8 cu99(fh0, mc0[99]); // 8連コンパレータ
70
71 /* 区別あり/ナシ混合コンパレータ */
72 wire [99:64] m1;
73 /*
74 cmp10s cu64("3","S","H","R","U","N","Y","A","X","A",
75 " "," "," "," "," "," "," "," "," "," ",
76 clk, fh0, fh1, m1[64]);
77 */
78 /*
79 * 区別ナシCOMPARATOR
80 * いずれかに一致した際に、matched をドライブする
81 */
82 wire ['h3F:0] m;
83
84 genvar i;
85
86 // Packを外してコンパイルする分
87 generate for (i = 0;
88 i < NCAP && i < NCAP_THRESHOLD;
89 i = i + 1)
90 begin: cui0
91 (* ALTERA_ATTRIBUTE = "AUTO_PACKED_REGISTERS_STRATIX=NORMAL" *)
92 cmp10 cu1 (regclk, rst,
93 fh1,
94 m[i],
95 c_we && (c_wu == i),
96 c_txd);
97 end
98 endgenerate
99
100 // Packしたまま
101 generate for (i = NCAP_THRESHOLD;
102 i < NCAP;
103 i = i + 1)
104 begin: cui1
105 cmp10 cu1 (regclk, rst,
106 fh1,
107 m[i],
108 c_we && (c_wu == i),
109 c_txd);
110 end
111 endgenerate
112
113 //cmp8 cu97(fh1, m1[97]); // 8連コンパレータ
114 cmp9 cu98(fh1, m1[98]); // 9連コンパレータ
115 //cmpnum10 cu8n(fh1, m1[99]); // 数字のみコンパレータ
116
117 assign matched = men1 && |{mc1, m[NCAP - 1:0], m1};
118
119 endmodule // comparators
120
121 /*
122 * Local variables:
123 * tab-width: 4
124 * End:
125 */

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