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

Subversion Repositories ft816float

[/] [ft816float/] [trunk/] [rtl/] [positVerilog/] [positCntlz.sv] - Blame information for rev 60

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

Line No. Rev Author Line
1 36 robfinch
// ============================================================================
2
//        __
3
//   \\__/ o\    (C) 2020  Robert Finch, Waterloo
4
//    \  __ /    All rights reserved.
5
//     \/_//     robfinch@finitron.ca
6
//       ||
7
//
8
//      positCntlz.sv
9
//
10
// This source file is free software: you can redistribute it and/or modify
11
// it under the terms of the GNU Lesser General Public License as published
12
// by the Free Software Foundation, either version 3 of the License, or
13
// (at your option) any later version.
14
//
15
// This source file is distributed in the hope that it will be useful,
16
// but WITHOUT ANY WARRANTY; without even the implied warranty of
17
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
// GNU General Public License for more details.
19
//
20
// You should have received a copy of the GNU General Public License
21
// along with this program.  If not, see .
22
//
23
// ============================================================================
24
//
25 48 robfinch
import posit::PSTWID;
26
 
27 36 robfinch
module positCntlz(i, o);
28
parameter PSTWID = `PSTWID;
29
input [PSTWID-2:0] i;
30 42 robfinch
output [$clog2(PSTWID-1)-1:0] o;
31 36 robfinch
 
32
generate begin : gClz
33 42 robfinch
  if (PSTWID <= 8)
34
    cntlz8 u1 (.i({i,{9-PSTWID{1'b1}}}), .o(o));
35
  else if (PSTWID <= 16)
36
    cntlz16 u1 (.i({i,{17-PSTWID{1'b1}}}), .o(o));
37
  else if (PSTWID <= 24)
38
    cntlz24 u1 (.i({i,{25-PSTWID{1'b1}}}), .o(o));
39
  else if (PSTWID <= 32)
40
    cntlz32 u1 (.i({i,{33-PSTWID{1'b1}}}), .o(o));
41
  else if (PSTWID <= 48)
42
    cntlz48 u1 (.i({i,{49-PSTWID{1'b1}}}), .o(o));
43
  else if (PSTWID <= 64)
44
    cntlz64 u1 (.i({i,{65-PSTWID{1'b1}}}), .o(o));
45
  else if (PSTWID <= 80)
46
    cntlz80 u1 (.i({i,{81-PSTWID{1'b1}}}), .o(o));
47
  else if (PSTWID <= 96)
48
    cntlz96 u1 (.i({i,{97-PSTWID{1'b1}}}), .o(o));
49
  else if (PSTWID <= 128)
50
    cntlz128 u1 (.i({i,{129-PSTWID{1'b1}}}), .o(o));
51 36 robfinch
end
52
endgenerate
53
 
54
endmodule

powered by: WebSVN 2.1.0

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