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

Subversion Repositories thor

[/] [thor/] [trunk/] [FT64v7/] [rtl/] [lib/] [ffo.v] - Blame information for rev 60

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 60 robfinch
 
2
// Find first one
3
module ffo6(i, o);
4
input [5:0] i;
5
output reg [2:0] o;
6
always @*
7
casex(i)
8
6'b1xxxxx:  o <= 3'd5;
9
6'b01xxxx:  o <= 3'd4;
10
6'b001xxx:  o <= 3'd3;
11
6'b0001xx:  o <= 3'd2;
12
6'b00001x:  o <= 3'd1;
13
6'b000001:  o <= 3'd0;
14
default:    o <= 3'd7;
15
endcase
16
endmodule
17
 
18
module ffo12(i, o);
19
input [11:0] i;
20
output reg [3:0] o;
21
 
22
wire [2:0] o1,o2;
23
ffo6 u1 (i[11:6],o1);
24
ffo6 u2 (i[5:0],o2);
25
always @*
26
if (o1==3'd7 && o2==3'd7)
27
    o <= 4'd15;
28
else if (o1==3'd7)
29
    o <= o2;
30
else
31
    o <= 3'd6 + o1;
32
 
33
endmodule
34
 
35
module ffo24(i, o);
36
input [23:0] i;
37
output reg [4:0] o;
38
 
39
wire [3:0] o1,o2;
40
ffo12 u1 (i[23:12],o1);
41
ffo12 u2 (i[11:0],o2);
42
always @*
43
if (o1==4'd15 && o2==4'd15)
44
    o <= 5'd31;
45
else if (o1==4'd15)
46
    o <= o2;
47
else
48
    o <= 4'd12 + o1;
49
 
50
endmodule
51
 
52
module ffo48(i, o);
53
input [47:0] i;
54
output reg [5:0] o;
55
 
56
wire [4:0] o1,o2;
57
ffo24 u1 (i[47:24],o1);
58
ffo24 u2 (i[23:0],o2);
59
always @*
60
if (o1==5'd31 && o2==5'd31)
61
    o <= 6'd63;
62
else if (o1==5'd31)
63
    o <= o2;
64
else
65
    o <= 5'd24 + o1;
66
 
67
endmodule
68
 
69
module ffo96(i, o);
70
input [95:0] i;
71
output reg [6:0] o;
72
 
73
wire [5:0] o1,o2;
74
ffo48 u1 (i[95:48],o1);
75
ffo48 u2 (i[47:0],o2);
76
always @*
77
if (o1==6'd63 && o2==6'd63)
78
    o <= 7'd127;
79
else if (o1==6'd63)
80
    o <= o2;
81
else
82
    o <= 6'd48 + o1;
83
 
84
endmodule
85
 

powered by: WebSVN 2.1.0

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