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

Subversion Repositories iso7816_3_master

[/] [iso7816_3_master/] [trunk/] [test/] [FiDiAnalyzer.v] - Blame information for rev 14

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

Line No. Rev Author Line
1 11 acapola
/*
2
Author: Sebastien Riou (acapola)
3
Creation date: 22:22:43 01/10/2011
4
 
5
$LastChangedDate: 2011-01-29 17:13:49 +0100 (Sat, 29 Jan 2011) $
6
$LastChangedBy: acapola $
7
$LastChangedRevision: 12 $
8
$HeadURL: file:///svn/iso7816_3_master/iso7816_3_master/trunk/test/FiDiAnalyzer.v $
9
 
10
This file is under the BSD licence:
11
Copyright (c) 2011, Sebastien Riou
12
 
13
All rights reserved.
14
 
15
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
16
 
17
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
18
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
19
The names of contributors may not be used to endorse or promote products derived from this software without specific prior written permission.
20
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
*/
32 5 acapola
`default_nettype none
33
 
34 11 acapola
 
35 5 acapola
module FiDiAnalyzer(
36
        input wire [3:0] fiCode,
37
        input wire [3:0] diCode,
38
        output wire [12:0] fi,
39 6 acapola
        output reg [7:0] di,
40
        output reg [12:0] cyclesPerEtu, //truncate values to 'floor' integer value
41 5 acapola
        output wire [7:0] fMax                           //in 0.1MHz units
42
        );
43
 
44 6 acapola
reg [13+8:0] fiStuff;
45 5 acapola
assign {fi,fMax} = fiStuff;
46
always @(*) begin:fiBlock
47
        case(fiCode)
48
                4'b0000: fiStuff = {12'd0372,8'd040};
49
                4'b0001: fiStuff = {12'd0372,8'd050};
50 12 acapola
                4'b0010: fiStuff = {12'd0558,8'd060};
51
                4'b0011: fiStuff = {12'd0744,8'd080};
52
                4'b0100: fiStuff = {12'd1116,8'd120};
53
                4'b0101: fiStuff = {12'd1488,8'd160};
54
                4'b0110: fiStuff = {12'd1860,8'd200};
55 5 acapola
                4'b0111: fiStuff = {12'd0000,8'd000};
56
                4'b1000: fiStuff = {12'd0000,8'd000};
57 12 acapola
                4'b1001: fiStuff = {12'd0512,8'd050};
58
                4'b1010: fiStuff = {12'd0768,8'd075};
59
                4'b1011: fiStuff = {12'd1024,8'd100};
60
                4'b1100: fiStuff = {12'd1536,8'd150};
61
                4'b1101: fiStuff = {12'd2048,8'd200};
62 5 acapola
                4'b1110: fiStuff = {12'd0000,8'd000};
63
                4'b1111: fiStuff = {12'd0000,8'd000};
64
        endcase
65
end
66
 
67
always @(*) begin:diBlock
68
        case(diCode)
69
                4'b0000: di = 0;
70
                4'b0001: di = 1;
71
                4'b0010: di = 2;
72
                4'b0011: di = 4;
73
                4'b0100: di = 8;
74
                4'b0101: di = 16;
75
                4'b0110: di = 32;
76
                4'b0111: di = 64;
77
                4'b1000: di = 0;
78
                4'b1001: di = 12;
79
                4'b1010: di = 20;
80
                4'b1011: di = 0;
81
                4'b1100: di = 0;
82
                4'b1101: di = 0;
83
                4'b1110: di = 0;
84
                4'b1111: di = 0;
85
        endcase
86
end
87
 
88
always @(*) begin:cyclesPerEtuBlock
89
        case({fiCode,diCode})
90
                8'h01: cyclesPerEtu = 372/1;
91
                8'h02: cyclesPerEtu = 372/2;
92
                8'h03: cyclesPerEtu = 372/4;
93
                8'h04: cyclesPerEtu = 372/8;
94
                8'h05: cyclesPerEtu = 372/16;
95
                8'h06: cyclesPerEtu = 372/32;
96
                8'h07: cyclesPerEtu = 372/64;
97
                8'h09: cyclesPerEtu = 372/12;
98
                8'h0A: cyclesPerEtu = 372/20;
99
 
100
                8'h11: cyclesPerEtu = 372/1;
101
                8'h12: cyclesPerEtu = 372/2;
102
                8'h13: cyclesPerEtu = 372/4;
103
                8'h14: cyclesPerEtu = 372/8;
104
                8'h15: cyclesPerEtu = 372/16;
105
                8'h16: cyclesPerEtu = 372/32;
106
                8'h17: cyclesPerEtu = 372/64;
107
                8'h19: cyclesPerEtu = 372/12;
108
                8'h1A: cyclesPerEtu = 372/20;
109
 
110
                8'h21: cyclesPerEtu = 558/1;
111
                8'h22: cyclesPerEtu = 558/2;
112
                8'h23: cyclesPerEtu = 558/4;
113
                8'h24: cyclesPerEtu = 558/8;
114
                8'h25: cyclesPerEtu = 558/16;
115
                8'h26: cyclesPerEtu = 558/32;
116
                8'h27: cyclesPerEtu = 558/64;
117
                8'h29: cyclesPerEtu = 558/12;
118
                8'h2A: cyclesPerEtu = 558/20;
119
 
120
                8'h31: cyclesPerEtu = 744/1;
121
                8'h32: cyclesPerEtu = 744/2;
122
                8'h33: cyclesPerEtu = 744/4;
123
                8'h34: cyclesPerEtu = 744/8;
124
                8'h35: cyclesPerEtu = 744/16;
125
                8'h36: cyclesPerEtu = 744/32;
126
                8'h37: cyclesPerEtu = 744/64;
127
                8'h39: cyclesPerEtu = 744/12;
128
                8'h3A: cyclesPerEtu = 744/20;
129
 
130
                8'h41: cyclesPerEtu = 1116/1;
131
                8'h42: cyclesPerEtu = 1116/2;
132
                8'h43: cyclesPerEtu = 1116/4;
133
                8'h44: cyclesPerEtu = 1116/8;
134
                8'h45: cyclesPerEtu = 1116/16;
135
                8'h46: cyclesPerEtu = 1116/32;
136
                8'h47: cyclesPerEtu = 1116/64;
137
                8'h49: cyclesPerEtu = 1116/12;
138
                8'h4A: cyclesPerEtu = 1116/20;
139
 
140
                8'h51: cyclesPerEtu = 1488/1;
141
                8'h52: cyclesPerEtu = 1488/2;
142
                8'h53: cyclesPerEtu = 1488/4;
143
                8'h54: cyclesPerEtu = 1488/8;
144
                8'h55: cyclesPerEtu = 1488/16;
145
                8'h56: cyclesPerEtu = 1488/32;
146
                8'h57: cyclesPerEtu = 1488/64;
147
                8'h59: cyclesPerEtu = 1488/12;
148
                8'h5A: cyclesPerEtu = 1488/20;
149
 
150
                8'h61: cyclesPerEtu = 1860/1;
151
                8'h62: cyclesPerEtu = 1860/2;
152
                8'h63: cyclesPerEtu = 1860/4;
153
                8'h64: cyclesPerEtu = 1860/8;
154
                8'h65: cyclesPerEtu = 1860/16;
155
                8'h66: cyclesPerEtu = 1860/32;
156
                8'h67: cyclesPerEtu = 1860/64;
157
                8'h69: cyclesPerEtu = 1860/12;
158
                8'h6A: cyclesPerEtu = 1860/20;
159
 
160
                8'h91: cyclesPerEtu = 512/1;
161
                8'h92: cyclesPerEtu = 512/2;
162
                8'h93: cyclesPerEtu = 512/4;
163
                8'h94: cyclesPerEtu = 512/8;
164
                8'h95: cyclesPerEtu = 512/16;
165
                8'h96: cyclesPerEtu = 512/32;
166
                8'h97: cyclesPerEtu = 512/64;
167
                8'h99: cyclesPerEtu = 512/12;
168
                8'h9A: cyclesPerEtu = 512/20;
169
 
170
                8'hA1: cyclesPerEtu = 768/1;
171
                8'hA2: cyclesPerEtu = 768/2;
172
                8'hA3: cyclesPerEtu = 768/4;
173
                8'hA4: cyclesPerEtu = 768/8;
174
                8'hA5: cyclesPerEtu = 768/16;
175
                8'hA6: cyclesPerEtu = 768/32;
176
                8'hA7: cyclesPerEtu = 768/64;
177
                8'hA9: cyclesPerEtu = 768/12;
178
                8'hAA: cyclesPerEtu = 768/20;
179
 
180
                8'hB1: cyclesPerEtu = 1024/1;
181
                8'hB2: cyclesPerEtu = 1024/2;
182
                8'hB3: cyclesPerEtu = 1024/4;
183
                8'hB4: cyclesPerEtu = 1024/8;
184
                8'hB5: cyclesPerEtu = 1024/16;
185
                8'hB6: cyclesPerEtu = 1024/32;
186
                8'hB7: cyclesPerEtu = 1024/64;
187
                8'hB9: cyclesPerEtu = 1024/12;
188
                8'hBA: cyclesPerEtu = 1024/20;
189
 
190
                8'hC1: cyclesPerEtu = 1536/1;
191
                8'hC2: cyclesPerEtu = 1536/2;
192
                8'hC3: cyclesPerEtu = 1536/4;
193
                8'hC4: cyclesPerEtu = 1536/8;
194
                8'hC5: cyclesPerEtu = 1536/16;
195
                8'hC6: cyclesPerEtu = 1536/32;
196
                8'hC7: cyclesPerEtu = 1536/64;
197
                8'hC9: cyclesPerEtu = 1536/12;
198
                8'hCA: cyclesPerEtu = 1536/20;
199
 
200
                8'hD1: cyclesPerEtu = 2048/1;
201
                8'hD2: cyclesPerEtu = 2048/2;
202
                8'hD3: cyclesPerEtu = 2048/4;
203
                8'hD4: cyclesPerEtu = 2048/8;
204
                8'hD5: cyclesPerEtu = 2048/16;
205
                8'hD6: cyclesPerEtu = 2048/32;
206
                8'hD7: cyclesPerEtu = 2048/64;
207
                8'hD9: cyclesPerEtu = 2048/12;
208
                8'hDA: cyclesPerEtu = 2048/20;
209
 
210
                default: cyclesPerEtu = 0;//RFU
211
        endcase
212
end
213
 
214
endmodule
215 11 acapola
`default_nettype wire
216 5 acapola
 

powered by: WebSVN 2.1.0

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