@fraczak/k 6.10.5 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +70 -0
- package/CLAUDE.md +1 -1
- package/DOCS/BIG_PICTURE.md +156 -172
- package/DOCS/BINARY_CODEC_STATUS_AND_TODO.md +3 -3
- package/DOCS/CODEC_ARCHITECTURE.md +2 -2
- package/DOCS/DICTIONARY.md +243 -250
- package/DOCS/DIVERGENCE_DETECTION.md +0 -1
- package/DOCS/FILE_FORMATS.md +5 -5
- package/DOCS/KIR_SPECIALIZATION_DESIGN.md +1 -1
- package/DOCS/OBJECT_FILE_AND_PATTERN.md +12 -12
- package/DOCS/PATTERNS.md +17 -17
- package/DOCS/PATTERNS_AND_TYPED_VALUES.md +1 -1
- package/DOCS/REPL.md +9 -19
- package/DOCS/TYPE_DERIVATION.md +2 -8
- package/DOCS/WEB_REPL_REQUIREMENTS.md +8 -8
- package/DOCS/book/01-introduction.md +8 -11
- package/DOCS/book/02-syntax-and-values.md +19 -20
- package/DOCS/book/03-types-as-finite-automata.md +42 -43
- package/DOCS/book/04-partial-functions-and-composition.md +2 -3
- package/DOCS/book/05-typing-filters-and-normalization.md +44 -46
- package/DOCS/book/06-values-in-memory.md +10 -10
- package/DOCS/book/08-operational-semantics-and-execution.md +21 -26
- package/DOCS/book/09-compiler-architecture.md +11 -11
- package/DOCS/book/10-from-ast-to-intermediate-representation.md +6 -7
- package/DOCS/book/14-canonical-serialization.md +2 -2
- package/DOCS/book/appendix-b-incorporating-external-predefined-types-and-functions.md +17 -17
- package/DOCS/book.md +5 -5
- package/Examples/arithmetics.k +49 -153
- package/Examples/bnat.k +13 -13
- package/Examples/byte.k +2 -50
- package/Examples/ieee.k +408 -423
- package/Examples/karatsuba-mult.k +30 -34
- package/Examples/nat.k +5 -6
- package/README.md +54 -49
- package/TODO.md +13 -18
- package/browser/repl-browser.mjs +40 -22
- package/browser/shims/fs.mjs +7 -10
- package/browser/vfs-data.mjs +12 -12
- package/codecs/BINARY_FORMAT.md +4 -4
- package/codecs/POLYMORPHIC_BINARY_FORMAT.md +4 -4
- package/codecs/README.md +6 -6
- package/codecs/ieee.mjs +15 -11
- package/codecs/int.mjs +9 -5
- package/codecs/string-codec.mjs +46 -47
- package/core.k +124 -175
- package/object.mjs +0 -7
- package/package.json +5 -2
- package/parser.jison +2 -41
- package/parser.mjs +55 -95
- package/pretty.mjs +11 -4
- package/repl.mjs +8 -63
- package/scripts/build-repl-html.mjs +18 -49
- package/tests/code-derivation/blowup.mjs +2 -4
- package/tests/code-derivation/bnat.mjs +2 -3
- package/tests/code-derivation/dot.mjs +5 -11
- package/tests/code-derivation/nat.mjs +2 -2
- package/tests/code-derivation/not-not.mjs +6 -6
- package/tests/code-derivation/pattern-envelope.mjs +4 -6
- package/tests/code-derivation/product.mjs +3 -6
- package/tests/code-derivation/rlz.mjs +4 -5
- package/tests/test-codecs.mjs +1 -1
- package/tests/test-fingerprint.mjs +36 -41
- package/tests/test-hash-normalization.mjs +4 -6
- package/tests/test-ieee-arithmetic.mjs +6 -7
- package/tests/test-k-object.mjs +11 -15
- package/tests/test-kir.mjs +0 -1
- package/tests/test-kvm-polymorphic.mjs +1 -2
- package/tests/test-kvm.mjs +8 -11
- package/tests/test-repl-html.mjs +86 -9
- package/tests/test-repl.mjs +38 -53
- package/tests/test.mjs +2 -3
package/Examples/ieee.k
CHANGED
|
@@ -1,71 +1,56 @@
|
|
|
1
1
|
// Primitive bit domains used throughout floating-point encodings.
|
|
2
2
|
// IEEE-754 double-precision building blocks: bit-level domains, flag enums,
|
|
3
3
|
// and ripple-carry arithmetic helpers reused across add/sub/mul/div.
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
|
|
5
|
+
|
|
6
6
|
|
|
7
7
|
// Small utility products for pairing bits or signs.
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
|
|
9
|
+
|
|
10
10
|
|
|
11
11
|
// Comparator states and result lattice (accounts for NaN unordered case).
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
|
|
13
|
+
|
|
14
14
|
|
|
15
15
|
// IEEE-754 double fields: 11-bit exponent and 52-bit fraction.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
bit 10, bit 11, bit 12, bit 13, bit 14, bit 15, bit 16, bit 17, bit 18, bit 19,
|
|
19
|
-
bit 20, bit 21, bit 22, bit 23, bit 24, bit 25, bit 26, bit 27, bit 28, bit 29,
|
|
20
|
-
bit 30, bit 31, bit 32, bit 33, bit 34, bit 35, bit 36, bit 37, bit 38, bit 39,
|
|
21
|
-
bit 40, bit 41, bit 42, bit 43, bit 44, bit 45, bit 46, bit 47, bit 48, bit 49,
|
|
22
|
-
bit 50, bit 51};
|
|
16
|
+
|
|
17
|
+
|
|
23
18
|
|
|
24
19
|
// Logical view of a double plus rounding/exception flag enums per op.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
30
25
|
|
|
31
26
|
// Bundles pairing an arithmetic result with its raised flags.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
36
31
|
|
|
37
32
|
// Common products for operand pairs and extended significands.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
bit 20, bit 21, bit 22, bit 23, bit 24, bit 25, bit 26, bit 27, bit 28, bit 29,
|
|
42
|
-
bit 30, bit 31, bit 32, bit 33, bit 34, bit 35, bit 36, bit 37, bit 38, bit 39,
|
|
43
|
-
bit 40, bit 41, bit 42, bit 43, bit 44, bit 45, bit 46, bit 47, bit 48, bit 49,
|
|
44
|
-
bit 50, bit 51, bit 52};
|
|
45
|
-
$sig56 = {bit 0, bit 1, bit 2, bit 3, bit 4, bit 5, bit 6, bit 7, bit 8, bit 9,
|
|
46
|
-
bit 10, bit 11, bit 12, bit 13, bit 14, bit 15, bit 16, bit 17, bit 18, bit 19,
|
|
47
|
-
bit 20, bit 21, bit 22, bit 23, bit 24, bit 25, bit 26, bit 27, bit 28, bit 29,
|
|
48
|
-
bit 30, bit 31, bit 32, bit 33, bit 34, bit 35, bit 36, bit 37, bit 38, bit 39,
|
|
49
|
-
bit 40, bit 41, bit 42, bit 43, bit 44, bit 45, bit 46, bit 47, bit 48, bit 49,
|
|
50
|
-
bit 50, bit 51, bit 52, bit 53, bit 54, bit 55};
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
51
36
|
// Helper shapes for ripple-carry adders and small shifts.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
56
41
|
|
|
57
42
|
// Pairings used during exponent/fraction comparisons.
|
|
58
|
-
|
|
59
|
-
|
|
43
|
+
|
|
44
|
+
|
|
60
45
|
|
|
61
46
|
// Comparator pipelines carry current state alongside bit pairs.
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
65
50
|
|
|
66
51
|
// Canonical bit literals for convenience.
|
|
67
|
-
0 = {} |0
|
|
68
|
-
1 = {} |1
|
|
52
|
+
0 = {} |0 ;
|
|
53
|
+
1 = {} |1 ;
|
|
69
54
|
|
|
70
55
|
// Flag constructors for exception enums.
|
|
71
56
|
none = {} |none;
|
|
@@ -76,25 +61,25 @@ inexact = {} |inexact;
|
|
|
76
61
|
div_by_zero = {} |div_by_zero;
|
|
77
62
|
|
|
78
63
|
// Primitive boolean operators and a 3-input XOR helper.
|
|
79
|
-
not_bit =
|
|
80
|
-
or_bit =
|
|
81
|
-
and_bit =
|
|
82
|
-
xor_bit =
|
|
83
|
-
xor_abc =
|
|
64
|
+
not_bit = </0 1, 0>;
|
|
65
|
+
or_bit = <.x/1 1, .y/1 1, 0> ;
|
|
66
|
+
and_bit = <.x/0 0, .y/0 0, 1> ;
|
|
67
|
+
xor_bit = <{.x/0 if, .y then} .then, .y not_bit> ;
|
|
68
|
+
xor_abc =
|
|
84
69
|
{{.a x, .b y} xor_bit x, .c y} xor_bit;
|
|
85
70
|
|
|
86
71
|
// Single-bit full adder: sum plus carry-out.
|
|
87
|
-
full_adder =
|
|
72
|
+
full_adder =
|
|
88
73
|
{
|
|
89
74
|
{.a a, .b b, .c_in c} xor_abc sum,
|
|
90
75
|
{
|
|
91
76
|
{.a x, .b y} and_bit x,
|
|
92
77
|
{{.a x, .b y} xor_bit x, .c_in y} and_bit y
|
|
93
78
|
} or_bit carry
|
|
94
|
-
}
|
|
79
|
+
} ;
|
|
95
80
|
|
|
96
81
|
// Bitwise inversion across the 11-bit exponent field.
|
|
97
|
-
exp11_not =
|
|
82
|
+
exp11_not = {
|
|
98
83
|
.0 not_bit 0,
|
|
99
84
|
.1 not_bit 1,
|
|
100
85
|
.2 not_bit 2,
|
|
@@ -106,10 +91,10 @@ exp11_not = $exp11 {
|
|
|
106
91
|
.8 not_bit 8,
|
|
107
92
|
.9 not_bit 9,
|
|
108
93
|
.10 not_bit 10
|
|
109
|
-
}
|
|
94
|
+
} ;
|
|
110
95
|
|
|
111
96
|
// Ripple-carry add for two exp11 fields with an incoming carry.
|
|
112
|
-
exp11_add_cin =
|
|
97
|
+
exp11_add_cin =
|
|
113
98
|
{
|
|
114
99
|
.x x,
|
|
115
100
|
.y y,
|
|
@@ -224,24 +209,24 @@ exp11_add_cin = ${exp11 x, exp11 y, bit c_in}
|
|
|
224
209
|
{
|
|
225
210
|
{.fa0.sum 0, .fa1.sum 1, .fa2.sum 2, .fa3.sum 3, .fa4.sum 4, .fa5.sum 5, .fa6.sum 6, .fa7.sum 7, .fa8.sum 8, .fa9.sum 9, .fa10.sum 10} sum,
|
|
226
211
|
.fa10.carry carry
|
|
227
|
-
}
|
|
212
|
+
} ;
|
|
228
213
|
|
|
229
214
|
// Unsigned add of two exp11 values; exposes carry-out.
|
|
230
|
-
exp11_add =
|
|
215
|
+
exp11_add = {.x x, .y y, 0 c_in} exp11_add_cin ;
|
|
231
216
|
|
|
232
217
|
// Two's-complement subtract for exp11 (x - y).
|
|
233
|
-
exp11_sub =
|
|
218
|
+
exp11_sub =
|
|
234
219
|
{.x x, (.y exp11_not) y, 1 c_in}
|
|
235
220
|
exp11_add_cin
|
|
236
|
-
|
|
221
|
+
;
|
|
237
222
|
|
|
238
223
|
// Convenience projection: subtract and return only the exponent sum.
|
|
239
|
-
exp11_sub_sum =
|
|
224
|
+
exp11_sub_sum =
|
|
240
225
|
{.x x, .y y} exp11_sub .sum
|
|
241
|
-
|
|
226
|
+
;
|
|
242
227
|
|
|
243
228
|
// Bitwise inversion over a 56-bit significand slice.
|
|
244
|
-
sig56_not =
|
|
229
|
+
sig56_not = {
|
|
245
230
|
.0 not_bit 0,
|
|
246
231
|
.1 not_bit 1,
|
|
247
232
|
.2 not_bit 2,
|
|
@@ -298,13 +283,13 @@ sig56_not = $sig56 {
|
|
|
298
283
|
.53 not_bit 53,
|
|
299
284
|
.54 not_bit 54,
|
|
300
285
|
.55 not_bit 55
|
|
301
|
-
}
|
|
286
|
+
} ;
|
|
302
287
|
|
|
303
288
|
// 56-bit ripple-carry add with optional incoming carry.
|
|
304
289
|
// 14-bit ripple-carry adder
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
sig14_add_cin =
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
sig14_add_cin =
|
|
308
293
|
{
|
|
309
294
|
.x x,
|
|
310
295
|
.y y,
|
|
@@ -470,10 +455,10 @@ sig14_add_cin = ${sig14 x, sig14 y, bit c_in}
|
|
|
470
455
|
{
|
|
471
456
|
{.fa0.sum 0, .fa1.sum 1, .fa2.sum 2, .fa3.sum 3, .fa4.sum 4, .fa5.sum 5, .fa6.sum 6, .fa7.sum 7, .fa8.sum 8, .fa9.sum 9, .fa10.sum 10, .fa11.sum 11, .fa12.sum 12, .fa13.sum 13} sum,
|
|
472
457
|
.fa13.carry carry
|
|
473
|
-
}
|
|
458
|
+
} ;
|
|
474
459
|
|
|
475
460
|
// 56-bit adder composed of 4x 14-bit adders
|
|
476
|
-
sig56_add_cin =
|
|
461
|
+
sig56_add_cin =
|
|
477
462
|
{
|
|
478
463
|
.x x,
|
|
479
464
|
.y y,
|
|
@@ -522,39 +507,39 @@ sig56_add_cin = ${sig56 x, sig56 y, bit c_in}
|
|
|
522
507
|
.b3.sum.0 42, .b3.sum.1 43, .b3.sum.2 44, .b3.sum.3 45, .b3.sum.4 46, .b3.sum.5 47, .b3.sum.6 48, .b3.sum.7 49, .b3.sum.8 50, .b3.sum.9 51, .b3.sum.10 52, .b3.sum.11 53, .b3.sum.12 54, .b3.sum.13 55
|
|
523
508
|
} sum,
|
|
524
509
|
.b3.carry carry
|
|
525
|
-
}
|
|
526
|
-
sig56_add =
|
|
510
|
+
} ;
|
|
511
|
+
sig56_add = {.x x, .y y, 0 c_in} sig56_add_cin ;
|
|
527
512
|
|
|
528
513
|
// Two's-complement subtract for sig56 (x - y).
|
|
529
|
-
sig56_sub =
|
|
514
|
+
sig56_sub =
|
|
530
515
|
{.x x, (.y sig56_not) y, 1 c_in}
|
|
531
516
|
sig56_add_cin
|
|
532
|
-
|
|
517
|
+
;
|
|
533
518
|
|
|
534
519
|
// Convenience projection: subtract and return only the significand sum.
|
|
535
|
-
sig56_sub_sum =
|
|
520
|
+
sig56_sub_sum =
|
|
536
521
|
{.x x, .y y} sig56_sub .sum
|
|
537
|
-
|
|
522
|
+
;
|
|
538
523
|
|
|
539
524
|
// Compare sig56 >= by inspecting subtract carry.
|
|
540
|
-
sig56_ge_bit =
|
|
525
|
+
sig56_ge_bit =
|
|
541
526
|
{.x x, .y y} sig56_sub .carry
|
|
542
|
-
|
|
527
|
+
;
|
|
543
528
|
|
|
544
529
|
// 1-bit mux controlled by sel.
|
|
545
|
-
mux_bit =
|
|
530
|
+
mux_bit =
|
|
546
531
|
<
|
|
547
532
|
{.sel 0? if, .a then} .then,
|
|
548
533
|
{.sel 1? if, .b then} .then
|
|
549
|
-
>
|
|
534
|
+
> ;
|
|
550
535
|
|
|
551
536
|
# --- sig112 helpers (mul/div) ------------------------------------------------
|
|
552
537
|
// Wide 112-bit slice used for intermediate mul/div significands.
|
|
553
|
-
|
|
538
|
+
|
|
554
539
|
// Helper shape: sum and carry for wide 112-bit arithmetic.
|
|
555
|
-
|
|
540
|
+
|
|
556
541
|
// Bitwise inversion across the 112-bit extended significand.
|
|
557
|
-
sig112_not =
|
|
542
|
+
sig112_not = {
|
|
558
543
|
.0 not_bit 0,
|
|
559
544
|
.1 not_bit 1,
|
|
560
545
|
.2 not_bit 2,
|
|
@@ -667,10 +652,10 @@ sig112_not = $sig112 {
|
|
|
667
652
|
.109 not_bit 109,
|
|
668
653
|
.110 not_bit 110,
|
|
669
654
|
.111 not_bit 111
|
|
670
|
-
}
|
|
655
|
+
} ;
|
|
671
656
|
// 112-bit ripple-carry add with optional incoming carry.
|
|
672
657
|
// 112-bit adder composed of 2x 56-bit adders
|
|
673
|
-
sig112_add_cin =
|
|
658
|
+
sig112_add_cin =
|
|
674
659
|
{
|
|
675
660
|
.x x,
|
|
676
661
|
.y y,
|
|
@@ -694,15 +679,15 @@ sig112_add_cin = ${sig112 x, sig112 y, bit c_in}
|
|
|
694
679
|
.b1.sum.0 56, .b1.sum.1 57, .b1.sum.2 58, .b1.sum.3 59, .b1.sum.4 60, .b1.sum.5 61, .b1.sum.6 62, .b1.sum.7 63, .b1.sum.8 64, .b1.sum.9 65, .b1.sum.10 66, .b1.sum.11 67, .b1.sum.12 68, .b1.sum.13 69, .b1.sum.14 70, .b1.sum.15 71, .b1.sum.16 72, .b1.sum.17 73, .b1.sum.18 74, .b1.sum.19 75, .b1.sum.20 76, .b1.sum.21 77, .b1.sum.22 78, .b1.sum.23 79, .b1.sum.24 80, .b1.sum.25 81, .b1.sum.26 82, .b1.sum.27 83, .b1.sum.28 84, .b1.sum.29 85, .b1.sum.30 86, .b1.sum.31 87, .b1.sum.32 88, .b1.sum.33 89, .b1.sum.34 90, .b1.sum.35 91, .b1.sum.36 92, .b1.sum.37 93, .b1.sum.38 94, .b1.sum.39 95, .b1.sum.40 96, .b1.sum.41 97, .b1.sum.42 98, .b1.sum.43 99, .b1.sum.44 100, .b1.sum.45 101, .b1.sum.46 102, .b1.sum.47 103, .b1.sum.48 104, .b1.sum.49 105, .b1.sum.50 106, .b1.sum.51 107, .b1.sum.52 108, .b1.sum.53 109, .b1.sum.54 110, .b1.sum.55 111
|
|
695
680
|
} sum,
|
|
696
681
|
.b1.carry carry
|
|
697
|
-
}
|
|
698
|
-
sig112_add =
|
|
682
|
+
} ;
|
|
683
|
+
sig112_add = {.x x, .y y, 0 c_in} sig112_add_cin ;
|
|
699
684
|
|
|
700
|
-
sig112_sub =
|
|
685
|
+
sig112_sub =
|
|
701
686
|
{.x x, (.y sig112_not) y, 1 c_in}
|
|
702
687
|
sig112_add_cin
|
|
703
|
-
|
|
704
|
-
sig112_zero = {} {0 0, 0 1, 0 2, 0 3, 0 4, 0 5, 0 6, 0 7, 0 8, 0 9, 0 10, 0 11, 0 12, 0 13, 0 14, 0 15, 0 16, 0 17, 0 18, 0 19, 0 20, 0 21, 0 22, 0 23, 0 24, 0 25, 0 26, 0 27, 0 28, 0 29, 0 30, 0 31, 0 32, 0 33, 0 34, 0 35, 0 36, 0 37, 0 38, 0 39, 0 40, 0 41, 0 42, 0 43, 0 44, 0 45, 0 46, 0 47, 0 48, 0 49, 0 50, 0 51, 0 52, 0 53, 0 54, 0 55, 0 56, 0 57, 0 58, 0 59, 0 60, 0 61, 0 62, 0 63, 0 64, 0 65, 0 66, 0 67, 0 68, 0 69, 0 70, 0 71, 0 72, 0 73, 0 74, 0 75, 0 76, 0 77, 0 78, 0 79, 0 80, 0 81, 0 82, 0 83, 0 84, 0 85, 0 86, 0 87, 0 88, 0 89, 0 90, 0 91, 0 92, 0 93, 0 94, 0 95, 0 96, 0 97, 0 98, 0 99, 0 100, 0 101, 0 102, 0 103, 0 104, 0 105, 0 106, 0 107, 0 108, 0 109, 0 110, 0 111}
|
|
705
|
-
sig112_shift_left1 =
|
|
688
|
+
;
|
|
689
|
+
sig112_zero = {} {0 0, 0 1, 0 2, 0 3, 0 4, 0 5, 0 6, 0 7, 0 8, 0 9, 0 10, 0 11, 0 12, 0 13, 0 14, 0 15, 0 16, 0 17, 0 18, 0 19, 0 20, 0 21, 0 22, 0 23, 0 24, 0 25, 0 26, 0 27, 0 28, 0 29, 0 30, 0 31, 0 32, 0 33, 0 34, 0 35, 0 36, 0 37, 0 38, 0 39, 0 40, 0 41, 0 42, 0 43, 0 44, 0 45, 0 46, 0 47, 0 48, 0 49, 0 50, 0 51, 0 52, 0 53, 0 54, 0 55, 0 56, 0 57, 0 58, 0 59, 0 60, 0 61, 0 62, 0 63, 0 64, 0 65, 0 66, 0 67, 0 68, 0 69, 0 70, 0 71, 0 72, 0 73, 0 74, 0 75, 0 76, 0 77, 0 78, 0 79, 0 80, 0 81, 0 82, 0 83, 0 84, 0 85, 0 86, 0 87, 0 88, 0 89, 0 90, 0 91, 0 92, 0 93, 0 94, 0 95, 0 96, 0 97, 0 98, 0 99, 0 100, 0 101, 0 102, 0 103, 0 104, 0 105, 0 106, 0 107, 0 108, 0 109, 0 110, 0 111} ;
|
|
690
|
+
sig112_shift_left1 =
|
|
706
691
|
{
|
|
707
692
|
0 0,
|
|
708
693
|
.0 1,
|
|
@@ -816,8 +801,8 @@ sig112_shift_left1 = $sig112
|
|
|
816
801
|
.108 109,
|
|
817
802
|
.109 110,
|
|
818
803
|
.110 111
|
|
819
|
-
}
|
|
820
|
-
sig112_shift_right1 =
|
|
804
|
+
} ;
|
|
805
|
+
sig112_shift_right1 =
|
|
821
806
|
{
|
|
822
807
|
.1 0,
|
|
823
808
|
.2 1,
|
|
@@ -931,8 +916,8 @@ sig112_shift_right1 = $sig112
|
|
|
931
916
|
.110 109,
|
|
932
917
|
.111 110,
|
|
933
918
|
0 111
|
|
934
|
-
}
|
|
935
|
-
sig112_from_sig56 =
|
|
919
|
+
} ;
|
|
920
|
+
sig112_from_sig56 =
|
|
936
921
|
{
|
|
937
922
|
.0 0,
|
|
938
923
|
.1 1,
|
|
@@ -1046,8 +1031,8 @@ sig112_from_sig56 = $sig56
|
|
|
1046
1031
|
0 109,
|
|
1047
1032
|
0 110,
|
|
1048
1033
|
0 111
|
|
1049
|
-
}
|
|
1050
|
-
sig112_from_sig56_shift55 =
|
|
1034
|
+
} ;
|
|
1035
|
+
sig112_from_sig56_shift55 =
|
|
1051
1036
|
{
|
|
1052
1037
|
0 0,
|
|
1053
1038
|
0 1,
|
|
@@ -1161,8 +1146,8 @@ sig112_from_sig56_shift55 = $sig56
|
|
|
1161
1146
|
.54 109,
|
|
1162
1147
|
.55 110,
|
|
1163
1148
|
0 111
|
|
1164
|
-
}
|
|
1165
|
-
sig112_low56 =
|
|
1149
|
+
} ;
|
|
1150
|
+
sig112_low56 =
|
|
1166
1151
|
{
|
|
1167
1152
|
.0 0,
|
|
1168
1153
|
.1 1,
|
|
@@ -1220,14 +1205,14 @@ sig112_low56 = $sig112
|
|
|
1220
1205
|
.53 53,
|
|
1221
1206
|
.54 54,
|
|
1222
1207
|
.55 55
|
|
1223
|
-
}
|
|
1224
|
-
sig112_low56_any1 =
|
|
1208
|
+
} ;
|
|
1209
|
+
sig112_low56_any1 =
|
|
1225
1210
|
sig112_low56 sig56_any1
|
|
1226
|
-
|
|
1227
|
-
sig112_any1 =
|
|
1211
|
+
;
|
|
1212
|
+
sig112_any1 =
|
|
1228
1213
|
{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{.0 x, .1 y} or_bit x, .2 y} or_bit x, .3 y} or_bit x, .4 y} or_bit x, .5 y} or_bit x, .6 y} or_bit x, .7 y} or_bit x, .8 y} or_bit x, .9 y} or_bit x, .10 y} or_bit x, .11 y} or_bit x, .12 y} or_bit x, .13 y} or_bit x, .14 y} or_bit x, .15 y} or_bit x, .16 y} or_bit x, .17 y} or_bit x, .18 y} or_bit x, .19 y} or_bit x, .20 y} or_bit x, .21 y} or_bit x, .22 y} or_bit x, .23 y} or_bit x, .24 y} or_bit x, .25 y} or_bit x, .26 y} or_bit x, .27 y} or_bit x, .28 y} or_bit x, .29 y} or_bit x, .30 y} or_bit x, .31 y} or_bit x, .32 y} or_bit x, .33 y} or_bit x, .34 y} or_bit x, .35 y} or_bit x, .36 y} or_bit x, .37 y} or_bit x, .38 y} or_bit x, .39 y} or_bit x, .40 y} or_bit x, .41 y} or_bit x, .42 y} or_bit x, .43 y} or_bit x, .44 y} or_bit x, .45 y} or_bit x, .46 y} or_bit x, .47 y} or_bit x, .48 y} or_bit x, .49 y} or_bit x, .50 y} or_bit x, .51 y} or_bit x, .52 y} or_bit x, .53 y} or_bit x, .54 y} or_bit x, .55 y} or_bit x, .56 y} or_bit x, .57 y} or_bit x, .58 y} or_bit x, .59 y} or_bit x, .60 y} or_bit x, .61 y} or_bit x, .62 y} or_bit x, .63 y} or_bit x, .64 y} or_bit x, .65 y} or_bit x, .66 y} or_bit x, .67 y} or_bit x, .68 y} or_bit x, .69 y} or_bit x, .70 y} or_bit x, .71 y} or_bit x, .72 y} or_bit x, .73 y} or_bit x, .74 y} or_bit x, .75 y} or_bit x, .76 y} or_bit x, .77 y} or_bit x, .78 y} or_bit x, .79 y} or_bit x, .80 y} or_bit x, .81 y} or_bit x, .82 y} or_bit x, .83 y} or_bit x, .84 y} or_bit x, .85 y} or_bit x, .86 y} or_bit x, .87 y} or_bit x, .88 y} or_bit x, .89 y} or_bit x, .90 y} or_bit x, .91 y} or_bit x, .92 y} or_bit x, .93 y} or_bit x, .94 y} or_bit x, .95 y} or_bit x, .96 y} or_bit x, .97 y} or_bit x, .98 y} or_bit x, .99 y} or_bit x, .100 y} or_bit x, .101 y} or_bit x, .102 y} or_bit x, .103 y} or_bit x, .104 y} or_bit x, .105 y} or_bit x, .106 y} or_bit x, .107 y} or_bit x, .108 y} or_bit x, .109 y} or_bit x, .110 y} or_bit x, .111 y} or_bit
|
|
1229
|
-
|
|
1230
|
-
mux_sig112 =
|
|
1214
|
+
;
|
|
1215
|
+
mux_sig112 =
|
|
1231
1216
|
{
|
|
1232
1217
|
{.sel sel, .a .0 a, .b .0 b} mux_bit 0,
|
|
1233
1218
|
{.sel sel, .a .1 a, .b .1 b} mux_bit 1,
|
|
@@ -1341,8 +1326,8 @@ mux_sig112 = ${bit sel, sig112 a, sig112 b}
|
|
|
1341
1326
|
{.sel sel, .a .109 a, .b .109 b} mux_bit 109,
|
|
1342
1327
|
{.sel sel, .a .110 a, .b .110 b} mux_bit 110,
|
|
1343
1328
|
{.sel sel, .a .111 a, .b .111 b} mux_bit 111
|
|
1344
|
-
}
|
|
1345
|
-
sig112_add_if =
|
|
1329
|
+
} ;
|
|
1330
|
+
sig112_add_if =
|
|
1346
1331
|
{
|
|
1347
1332
|
.acc acc,
|
|
1348
1333
|
.add add,
|
|
@@ -1355,8 +1340,8 @@ sig112_add_if = ${sig112 acc, sig112 add, bit sel}
|
|
|
1355
1340
|
.sel sel,
|
|
1356
1341
|
{.sel sel, .acc a, .sum.sum b} mux_sig112 out
|
|
1357
1342
|
}
|
|
1358
|
-
.out
|
|
1359
|
-
sig56_mul_unsigned =
|
|
1343
|
+
.out ;
|
|
1344
|
+
sig56_mul_unsigned =
|
|
1360
1345
|
{
|
|
1361
1346
|
(.x sig112_from_sig56) add,
|
|
1362
1347
|
() sig112_zero acc,
|
|
@@ -1643,8 +1628,8 @@ sig56_mul_unsigned = ${sig56 x, sig56 y}
|
|
|
1643
1628
|
(.add sig112_shift_left1) add
|
|
1644
1629
|
}
|
|
1645
1630
|
.acc
|
|
1646
|
-
|
|
1647
|
-
sig56_div_unsigned =
|
|
1631
|
+
;
|
|
1632
|
+
sig56_div_unsigned =
|
|
1648
1633
|
{
|
|
1649
1634
|
(.x sig112_from_sig56_shift55) rem0,
|
|
1650
1635
|
(.y sig112_from_sig56_shift55) div0
|
|
@@ -5232,8 +5217,8 @@ sig56_div_unsigned = ${sig56 x, sig56 y}
|
|
|
5232
5217
|
.sticky sticky,
|
|
5233
5218
|
{.b55 55, .b54 54, .b53 53, .b52 52, .b51 51, .b50 50, .b49 49, .b48 48, .b47 47, .b46 46, .b45 45, .b44 44, .b43 43, .b42 42, .b41 41, .b40 40, .b39 39, .b38 38, .b37 37, .b36 36, .b35 35, .b34 34, .b33 33, .b32 32, .b31 31, .b30 30, .b29 29, .b28 28, .b27 27, .b26 26, .b25 25, .b24 24, .b23 23, .b22 22, .b21 21, .b20 20, .b19 19, .b18 18, .b17 17, .b16 16, .b15 15, .b14 14, .b13 13, .b12 12, .b11 11, .b10 10, .b9 9, .b8 8, .b7 7, .b6 6, .b5 5, .b4 4, .b3 3, .b2 2, .b1 1, .sticky 0} sig
|
|
5234
5219
|
}
|
|
5235
|
-
.sig
|
|
5236
|
-
sig56_from_sig112_shift55 =
|
|
5220
|
+
.sig ;
|
|
5221
|
+
sig56_from_sig112_shift55 =
|
|
5237
5222
|
{
|
|
5238
5223
|
.110 55,
|
|
5239
5224
|
.109 54,
|
|
@@ -5291,8 +5276,8 @@ sig56_from_sig112_shift55 = $sig112
|
|
|
5291
5276
|
.57 2,
|
|
5292
5277
|
.56 1,
|
|
5293
5278
|
sig112_low56_any1 0
|
|
5294
|
-
}
|
|
5295
|
-
sig56_from_sig112_shift56 =
|
|
5279
|
+
} ;
|
|
5280
|
+
sig56_from_sig112_shift56 =
|
|
5296
5281
|
{
|
|
5297
5282
|
.111 55,
|
|
5298
5283
|
.110 54,
|
|
@@ -5350,9 +5335,9 @@ sig56_from_sig112_shift56 = $sig112
|
|
|
5350
5335
|
.58 2,
|
|
5351
5336
|
.57 1,
|
|
5352
5337
|
{ .56 x, sig112_low56_any1 y } or_bit 0
|
|
5353
|
-
}
|
|
5338
|
+
} ;
|
|
5354
5339
|
|
|
5355
|
-
shift_right_sig56_1 =
|
|
5340
|
+
shift_right_sig56_1 =
|
|
5356
5341
|
{
|
|
5357
5342
|
{.0 x, .1 y} or_bit 0,
|
|
5358
5343
|
.2 1,
|
|
@@ -5410,9 +5395,9 @@ shift_right_sig56_1 = $sig56
|
|
|
5410
5395
|
.54 53,
|
|
5411
5396
|
.55 54,
|
|
5412
5397
|
0 55
|
|
5413
|
-
}
|
|
5398
|
+
} ;
|
|
5414
5399
|
|
|
5415
|
-
shift_right_sig56_2 =
|
|
5400
|
+
shift_right_sig56_2 =
|
|
5416
5401
|
{
|
|
5417
5402
|
{{.0 x, .1 y} or_bit x, .2 y} or_bit 0,
|
|
5418
5403
|
.3 1,
|
|
@@ -5470,9 +5455,9 @@ shift_right_sig56_2 = $sig56
|
|
|
5470
5455
|
.55 53,
|
|
5471
5456
|
0 54,
|
|
5472
5457
|
0 55
|
|
5473
|
-
}
|
|
5458
|
+
} ;
|
|
5474
5459
|
|
|
5475
|
-
shift_right_sig56_4 =
|
|
5460
|
+
shift_right_sig56_4 =
|
|
5476
5461
|
{
|
|
5477
5462
|
{{{{.0 x, .1 y} or_bit x, .2 y} or_bit x, .3 y} or_bit x, .4 y} or_bit 0,
|
|
5478
5463
|
.5 1,
|
|
@@ -5530,9 +5515,9 @@ shift_right_sig56_4 = $sig56
|
|
|
5530
5515
|
0 53,
|
|
5531
5516
|
0 54,
|
|
5532
5517
|
0 55
|
|
5533
|
-
}
|
|
5518
|
+
} ;
|
|
5534
5519
|
|
|
5535
|
-
shift_right_sig56_8 =
|
|
5520
|
+
shift_right_sig56_8 =
|
|
5536
5521
|
{
|
|
5537
5522
|
{{{{{{{{.0 x, .1 y} or_bit x, .2 y} or_bit x, .3 y} or_bit x, .4 y} or_bit x, .5 y} or_bit x, .6 y} or_bit x, .7 y} or_bit x, .8 y} or_bit 0,
|
|
5538
5523
|
.9 1,
|
|
@@ -5590,9 +5575,9 @@ shift_right_sig56_8 = $sig56
|
|
|
5590
5575
|
0 53,
|
|
5591
5576
|
0 54,
|
|
5592
5577
|
0 55
|
|
5593
|
-
}
|
|
5578
|
+
} ;
|
|
5594
5579
|
|
|
5595
|
-
shift_right_sig56_16 =
|
|
5580
|
+
shift_right_sig56_16 =
|
|
5596
5581
|
{
|
|
5597
5582
|
{{{{{{{{{{{{{{{{.0 x, .1 y} or_bit x, .2 y} or_bit x, .3 y} or_bit x, .4 y} or_bit x, .5 y} or_bit x, .6 y} or_bit x, .7 y} or_bit x, .8 y} or_bit x, .9 y} or_bit x, .10 y} or_bit x, .11 y} or_bit x, .12 y} or_bit x, .13 y} or_bit x, .14 y} or_bit x, .15 y} or_bit x, .16 y} or_bit 0,
|
|
5598
5583
|
.17 1,
|
|
@@ -5650,9 +5635,9 @@ shift_right_sig56_16 = $sig56
|
|
|
5650
5635
|
0 53,
|
|
5651
5636
|
0 54,
|
|
5652
5637
|
0 55
|
|
5653
|
-
}
|
|
5638
|
+
} ;
|
|
5654
5639
|
|
|
5655
|
-
shift_right_sig56_32 =
|
|
5640
|
+
shift_right_sig56_32 =
|
|
5656
5641
|
{
|
|
5657
5642
|
{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{.0 x, .1 y} or_bit x, .2 y} or_bit x, .3 y} or_bit x, .4 y} or_bit x, .5 y} or_bit x, .6 y} or_bit x, .7 y} or_bit x, .8 y} or_bit x, .9 y} or_bit x, .10 y} or_bit x, .11 y} or_bit x, .12 y} or_bit x, .13 y} or_bit x, .14 y} or_bit x, .15 y} or_bit x, .16 y} or_bit x, .17 y} or_bit x, .18 y} or_bit x, .19 y} or_bit x, .20 y} or_bit x, .21 y} or_bit x, .22 y} or_bit x, .23 y} or_bit x, .24 y} or_bit x, .25 y} or_bit x, .26 y} or_bit x, .27 y} or_bit x, .28 y} or_bit x, .29 y} or_bit x, .30 y} or_bit x, .31 y} or_bit x, .32 y} or_bit 0,
|
|
5658
5643
|
.33 1,
|
|
@@ -5710,9 +5695,9 @@ shift_right_sig56_32 = $sig56
|
|
|
5710
5695
|
0 53,
|
|
5711
5696
|
0 54,
|
|
5712
5697
|
0 55
|
|
5713
|
-
}
|
|
5698
|
+
} ;
|
|
5714
5699
|
|
|
5715
|
-
mux_sig56 =
|
|
5700
|
+
mux_sig56 =
|
|
5716
5701
|
{
|
|
5717
5702
|
{.sel sel, .a .0 a, .b .0 b} mux_bit 0,
|
|
5718
5703
|
{.sel sel, .a .1 a, .b .1 b} mux_bit 1,
|
|
@@ -5770,9 +5755,9 @@ mux_sig56 = ${bit sel, sig56 a, sig56 b}
|
|
|
5770
5755
|
{.sel sel, .a .53 a, .b .53 b} mux_bit 53,
|
|
5771
5756
|
{.sel sel, .a .54 a, .b .54 b} mux_bit 54,
|
|
5772
5757
|
{.sel sel, .a .55 a, .b .55 b} mux_bit 55
|
|
5773
|
-
}
|
|
5758
|
+
} ;
|
|
5774
5759
|
|
|
5775
|
-
shift_right_sig56 =
|
|
5760
|
+
shift_right_sig56 =
|
|
5776
5761
|
{.x x, .s s, (.x shift_right_sig56_1) sh1}
|
|
5777
5762
|
{.s s, {.s .0 sel, .x a, .sh1 b} mux_sig56 st1}
|
|
5778
5763
|
{.s s, .st1 st1, (.st1 shift_right_sig56_2) sh2}
|
|
@@ -5785,11 +5770,11 @@ shift_right_sig56 = ${sig56 x, shift6 s}
|
|
|
5785
5770
|
{.s s, {.s .4 sel, .st4 a, .sh16 b} mux_sig56 st5}
|
|
5786
5771
|
{.s s, .st5 st5, (.st5 shift_right_sig56_32) sh32}
|
|
5787
5772
|
{.s s, {.s .5 sel, .st5 a, .sh32 b} mux_sig56 st6}
|
|
5788
|
-
.st6
|
|
5773
|
+
.st6 ;
|
|
5789
5774
|
|
|
5790
|
-
$norm_left = {sig56 sig, exp11 exp};
|
|
5791
5775
|
|
|
5792
|
-
|
|
5776
|
+
|
|
5777
|
+
mux_exp11 =
|
|
5793
5778
|
{
|
|
5794
5779
|
{.sel sel, .a .0 a, .b .0 b} mux_bit 0,
|
|
5795
5780
|
{.sel sel, .a .1 a, .b .1 b} mux_bit 1,
|
|
@@ -5802,35 +5787,35 @@ mux_exp11 = ${bit sel, exp11 a, exp11 b}
|
|
|
5802
5787
|
{.sel sel, .a .8 a, .b .8 b} mux_bit 8,
|
|
5803
5788
|
{.sel sel, .a .9 a, .b .9 b} mux_bit 9,
|
|
5804
5789
|
{.sel sel, .a .10 a, .b .10 b} mux_bit 10
|
|
5805
|
-
}
|
|
5790
|
+
} ;
|
|
5806
5791
|
|
|
5807
|
-
exp1 = {} {1 0, 0 1, 0 2, 0 3, 0 4, 0 5, 0 6, 0 7, 0 8, 0 9, 0 10}
|
|
5792
|
+
exp1 = {} {1 0, 0 1, 0 2, 0 3, 0 4, 0 5, 0 6, 0 7, 0 8, 0 9, 0 10} ;
|
|
5808
5793
|
|
|
5809
5794
|
# exponent = 1023 (bias): 0b01111111111
|
|
5810
5795
|
exp_1023 = {}
|
|
5811
5796
|
{ 0 10,
|
|
5812
5797
|
1 9, 1 8, 1 7, 1 6, 1 5, 1 4, 1 3, 1 2, 1 1, 1 0
|
|
5813
|
-
}
|
|
5798
|
+
} ;
|
|
5814
5799
|
|
|
5815
|
-
exp11_add_sum =
|
|
5800
|
+
exp11_add_sum =
|
|
5816
5801
|
{.x x, .y y} exp11_add .sum
|
|
5817
|
-
|
|
5802
|
+
;
|
|
5818
5803
|
|
|
5819
|
-
exp11_inc =
|
|
5804
|
+
exp11_inc =
|
|
5820
5805
|
{() x, () exp1 y} exp11_add_sum
|
|
5821
|
-
|
|
5806
|
+
;
|
|
5822
5807
|
|
|
5823
|
-
exp11_dec =
|
|
5808
|
+
exp11_dec =
|
|
5824
5809
|
{() x, () exp1 y} exp11_sub_sum
|
|
5825
|
-
|
|
5810
|
+
;
|
|
5826
5811
|
|
|
5827
|
-
exp_nonzero_bit =
|
|
5812
|
+
exp_nonzero_bit =
|
|
5828
5813
|
<
|
|
5829
5814
|
{zero_exponent? if, 0 then} .then,
|
|
5830
5815
|
1
|
|
5831
|
-
>
|
|
5816
|
+
> ;
|
|
5832
5817
|
|
|
5833
|
-
shift_left_sig56_1 =
|
|
5818
|
+
shift_left_sig56_1 =
|
|
5834
5819
|
{
|
|
5835
5820
|
0 0,
|
|
5836
5821
|
.0 1,
|
|
@@ -5888,28 +5873,28 @@ shift_left_sig56_1 = $sig56
|
|
|
5888
5873
|
.52 53,
|
|
5889
5874
|
.53 54,
|
|
5890
5875
|
.54 55
|
|
5891
|
-
}
|
|
5876
|
+
} ;
|
|
5892
5877
|
|
|
5893
|
-
sig56_any1 =
|
|
5878
|
+
sig56_any1 =
|
|
5894
5879
|
{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{.0 x, .1 y} or_bit x, .2 y} or_bit x, .3 y} or_bit x, .4 y} or_bit x, .5 y} or_bit x, .6 y} or_bit x, .7 y} or_bit x, .8 y} or_bit x, .9 y} or_bit x, .10 y} or_bit x, .11 y} or_bit x, .12 y} or_bit x, .13 y} or_bit x, .14 y} or_bit x, .15 y} or_bit x, .16 y} or_bit x, .17 y} or_bit x, .18 y} or_bit x, .19 y} or_bit x, .20 y} or_bit x, .21 y} or_bit x, .22 y} or_bit x, .23 y} or_bit x, .24 y} or_bit x, .25 y} or_bit x, .26 y} or_bit x, .27 y} or_bit x, .28 y} or_bit x, .29 y} or_bit x, .30 y} or_bit x, .31 y} or_bit x, .32 y} or_bit x, .33 y} or_bit x, .34 y} or_bit x, .35 y} or_bit x, .36 y} or_bit x, .37 y} or_bit x, .38 y} or_bit x, .39 y} or_bit x, .40 y} or_bit x, .41 y} or_bit x, .42 y} or_bit x, .43 y} or_bit x, .44 y} or_bit x, .45 y} or_bit x, .46 y} or_bit x, .47 y} or_bit x, .48 y} or_bit x, .49 y} or_bit x, .50 y} or_bit x, .51 y} or_bit x, .52 y} or_bit x, .53 y} or_bit x, .54 y} or_bit x, .55 y} or_bit
|
|
5895
|
-
|
|
5880
|
+
;
|
|
5896
5881
|
|
|
5897
|
-
sig56_zero_bit =
|
|
5882
|
+
sig56_zero_bit =
|
|
5898
5883
|
<
|
|
5899
5884
|
{sig56_any1 /0 if, 1 then} .then,
|
|
5900
5885
|
0
|
|
5901
|
-
>
|
|
5886
|
+
> ;
|
|
5902
5887
|
|
|
5903
|
-
frac52_from_sig56 =
|
|
5888
|
+
frac52_from_sig56 =
|
|
5904
5889
|
{ .3 0, .4 1, .5 2, .6 3, .7 4, .8 5, .9 6, .10 7, .11 8, .12 9,
|
|
5905
5890
|
.13 10, .14 11, .15 12, .16 13, .17 14, .18 15, .19 16, .20 17, .21 18, .22 19,
|
|
5906
5891
|
.23 20, .24 21, .25 22, .26 23, .27 24, .28 25, .29 26, .30 27, .31 28, .32 29,
|
|
5907
5892
|
.33 30, .34 31, .35 32, .36 33, .37 34, .38 35, .39 36, .40 37, .41 38, .42 39,
|
|
5908
5893
|
.43 40, .44 41, .45 42, .46 43, .47 44, .48 45, .49 46, .50 47, .51 48, .52 49,
|
|
5909
5894
|
.53 50, .54 51 }
|
|
5910
|
-
|
|
5895
|
+
;
|
|
5911
5896
|
|
|
5912
|
-
normalize_left_step =
|
|
5897
|
+
normalize_left_step =
|
|
5913
5898
|
{
|
|
5914
5899
|
.sig sig,
|
|
5915
5900
|
.exp exp,
|
|
@@ -5949,9 +5934,9 @@ normalize_left_step = $norm_left
|
|
|
5949
5934
|
{.shift_en sel, .exp a, .exp_dec b} mux_exp11 exp_out
|
|
5950
5935
|
}
|
|
5951
5936
|
{ .sig_out sig, .exp_out exp }
|
|
5952
|
-
|
|
5937
|
+
;
|
|
5953
5938
|
|
|
5954
|
-
normalize_left =
|
|
5939
|
+
normalize_left =
|
|
5955
5940
|
normalize_left_step
|
|
5956
5941
|
normalize_left_step
|
|
5957
5942
|
normalize_left_step
|
|
@@ -6008,10 +5993,10 @@ normalize_left = $norm_left
|
|
|
6008
5993
|
normalize_left_step
|
|
6009
5994
|
normalize_left_step
|
|
6010
5995
|
normalize_left_step
|
|
6011
|
-
|
|
5996
|
+
;
|
|
6012
5997
|
|
|
6013
5998
|
|
|
6014
|
-
shift6_from_exp11 =
|
|
5999
|
+
shift6_from_exp11 =
|
|
6015
6000
|
{
|
|
6016
6001
|
{{{{.6 x, .7 y} or_bit x, .8 y} or_bit x, .9 y} or_bit x, .10 y} or_bit high,
|
|
6017
6002
|
.0 b0, .1 b1, .2 b2, .3 b3, .4 b4, .5 b5
|
|
@@ -6020,9 +6005,9 @@ shift6_from_exp11 = $exp11
|
|
|
6020
6005
|
{.high 1? if, {1 0, 1 1, 1 2, 1 3, 1 4, 1 5} then} .then,
|
|
6021
6006
|
{.high 0? if, {.b0 0, .b1 1, .b2 2, .b3 3, .b4 4, .b5 5} then} .then
|
|
6022
6007
|
>
|
|
6023
|
-
|
|
6008
|
+
;
|
|
6024
6009
|
|
|
6025
|
-
sig56_from_float64 =
|
|
6010
|
+
sig56_from_float64 =
|
|
6026
6011
|
<
|
|
6027
6012
|
{.exponent zero_exponent? if,
|
|
6028
6013
|
{
|
|
@@ -6137,54 +6122,54 @@ sig56_from_float64 = $float64
|
|
|
6137
6122
|
.fraction .0 3,
|
|
6138
6123
|
0 2, 0 1, 0 0
|
|
6139
6124
|
} then} .then
|
|
6140
|
-
>
|
|
6125
|
+
> ;
|
|
6141
6126
|
|
|
6142
|
-
exp11_max =
|
|
6127
|
+
exp11_max =
|
|
6143
6128
|
<
|
|
6144
6129
|
{gt_exponent? if, .x then} .then,
|
|
6145
6130
|
{lt_exponent? if, .y then} .then,
|
|
6146
6131
|
{eq_exponent? if, .x then} .then
|
|
6147
|
-
>
|
|
6132
|
+
> ;
|
|
6148
6133
|
|
|
6149
|
-
exp11_abs_diff =
|
|
6134
|
+
exp11_abs_diff =
|
|
6150
6135
|
<
|
|
6151
6136
|
{gt_exponent? if, {.x x, .y y} exp11_sub_sum then} .then,
|
|
6152
6137
|
{lt_exponent? if, {.y x, .x y} exp11_sub_sum then} .then,
|
|
6153
6138
|
{eq_exponent? if, exp0 then} .then
|
|
6154
|
-
>
|
|
6139
|
+
> ;
|
|
6155
6140
|
|
|
6156
|
-
exp11_adjust =
|
|
6141
|
+
exp11_adjust =
|
|
6157
6142
|
{exp_nonzero_bit sel, exp1 a, () b}
|
|
6158
6143
|
mux_exp11
|
|
6159
|
-
|
|
6144
|
+
;
|
|
6160
6145
|
|
|
6161
|
-
exp_gt_bit =
|
|
6146
|
+
exp_gt_bit =
|
|
6162
6147
|
<
|
|
6163
6148
|
{cmp_exponent /gt if, 1 then} .then,
|
|
6164
6149
|
0
|
|
6165
|
-
>
|
|
6150
|
+
> ;
|
|
6166
6151
|
|
|
6167
|
-
exp_lt_bit =
|
|
6152
|
+
exp_lt_bit =
|
|
6168
6153
|
<
|
|
6169
6154
|
{cmp_exponent /lt if, 1 then} .then,
|
|
6170
6155
|
0
|
|
6171
|
-
>
|
|
6156
|
+
> ;
|
|
6172
6157
|
|
|
6173
|
-
mag_gt_bit =
|
|
6158
|
+
mag_gt_bit =
|
|
6174
6159
|
<
|
|
6175
6160
|
{gt_magnitude_float64? if, 1 then} .then,
|
|
6176
6161
|
0
|
|
6177
|
-
>
|
|
6162
|
+
> ;
|
|
6178
6163
|
|
|
6179
|
-
mag_eq_bit =
|
|
6164
|
+
mag_eq_bit =
|
|
6180
6165
|
<
|
|
6181
6166
|
{{.x .exponent x, .y .exponent y} eq_exponent? ife,
|
|
6182
6167
|
{.x .fraction x, .y .fraction y} eq_fraction? iff,
|
|
6183
6168
|
1 then} .then,
|
|
6184
6169
|
0
|
|
6185
|
-
>
|
|
6170
|
+
> ;
|
|
6186
6171
|
|
|
6187
|
-
sig56_shift_right_carry =
|
|
6172
|
+
sig56_shift_right_carry =
|
|
6188
6173
|
{
|
|
6189
6174
|
.sum sum,
|
|
6190
6175
|
.carry carry,
|
|
@@ -6247,9 +6232,9 @@ sig56_shift_right_carry = ${sig56 sum, bit carry}
|
|
|
6247
6232
|
.sum .3 2,
|
|
6248
6233
|
.sum .2 1,
|
|
6249
6234
|
.bit0 0
|
|
6250
|
-
}
|
|
6235
|
+
} ;
|
|
6251
6236
|
|
|
6252
|
-
sig56_drop_grs =
|
|
6237
|
+
sig56_drop_grs =
|
|
6253
6238
|
{
|
|
6254
6239
|
0 0,
|
|
6255
6240
|
0 1,
|
|
@@ -6307,87 +6292,87 @@ sig56_drop_grs = $sig56
|
|
|
6307
6292
|
.53 53,
|
|
6308
6293
|
.54 54,
|
|
6309
6294
|
.55 55
|
|
6310
|
-
}
|
|
6295
|
+
} ;
|
|
6311
6296
|
|
|
6312
|
-
sig56_ulp = {} { 0 0, 0 1, 0 2, 1 3, 0 4, 0 5, 0 6, 0 7, 0 8, 0 9, 0 10, 0 11, 0 12, 0 13, 0 14, 0 15, 0 16, 0 17, 0 18, 0 19, 0 20, 0 21, 0 22, 0 23, 0 24, 0 25, 0 26, 0 27, 0 28, 0 29, 0 30, 0 31, 0 32, 0 33, 0 34, 0 35, 0 36, 0 37, 0 38, 0 39, 0 40, 0 41, 0 42, 0 43, 0 44, 0 45, 0 46, 0 47, 0 48, 0 49, 0 50, 0 51, 0 52, 0 53, 0 54, 0 55 }
|
|
6297
|
+
sig56_ulp = {} { 0 0, 0 1, 0 2, 1 3, 0 4, 0 5, 0 6, 0 7, 0 8, 0 9, 0 10, 0 11, 0 12, 0 13, 0 14, 0 15, 0 16, 0 17, 0 18, 0 19, 0 20, 0 21, 0 22, 0 23, 0 24, 0 25, 0 26, 0 27, 0 28, 0 29, 0 30, 0 31, 0 32, 0 33, 0 34, 0 35, 0 36, 0 37, 0 38, 0 39, 0 40, 0 41, 0 42, 0 43, 0 44, 0 45, 0 46, 0 47, 0 48, 0 49, 0 50, 0 51, 0 52, 0 53, 0 54, 0 55 } ;
|
|
6313
6298
|
|
|
6314
|
-
flags_add_from_bits =
|
|
6299
|
+
flags_add_from_bits =
|
|
6315
6300
|
<
|
|
6316
6301
|
{.overflow 1? if, overflow then} .then,
|
|
6317
6302
|
{.underflow 1? if, underflow then} .then,
|
|
6318
6303
|
{.inexact 1? if, inexact then} .then,
|
|
6319
6304
|
none
|
|
6320
|
-
>
|
|
6305
|
+
> ;
|
|
6321
6306
|
|
|
6322
|
-
flags_sub_from_bits =
|
|
6307
|
+
flags_sub_from_bits =
|
|
6323
6308
|
<
|
|
6324
6309
|
{.overflow 1? if, overflow then} .then,
|
|
6325
6310
|
{.underflow 1? if, underflow then} .then,
|
|
6326
6311
|
{.inexact 1? if, inexact then} .then,
|
|
6327
6312
|
none
|
|
6328
|
-
>
|
|
6313
|
+
> ;
|
|
6329
6314
|
|
|
6330
|
-
flags_mul_from_bits =
|
|
6315
|
+
flags_mul_from_bits =
|
|
6331
6316
|
<
|
|
6332
6317
|
{.overflow 1? if, overflow then} .then,
|
|
6333
6318
|
{.underflow 1? if, underflow then} .then,
|
|
6334
6319
|
{.inexact 1? if, inexact then} .then,
|
|
6335
6320
|
none
|
|
6336
|
-
>
|
|
6321
|
+
> ;
|
|
6337
6322
|
|
|
6338
|
-
flags_div_from_bits =
|
|
6323
|
+
flags_div_from_bits =
|
|
6339
6324
|
<
|
|
6340
6325
|
{.div_by_zero 1? if, div_by_zero then} .then,
|
|
6341
6326
|
{.overflow 1? if, overflow then} .then,
|
|
6342
6327
|
{.underflow 1? if, underflow then} .then,
|
|
6343
6328
|
{.inexact 1? if, inexact then} .then,
|
|
6344
6329
|
none
|
|
6345
|
-
>
|
|
6330
|
+
> ;
|
|
6346
6331
|
|
|
6347
|
-
flags_sub_from_add =
|
|
6332
|
+
flags_sub_from_add =
|
|
6348
6333
|
<
|
|
6349
6334
|
{/none if, none then} .then,
|
|
6350
6335
|
{/invalid if, invalid then} .then,
|
|
6351
6336
|
{/overflow if, overflow then} .then,
|
|
6352
6337
|
{/underflow if, underflow then} .then,
|
|
6353
6338
|
{/inexact if, inexact then} .then
|
|
6354
|
-
>
|
|
6339
|
+
> ;
|
|
6355
6340
|
|
|
6356
|
-
exp_all_ones_bit =
|
|
6341
|
+
exp_all_ones_bit =
|
|
6357
6342
|
<
|
|
6358
6343
|
{all_ones_exponent? if, 1 then} .then,
|
|
6359
6344
|
0
|
|
6360
|
-
>
|
|
6345
|
+
> ;
|
|
6361
6346
|
|
|
6362
|
-
exp_zero_bit =
|
|
6347
|
+
exp_zero_bit =
|
|
6363
6348
|
<
|
|
6364
6349
|
{zero_exponent? if, 1 then} .then,
|
|
6365
6350
|
0
|
|
6366
|
-
>
|
|
6351
|
+
> ;
|
|
6367
6352
|
|
|
6368
|
-
underflow_bit_of =
|
|
6353
|
+
underflow_bit_of =
|
|
6369
6354
|
<
|
|
6370
6355
|
{.exp zero_exponent? ife, .inexact 1? ifi, 1 then} .then,
|
|
6371
6356
|
0
|
|
6372
|
-
>
|
|
6357
|
+
> ;
|
|
6358
|
+
|
|
6373
6359
|
|
|
6374
6360
|
|
|
6375
|
-
$round_in = {sig56 sig, exp11 exp};
|
|
6376
|
-
$round_out = {sig56 sig, exp11 exp, bit inexact};
|
|
6377
6361
|
|
|
6378
|
-
|
|
6362
|
+
|
|
6363
|
+
sign_eq_bit =
|
|
6379
6364
|
<
|
|
6380
6365
|
{eq_sign? if, 1 then} .then,
|
|
6381
6366
|
0
|
|
6382
|
-
>
|
|
6367
|
+
> ;
|
|
6383
6368
|
|
|
6384
|
-
mux_sign =
|
|
6369
|
+
mux_sign =
|
|
6385
6370
|
<
|
|
6386
6371
|
{.sel 0? if, .a then} .then,
|
|
6387
6372
|
{.sel 1? if, .b then} .then
|
|
6388
|
-
>
|
|
6373
|
+
> ;
|
|
6389
6374
|
|
|
6390
|
-
round_sig56 =
|
|
6375
|
+
round_sig56 =
|
|
6391
6376
|
{
|
|
6392
6377
|
.sig sig,
|
|
6393
6378
|
.exp exp,
|
|
@@ -6440,99 +6425,99 @@ round_sig56 = $round_in
|
|
|
6440
6425
|
{.carry_inc sel, .exp a, .exp_inc b} mux_exp11 exp_out
|
|
6441
6426
|
}
|
|
6442
6427
|
{ .sig_out sig, .exp_out exp, .inexact inexact }
|
|
6443
|
-
|
|
6428
|
+
;
|
|
6444
6429
|
|
|
6445
6430
|
|
|
6446
6431
|
|
|
6447
|
-
+ = {} |+
|
|
6448
|
-
- = {} |-
|
|
6432
|
+
+ = {} |+ ;
|
|
6433
|
+
- = {} |- ;
|
|
6449
6434
|
|
|
6450
|
-
eq = {} |eq
|
|
6451
|
-
gt = {} |gt
|
|
6452
|
-
lt = {} |lt
|
|
6435
|
+
eq = {} |eq ;
|
|
6436
|
+
gt = {} |gt ;
|
|
6437
|
+
lt = {} |lt ;
|
|
6453
6438
|
|
|
6454
|
-
eq_exact_cmp = {} |eq_exact
|
|
6455
|
-
eq_zero_cmp = {} |eq_zero
|
|
6456
|
-
gt_cmp = {} |gt
|
|
6457
|
-
lt_cmp = {} |lt
|
|
6458
|
-
unordered_nan_cmp = {} |unordered_nan
|
|
6439
|
+
eq_exact_cmp = {} |eq_exact ;
|
|
6440
|
+
eq_zero_cmp = {} |eq_zero ;
|
|
6441
|
+
gt_cmp = {} |gt ;
|
|
6442
|
+
lt_cmp = {} |lt ;
|
|
6443
|
+
unordered_nan_cmp = {} |unordered_nan ;
|
|
6459
6444
|
|
|
6460
|
-
0? =
|
|
6461
|
-
1? =
|
|
6445
|
+
0? = {/0 if, () then} .then ;
|
|
6446
|
+
1? = {/1 if, () then} .then ;
|
|
6462
6447
|
|
|
6463
|
-
+? =
|
|
6464
|
-
-? =
|
|
6448
|
+
+? = {/+ if, () then} .then ;
|
|
6449
|
+
-? = {/- if, () then} .then ;
|
|
6465
6450
|
|
|
6466
|
-
eq_bit? =
|
|
6451
|
+
eq_bit? =
|
|
6467
6452
|
<
|
|
6468
6453
|
{.x 0? ifx, .y 0? ify, () then} .then,
|
|
6469
6454
|
{.x 1? ifx, .y 1? ify, () then} .then
|
|
6470
|
-
>
|
|
6455
|
+
> ;
|
|
6471
6456
|
|
|
6472
|
-
gt_bit? =
|
|
6457
|
+
gt_bit? =
|
|
6473
6458
|
{.x 1? ifx, .y 0? ify, () then} .then
|
|
6474
|
-
|
|
6459
|
+
;
|
|
6475
6460
|
|
|
6476
|
-
lt_bit? =
|
|
6461
|
+
lt_bit? =
|
|
6477
6462
|
{.x 0? ifx, .y 1? ify, () then} .then
|
|
6478
|
-
|
|
6463
|
+
;
|
|
6479
6464
|
|
|
6480
|
-
eq_sign? =
|
|
6465
|
+
eq_sign? =
|
|
6481
6466
|
<
|
|
6482
6467
|
{.x +? ifx, .y +? ify, () then} .then,
|
|
6483
6468
|
{.x -? ifx, .y -? ify, () then} .then
|
|
6484
|
-
>
|
|
6469
|
+
> ;
|
|
6485
6470
|
|
|
6486
|
-
zero_exponent? =
|
|
6471
|
+
zero_exponent? =
|
|
6487
6472
|
{.0 0? if0, .1 0? if1, .2 0? if2, .3 0? if3, .4 0? if4, .5 0? if5, .6 0? if6, .7 0? if7, .8 0? if8, .9 0? if9, .10 0? if10, () then} .then
|
|
6488
|
-
|
|
6473
|
+
;
|
|
6489
6474
|
|
|
6490
|
-
all_ones_exponent? =
|
|
6475
|
+
all_ones_exponent? =
|
|
6491
6476
|
{.0 1? if0, .1 1? if1, .2 1? if2, .3 1? if3, .4 1? if4, .5 1? if5, .6 1? if6, .7 1? if7, .8 1? if8, .9 1? if9, .10 1? if10, () then} .then
|
|
6492
|
-
|
|
6477
|
+
;
|
|
6493
6478
|
|
|
6494
|
-
not_all_ones_exponent? =
|
|
6479
|
+
not_all_ones_exponent? =
|
|
6495
6480
|
{<.10 0?, .9 0?, .8 0?, .7 0?, .6 0?, .5 0?, .4 0?, .3 0?, .2 0?, .1 0?, .0 0?> if, () then} .then
|
|
6496
|
-
|
|
6481
|
+
;
|
|
6497
6482
|
|
|
6498
|
-
zero_fraction? =
|
|
6483
|
+
zero_fraction? =
|
|
6499
6484
|
{.51 0? if51, .50 0? if50, .49 0? if49, .48 0? if48, .47 0? if47, .46 0? if46, .45 0? if45, .44 0? if44, .43 0? if43, .42 0? if42,
|
|
6500
6485
|
.41 0? if41, .40 0? if40, .39 0? if39, .38 0? if38, .37 0? if37, .36 0? if36, .35 0? if35, .34 0? if34, .33 0? if33, .32 0? if32,
|
|
6501
6486
|
.31 0? if31, .30 0? if30, .29 0? if29, .28 0? if28, .27 0? if27, .26 0? if26, .25 0? if25, .24 0? if24, .23 0? if23, .22 0? if22,
|
|
6502
6487
|
.21 0? if21, .20 0? if20, .19 0? if19, .18 0? if18, .17 0? if17, .16 0? if16, .15 0? if15, .14 0? if14, .13 0? if13, .12 0? if12,
|
|
6503
6488
|
.11 0? if11, .10 0? if10, .9 0? if9, .8 0? if8, .7 0? if7, .6 0? if6, .5 0? if5, .4 0? if4, .3 0? if3, .2 0? if2, .1 0? if1, .0 0? if0,
|
|
6504
6489
|
() then} .then
|
|
6505
|
-
|
|
6490
|
+
;
|
|
6506
6491
|
|
|
6507
|
-
nonzero_fraction? =
|
|
6492
|
+
nonzero_fraction? =
|
|
6508
6493
|
{<.51 1?, .50 1?, .49 1?, .48 1?, .47 1?, .46 1?, .45 1?, .44 1?, .43 1?, .42 1?,
|
|
6509
6494
|
.41 1?, .40 1?, .39 1?, .38 1?, .37 1?, .36 1?, .35 1?, .34 1?, .33 1?, .32 1?,
|
|
6510
6495
|
.31 1?, .30 1?, .29 1?, .28 1?, .27 1?, .26 1?, .25 1?, .24 1?, .23 1?, .22 1?,
|
|
6511
6496
|
.21 1?, .20 1?, .19 1?, .18 1?, .17 1?, .16 1?, .15 1?, .14 1?, .13 1?, .12 1?,
|
|
6512
6497
|
.11 1?, .10 1?, .9 1?, .8 1?, .7 1?, .6 1?, .5 1?, .4 1?, .3 1?, .2 1?, .1 1?, .0 1?> if, () then} .then
|
|
6513
|
-
|
|
6498
|
+
;
|
|
6514
6499
|
|
|
6515
|
-
nan_float64? =
|
|
6500
|
+
nan_float64? =
|
|
6516
6501
|
{.exponent all_ones_exponent? ife, .fraction nonzero_fraction? iff, () then} .then
|
|
6517
|
-
|
|
6502
|
+
;
|
|
6518
6503
|
|
|
6519
|
-
inf_float64? =
|
|
6504
|
+
inf_float64? =
|
|
6520
6505
|
{.exponent all_ones_exponent? ife, .fraction zero_fraction? iff, () then} .then
|
|
6521
|
-
|
|
6506
|
+
;
|
|
6522
6507
|
|
|
6523
|
-
finite_float64? =
|
|
6508
|
+
finite_float64? =
|
|
6524
6509
|
{.exponent not_all_ones_exponent? ife, () then} .then
|
|
6525
|
-
|
|
6510
|
+
;
|
|
6526
6511
|
|
|
6527
|
-
ordered_float64? =
|
|
6512
|
+
ordered_float64? =
|
|
6528
6513
|
<finite_float64?, inf_float64?>
|
|
6529
|
-
|
|
6514
|
+
;
|
|
6530
6515
|
|
|
6531
|
-
zero_float64? =
|
|
6516
|
+
zero_float64? =
|
|
6532
6517
|
{.exponent zero_exponent? ife, .fraction zero_fraction? iff, () then} .then
|
|
6533
|
-
|
|
6518
|
+
;
|
|
6534
6519
|
|
|
6535
|
-
cmp_step =
|
|
6520
|
+
cmp_step =
|
|
6536
6521
|
<
|
|
6537
6522
|
{.state /gt if, gt then} .then,
|
|
6538
6523
|
{.state /lt if, lt then} .then,
|
|
@@ -6543,100 +6528,100 @@ cmp_step = $cmp_step_in
|
|
|
6543
6528
|
{.bits eq_bit? if, eq then} .then
|
|
6544
6529
|
> then
|
|
6545
6530
|
} .then
|
|
6546
|
-
>
|
|
6547
|
-
|
|
6548
|
-
stepE10 =
|
|
6549
|
-
stepE9 =
|
|
6550
|
-
stepE8 =
|
|
6551
|
-
stepE7 =
|
|
6552
|
-
stepE6 =
|
|
6553
|
-
stepE5 =
|
|
6554
|
-
stepE4 =
|
|
6555
|
-
stepE3 =
|
|
6556
|
-
stepE2 =
|
|
6557
|
-
stepE1 =
|
|
6558
|
-
stepE0 =
|
|
6559
|
-
|
|
6560
|
-
cmp_exponent =
|
|
6561
|
-
{eq state, () pair}
|
|
6531
|
+
> ;
|
|
6532
|
+
|
|
6533
|
+
stepE10 = {{.state state, {.pair .x .10 x, .pair .y .10 y} bits} cmp_step state, .pair pair} ;
|
|
6534
|
+
stepE9 = {{.state state, {.pair .x .9 x, .pair .y .9 y} bits} cmp_step state, .pair pair} ;
|
|
6535
|
+
stepE8 = {{.state state, {.pair .x .8 x, .pair .y .8 y} bits} cmp_step state, .pair pair} ;
|
|
6536
|
+
stepE7 = {{.state state, {.pair .x .7 x, .pair .y .7 y} bits} cmp_step state, .pair pair} ;
|
|
6537
|
+
stepE6 = {{.state state, {.pair .x .6 x, .pair .y .6 y} bits} cmp_step state, .pair pair} ;
|
|
6538
|
+
stepE5 = {{.state state, {.pair .x .5 x, .pair .y .5 y} bits} cmp_step state, .pair pair} ;
|
|
6539
|
+
stepE4 = {{.state state, {.pair .x .4 x, .pair .y .4 y} bits} cmp_step state, .pair pair} ;
|
|
6540
|
+
stepE3 = {{.state state, {.pair .x .3 x, .pair .y .3 y} bits} cmp_step state, .pair pair} ;
|
|
6541
|
+
stepE2 = {{.state state, {.pair .x .2 x, .pair .y .2 y} bits} cmp_step state, .pair pair} ;
|
|
6542
|
+
stepE1 = {{.state state, {.pair .x .1 x, .pair .y .1 y} bits} cmp_step state, .pair pair} ;
|
|
6543
|
+
stepE0 = {{.state state, {.pair .x .0 x, .pair .y .0 y} bits} cmp_step state, .pair pair} ;
|
|
6544
|
+
|
|
6545
|
+
cmp_exponent =
|
|
6546
|
+
{eq state, () pair}
|
|
6562
6547
|
stepE10 stepE9 stepE8 stepE7 stepE6 stepE5 stepE4 stepE3 stepE2 stepE1 stepE0
|
|
6563
6548
|
.state
|
|
6564
|
-
|
|
6565
|
-
|
|
6566
|
-
gt_exponent? =
|
|
6567
|
-
eq_exponent? =
|
|
6568
|
-
lt_exponent? =
|
|
6569
|
-
|
|
6570
|
-
stepF51 =
|
|
6571
|
-
stepF50 =
|
|
6572
|
-
stepF49 =
|
|
6573
|
-
stepF48 =
|
|
6574
|
-
stepF47 =
|
|
6575
|
-
stepF46 =
|
|
6576
|
-
stepF45 =
|
|
6577
|
-
stepF44 =
|
|
6578
|
-
stepF43 =
|
|
6579
|
-
stepF42 =
|
|
6580
|
-
stepF41 =
|
|
6581
|
-
stepF40 =
|
|
6582
|
-
stepF39 =
|
|
6583
|
-
stepF38 =
|
|
6584
|
-
stepF37 =
|
|
6585
|
-
stepF36 =
|
|
6586
|
-
stepF35 =
|
|
6587
|
-
stepF34 =
|
|
6588
|
-
stepF33 =
|
|
6589
|
-
stepF32 =
|
|
6590
|
-
stepF31 =
|
|
6591
|
-
stepF30 =
|
|
6592
|
-
stepF29 =
|
|
6593
|
-
stepF28 =
|
|
6594
|
-
stepF27 =
|
|
6595
|
-
stepF26 =
|
|
6596
|
-
stepF25 =
|
|
6597
|
-
stepF24 =
|
|
6598
|
-
stepF23 =
|
|
6599
|
-
stepF22 =
|
|
6600
|
-
stepF21 =
|
|
6601
|
-
stepF20 =
|
|
6602
|
-
stepF19 =
|
|
6603
|
-
stepF18 =
|
|
6604
|
-
stepF17 =
|
|
6605
|
-
stepF16 =
|
|
6606
|
-
stepF15 =
|
|
6607
|
-
stepF14 =
|
|
6608
|
-
stepF13 =
|
|
6609
|
-
stepF12 =
|
|
6610
|
-
stepF11 =
|
|
6611
|
-
stepF10 =
|
|
6612
|
-
stepF9 =
|
|
6613
|
-
stepF8 =
|
|
6614
|
-
stepF7 =
|
|
6615
|
-
stepF6 =
|
|
6616
|
-
stepF5 =
|
|
6617
|
-
stepF4 =
|
|
6618
|
-
stepF3 =
|
|
6619
|
-
stepF2 =
|
|
6620
|
-
stepF1 =
|
|
6621
|
-
stepF0 =
|
|
6622
|
-
|
|
6623
|
-
cmp_fraction =
|
|
6624
|
-
{eq state, () pair}
|
|
6549
|
+
;
|
|
6550
|
+
|
|
6551
|
+
gt_exponent? = {cmp_exponent /gt if, () then} .then ;
|
|
6552
|
+
eq_exponent? = {cmp_exponent /eq if, () then} .then ;
|
|
6553
|
+
lt_exponent? = {cmp_exponent /lt if, () then} .then ;
|
|
6554
|
+
|
|
6555
|
+
stepF51 = {{.state state, {.pair .x .51 x, .pair .y .51 y} bits} cmp_step state, .pair pair} ;
|
|
6556
|
+
stepF50 = {{.state state, {.pair .x .50 x, .pair .y .50 y} bits} cmp_step state, .pair pair} ;
|
|
6557
|
+
stepF49 = {{.state state, {.pair .x .49 x, .pair .y .49 y} bits} cmp_step state, .pair pair} ;
|
|
6558
|
+
stepF48 = {{.state state, {.pair .x .48 x, .pair .y .48 y} bits} cmp_step state, .pair pair} ;
|
|
6559
|
+
stepF47 = {{.state state, {.pair .x .47 x, .pair .y .47 y} bits} cmp_step state, .pair pair} ;
|
|
6560
|
+
stepF46 = {{.state state, {.pair .x .46 x, .pair .y .46 y} bits} cmp_step state, .pair pair} ;
|
|
6561
|
+
stepF45 = {{.state state, {.pair .x .45 x, .pair .y .45 y} bits} cmp_step state, .pair pair} ;
|
|
6562
|
+
stepF44 = {{.state state, {.pair .x .44 x, .pair .y .44 y} bits} cmp_step state, .pair pair} ;
|
|
6563
|
+
stepF43 = {{.state state, {.pair .x .43 x, .pair .y .43 y} bits} cmp_step state, .pair pair} ;
|
|
6564
|
+
stepF42 = {{.state state, {.pair .x .42 x, .pair .y .42 y} bits} cmp_step state, .pair pair} ;
|
|
6565
|
+
stepF41 = {{.state state, {.pair .x .41 x, .pair .y .41 y} bits} cmp_step state, .pair pair} ;
|
|
6566
|
+
stepF40 = {{.state state, {.pair .x .40 x, .pair .y .40 y} bits} cmp_step state, .pair pair} ;
|
|
6567
|
+
stepF39 = {{.state state, {.pair .x .39 x, .pair .y .39 y} bits} cmp_step state, .pair pair} ;
|
|
6568
|
+
stepF38 = {{.state state, {.pair .x .38 x, .pair .y .38 y} bits} cmp_step state, .pair pair} ;
|
|
6569
|
+
stepF37 = {{.state state, {.pair .x .37 x, .pair .y .37 y} bits} cmp_step state, .pair pair} ;
|
|
6570
|
+
stepF36 = {{.state state, {.pair .x .36 x, .pair .y .36 y} bits} cmp_step state, .pair pair} ;
|
|
6571
|
+
stepF35 = {{.state state, {.pair .x .35 x, .pair .y .35 y} bits} cmp_step state, .pair pair} ;
|
|
6572
|
+
stepF34 = {{.state state, {.pair .x .34 x, .pair .y .34 y} bits} cmp_step state, .pair pair} ;
|
|
6573
|
+
stepF33 = {{.state state, {.pair .x .33 x, .pair .y .33 y} bits} cmp_step state, .pair pair} ;
|
|
6574
|
+
stepF32 = {{.state state, {.pair .x .32 x, .pair .y .32 y} bits} cmp_step state, .pair pair} ;
|
|
6575
|
+
stepF31 = {{.state state, {.pair .x .31 x, .pair .y .31 y} bits} cmp_step state, .pair pair} ;
|
|
6576
|
+
stepF30 = {{.state state, {.pair .x .30 x, .pair .y .30 y} bits} cmp_step state, .pair pair} ;
|
|
6577
|
+
stepF29 = {{.state state, {.pair .x .29 x, .pair .y .29 y} bits} cmp_step state, .pair pair} ;
|
|
6578
|
+
stepF28 = {{.state state, {.pair .x .28 x, .pair .y .28 y} bits} cmp_step state, .pair pair} ;
|
|
6579
|
+
stepF27 = {{.state state, {.pair .x .27 x, .pair .y .27 y} bits} cmp_step state, .pair pair} ;
|
|
6580
|
+
stepF26 = {{.state state, {.pair .x .26 x, .pair .y .26 y} bits} cmp_step state, .pair pair} ;
|
|
6581
|
+
stepF25 = {{.state state, {.pair .x .25 x, .pair .y .25 y} bits} cmp_step state, .pair pair} ;
|
|
6582
|
+
stepF24 = {{.state state, {.pair .x .24 x, .pair .y .24 y} bits} cmp_step state, .pair pair} ;
|
|
6583
|
+
stepF23 = {{.state state, {.pair .x .23 x, .pair .y .23 y} bits} cmp_step state, .pair pair} ;
|
|
6584
|
+
stepF22 = {{.state state, {.pair .x .22 x, .pair .y .22 y} bits} cmp_step state, .pair pair} ;
|
|
6585
|
+
stepF21 = {{.state state, {.pair .x .21 x, .pair .y .21 y} bits} cmp_step state, .pair pair} ;
|
|
6586
|
+
stepF20 = {{.state state, {.pair .x .20 x, .pair .y .20 y} bits} cmp_step state, .pair pair} ;
|
|
6587
|
+
stepF19 = {{.state state, {.pair .x .19 x, .pair .y .19 y} bits} cmp_step state, .pair pair} ;
|
|
6588
|
+
stepF18 = {{.state state, {.pair .x .18 x, .pair .y .18 y} bits} cmp_step state, .pair pair} ;
|
|
6589
|
+
stepF17 = {{.state state, {.pair .x .17 x, .pair .y .17 y} bits} cmp_step state, .pair pair} ;
|
|
6590
|
+
stepF16 = {{.state state, {.pair .x .16 x, .pair .y .16 y} bits} cmp_step state, .pair pair} ;
|
|
6591
|
+
stepF15 = {{.state state, {.pair .x .15 x, .pair .y .15 y} bits} cmp_step state, .pair pair} ;
|
|
6592
|
+
stepF14 = {{.state state, {.pair .x .14 x, .pair .y .14 y} bits} cmp_step state, .pair pair} ;
|
|
6593
|
+
stepF13 = {{.state state, {.pair .x .13 x, .pair .y .13 y} bits} cmp_step state, .pair pair} ;
|
|
6594
|
+
stepF12 = {{.state state, {.pair .x .12 x, .pair .y .12 y} bits} cmp_step state, .pair pair} ;
|
|
6595
|
+
stepF11 = {{.state state, {.pair .x .11 x, .pair .y .11 y} bits} cmp_step state, .pair pair} ;
|
|
6596
|
+
stepF10 = {{.state state, {.pair .x .10 x, .pair .y .10 y} bits} cmp_step state, .pair pair} ;
|
|
6597
|
+
stepF9 = {{.state state, {.pair .x .9 x, .pair .y .9 y} bits} cmp_step state, .pair pair} ;
|
|
6598
|
+
stepF8 = {{.state state, {.pair .x .8 x, .pair .y .8 y} bits} cmp_step state, .pair pair} ;
|
|
6599
|
+
stepF7 = {{.state state, {.pair .x .7 x, .pair .y .7 y} bits} cmp_step state, .pair pair} ;
|
|
6600
|
+
stepF6 = {{.state state, {.pair .x .6 x, .pair .y .6 y} bits} cmp_step state, .pair pair} ;
|
|
6601
|
+
stepF5 = {{.state state, {.pair .x .5 x, .pair .y .5 y} bits} cmp_step state, .pair pair} ;
|
|
6602
|
+
stepF4 = {{.state state, {.pair .x .4 x, .pair .y .4 y} bits} cmp_step state, .pair pair} ;
|
|
6603
|
+
stepF3 = {{.state state, {.pair .x .3 x, .pair .y .3 y} bits} cmp_step state, .pair pair} ;
|
|
6604
|
+
stepF2 = {{.state state, {.pair .x .2 x, .pair .y .2 y} bits} cmp_step state, .pair pair} ;
|
|
6605
|
+
stepF1 = {{.state state, {.pair .x .1 x, .pair .y .1 y} bits} cmp_step state, .pair pair} ;
|
|
6606
|
+
stepF0 = {{.state state, {.pair .x .0 x, .pair .y .0 y} bits} cmp_step state, .pair pair} ;
|
|
6607
|
+
|
|
6608
|
+
cmp_fraction =
|
|
6609
|
+
{eq state, () pair}
|
|
6625
6610
|
stepF51 stepF50 stepF49 stepF48 stepF47 stepF46 stepF45 stepF44 stepF43 stepF42 stepF41 stepF40 stepF39 stepF38 stepF37 stepF36 stepF35 stepF34 stepF33 stepF32 stepF31 stepF30
|
|
6626
6611
|
stepF29 stepF28 stepF27 stepF26 stepF25 stepF24 stepF23 stepF22 stepF21 stepF20 stepF19 stepF18 stepF17 stepF16 stepF15 stepF14 stepF13 stepF12 stepF11 stepF10 stepF9 stepF8 stepF7 stepF6 stepF5 stepF4 stepF3 stepF2 stepF1 stepF0
|
|
6627
6612
|
.state
|
|
6628
|
-
|
|
6613
|
+
;
|
|
6629
6614
|
|
|
6630
|
-
gt_fraction? =
|
|
6631
|
-
eq_fraction? =
|
|
6615
|
+
gt_fraction? = {cmp_fraction /gt if, () then} .then ;
|
|
6616
|
+
eq_fraction? = {cmp_fraction /eq if, () then} .then ;
|
|
6632
6617
|
|
|
6633
|
-
gt_magnitude_float64? =
|
|
6618
|
+
gt_magnitude_float64? =
|
|
6634
6619
|
<
|
|
6635
6620
|
{{.x .exponent x, .y .exponent y} gt_exponent? if, () then} .then,
|
|
6636
6621
|
{{.x .exponent x, .y .exponent y} eq_exponent? ife, {.x .fraction x, .y .fraction y} gt_fraction? iff, () then} .then
|
|
6637
|
-
>
|
|
6622
|
+
> ;
|
|
6638
6623
|
|
|
6639
|
-
cmp_float64 =
|
|
6624
|
+
cmp_float64 =
|
|
6640
6625
|
<
|
|
6641
6626
|
{<.x nan_float64?, .y nan_float64?> if, unordered_nan_cmp then} .then,
|
|
6642
6627
|
{.x zero_float64? ifx, .y zero_float64? ify, eq_zero_cmp then} .then,
|
|
@@ -6651,106 +6636,106 @@ cmp_float64 = $float_pair
|
|
|
6651
6636
|
{.x ordered_float64? ifx, .y ordered_float64? ify, .x .sign +? ifsx, .y .sign +? ifsy, {.y x, .x y} gt_magnitude_float64? ifm, lt_cmp then} .then,
|
|
6652
6637
|
{.x ordered_float64? ifx, .y ordered_float64? ify, .x .sign -? ifsx, .y .sign -? ifsy, {.y x, .x y} gt_magnitude_float64? ifm, gt_cmp then} .then,
|
|
6653
6638
|
{.x ordered_float64? ifx, .y ordered_float64? ify, .x .sign -? ifsx, .y .sign -? ifsy, gt_magnitude_float64? ifm, lt_cmp then} .then
|
|
6654
|
-
>
|
|
6639
|
+
> ;
|
|
6655
6640
|
|
|
6656
|
-
eq_float64? =
|
|
6657
|
-
gt_float64? =
|
|
6658
|
-
lt_float64? =
|
|
6659
|
-
le_float64? =
|
|
6660
|
-
ge_float64? =
|
|
6641
|
+
eq_float64? = {<cmp_float64 /eq_zero, cmp_float64 /eq_exact> if, () then} .then ;
|
|
6642
|
+
gt_float64? = {cmp_float64 /gt if, () then} .then ;
|
|
6643
|
+
lt_float64? = {cmp_float64 /lt if, () then} .then ;
|
|
6644
|
+
le_float64? = {<cmp_float64 /lt, cmp_float64 /eq_zero, cmp_float64 /eq_exact> if, () then} .then ;
|
|
6645
|
+
ge_float64? = {<cmp_float64 /gt, cmp_float64 /eq_zero, cmp_float64 /eq_exact> if, () then} .then ;
|
|
6661
6646
|
|
|
6662
|
-
exp0 = {} {0 0, 0 1, 0 2, 0 3, 0 4, 0 5, 0 6, 0 7, 0 8, 0 9, 0 10}
|
|
6663
|
-
exp_all1 = {} {1 0, 1 1, 1 2, 1 3, 1 4, 1 5, 1 6, 1 7, 1 8, 1 9, 1 10}
|
|
6647
|
+
exp0 = {} {0 0, 0 1, 0 2, 0 3, 0 4, 0 5, 0 6, 0 7, 0 8, 0 9, 0 10} ;
|
|
6648
|
+
exp_all1 = {} {1 0, 1 1, 1 2, 1 3, 1 4, 1 5, 1 6, 1 7, 1 8, 1 9, 1 10} ;
|
|
6664
6649
|
|
|
6665
6650
|
frac0 = {} {0 0, 0 1, 0 2, 0 3, 0 4, 0 5, 0 6, 0 7, 0 8, 0 9, 0 10, 0 11, 0 12, 0 13, 0 14, 0 15,
|
|
6666
6651
|
0 16, 0 17, 0 18, 0 19, 0 20, 0 21, 0 22, 0 23, 0 24, 0 25, 0 26, 0 27, 0 28, 0 29, 0 30, 0 31,
|
|
6667
6652
|
0 32, 0 33, 0 34, 0 35, 0 36, 0 37, 0 38, 0 39, 0 40, 0 41, 0 42, 0 43, 0 44, 0 45, 0 46, 0 47,
|
|
6668
|
-
0 48, 0 49, 0 50, 0 51}
|
|
6653
|
+
0 48, 0 49, 0 50, 0 51} ;
|
|
6669
6654
|
|
|
6670
6655
|
frac_lsb1 = {} {1 0, 0 1, 0 2, 0 3, 0 4, 0 5, 0 6, 0 7, 0 8, 0 9, 0 10, 0 11, 0 12, 0 13, 0 14, 0 15,
|
|
6671
6656
|
0 16, 0 17, 0 18, 0 19, 0 20, 0 21, 0 22, 0 23, 0 24, 0 25, 0 26, 0 27, 0 28, 0 29, 0 30, 0 31,
|
|
6672
6657
|
0 32, 0 33, 0 34, 0 35, 0 36, 0 37, 0 38, 0 39, 0 40, 0 41, 0 42, 0 43, 0 44, 0 45, 0 46, 0 47,
|
|
6673
|
-
0 48, 0 49, 0 50, 0 51}
|
|
6658
|
+
0 48, 0 49, 0 50, 0 51} ;
|
|
6674
6659
|
|
|
6675
|
-
pos_zero = {} {+ sign, exp0 exponent, frac0 fraction}
|
|
6676
|
-
neg_zero = {} {- sign, exp0 exponent, frac0 fraction}
|
|
6660
|
+
pos_zero = {} {+ sign, exp0 exponent, frac0 fraction} ;
|
|
6661
|
+
neg_zero = {} {- sign, exp0 exponent, frac0 fraction} ;
|
|
6677
6662
|
|
|
6678
|
-
pos_inf = {} {+ sign, exp_all1 exponent, frac0 fraction}
|
|
6679
|
-
neg_inf = {} {- sign, exp_all1 exponent, frac0 fraction}
|
|
6663
|
+
pos_inf = {} {+ sign, exp_all1 exponent, frac0 fraction} ;
|
|
6664
|
+
neg_inf = {} {- sign, exp_all1 exponent, frac0 fraction} ;
|
|
6680
6665
|
|
|
6681
|
-
qnan = {} {+ sign, exp_all1 exponent, frac_lsb1 fraction}
|
|
6666
|
+
qnan = {} {+ sign, exp_all1 exponent, frac_lsb1 fraction} ;
|
|
6682
6667
|
|
|
6683
|
-
flip_sign =
|
|
6668
|
+
flip_sign =
|
|
6684
6669
|
<
|
|
6685
|
-
{+? if, {} |-
|
|
6686
|
-
{-? if, {} |+
|
|
6687
|
-
>
|
|
6670
|
+
{+? if, {} |- then} .then,
|
|
6671
|
+
{-? if, {} |+ then} .then
|
|
6672
|
+
> ;
|
|
6688
6673
|
|
|
6689
|
-
xor_sign =
|
|
6674
|
+
xor_sign =
|
|
6690
6675
|
<
|
|
6691
|
-
{.x +? ifx, .y +? ify, {} |+
|
|
6692
|
-
{.x +? ifx, .y -? ify, {} |-
|
|
6693
|
-
{.x -? ifx, .y +? ify, {} |-
|
|
6694
|
-
{.x -? ifx, .y -? ify, {} |+
|
|
6695
|
-
>
|
|
6676
|
+
{.x +? ifx, .y +? ify, {} |+ then} .then,
|
|
6677
|
+
{.x +? ifx, .y -? ify, {} |- then} .then,
|
|
6678
|
+
{.x -? ifx, .y +? ify, {} |- then} .then,
|
|
6679
|
+
{.x -? ifx, .y -? ify, {} |+ then} .then
|
|
6680
|
+
> ;
|
|
6696
6681
|
|
|
6697
|
-
opp_sign? =
|
|
6682
|
+
opp_sign? =
|
|
6698
6683
|
<
|
|
6699
6684
|
{.x +? ifx, .y -? ify, () then} .then,
|
|
6700
6685
|
{.x -? ifx, .y +? ify, () then} .then
|
|
6701
|
-
>
|
|
6686
|
+
> ;
|
|
6702
6687
|
|
|
6703
|
-
inf_of_sign =
|
|
6688
|
+
inf_of_sign =
|
|
6704
6689
|
<
|
|
6705
6690
|
{+? if, pos_inf then} .then,
|
|
6706
6691
|
{-? if, neg_inf then} .then
|
|
6707
|
-
>
|
|
6692
|
+
> ;
|
|
6708
6693
|
|
|
6709
|
-
zero_of_sign =
|
|
6694
|
+
zero_of_sign =
|
|
6710
6695
|
<
|
|
6711
6696
|
{+? if, pos_zero then} .then,
|
|
6712
6697
|
{-? if, neg_zero then} .then
|
|
6713
|
-
>
|
|
6698
|
+
> ;
|
|
6714
6699
|
|
|
6715
|
-
negate_float64 =
|
|
6700
|
+
negate_float64 =
|
|
6716
6701
|
{.sign flip_sign sign, .exponent exponent, .fraction fraction}
|
|
6717
|
-
|
|
6702
|
+
;
|
|
6718
6703
|
|
|
6719
|
-
pair_signs =
|
|
6704
|
+
pair_signs =
|
|
6720
6705
|
{.x .sign x, .y .sign y}
|
|
6721
|
-
|
|
6706
|
+
;
|
|
6722
6707
|
|
|
6723
|
-
xor_sign_of_pair =
|
|
6708
|
+
xor_sign_of_pair =
|
|
6724
6709
|
pair_signs xor_sign
|
|
6725
|
-
|
|
6710
|
+
;
|
|
6726
6711
|
|
|
6727
|
-
opp_signs_of_pair? =
|
|
6712
|
+
opp_signs_of_pair? =
|
|
6728
6713
|
pair_signs opp_sign?
|
|
6729
|
-
|
|
6714
|
+
;
|
|
6730
6715
|
|
|
6731
|
-
inf_from_pair_sign =
|
|
6716
|
+
inf_from_pair_sign =
|
|
6732
6717
|
xor_sign_of_pair inf_of_sign
|
|
6733
|
-
|
|
6718
|
+
;
|
|
6734
6719
|
|
|
6735
|
-
zero_from_pair_sign =
|
|
6720
|
+
zero_from_pair_sign =
|
|
6736
6721
|
xor_sign_of_pair zero_of_sign
|
|
6737
|
-
|
|
6722
|
+
;
|
|
6738
6723
|
|
|
6739
|
-
add_float64 =
|
|
6724
|
+
add_float64 =
|
|
6740
6725
|
float64_add
|
|
6741
6726
|
.result
|
|
6742
|
-
|
|
6727
|
+
;
|
|
6728
|
+
|
|
6729
|
+
|
|
6730
|
+
|
|
6731
|
+
|
|
6743
6732
|
|
|
6744
|
-
$add_same_in = {sig56 x, sig56 y, exp11 exp, sign sign};
|
|
6745
|
-
$add_same_out = {sig56 sig, exp11 exp, bit inexact, bit overflow, bit underflow, sign sign};
|
|
6746
|
-
$sub_same_in = {sig56 big, sig56 small, exp11 exp, sign sign};
|
|
6747
|
-
$sub_same_out = {sig56 sig, exp11 exp, bit inexact, bit overflow, bit underflow, sign sign};
|
|
6748
6733
|
|
|
6749
|
-
float64_from_parts =
|
|
6734
|
+
float64_from_parts =
|
|
6750
6735
|
{.sign sign, .exponent exponent, (.sig frac52_from_sig56) fraction}
|
|
6751
|
-
|
|
6736
|
+
;
|
|
6752
6737
|
|
|
6753
|
-
add_same_sign =
|
|
6738
|
+
add_same_sign =
|
|
6754
6739
|
{
|
|
6755
6740
|
.exp exp,
|
|
6756
6741
|
.sign sign,
|
|
@@ -6797,9 +6782,9 @@ add_same_sign = $add_same_in
|
|
|
6797
6782
|
{.overflow x, .inexact y} or_bit inexact_final
|
|
6798
6783
|
}
|
|
6799
6784
|
{ .sig_round sig, .exp_round exp, .inexact_final inexact, .overflow overflow, .underflow underflow, .sign sign }
|
|
6800
|
-
|
|
6785
|
+
;
|
|
6801
6786
|
|
|
6802
|
-
sub_same_sign =
|
|
6787
|
+
sub_same_sign =
|
|
6803
6788
|
{
|
|
6804
6789
|
.exp exp,
|
|
6805
6790
|
.sign sign,
|
|
@@ -6847,9 +6832,9 @@ sub_same_sign = $sub_same_in
|
|
|
6847
6832
|
{.overflow x, .inexact y} or_bit inexact_final
|
|
6848
6833
|
}
|
|
6849
6834
|
{ .sig_round sig, .exp_round exp, .inexact_final inexact, .overflow overflow, .underflow underflow, .sign sign }
|
|
6850
|
-
|
|
6835
|
+
;
|
|
6851
6836
|
|
|
6852
|
-
float64_add_finite =
|
|
6837
|
+
float64_add_finite =
|
|
6853
6838
|
{
|
|
6854
6839
|
.x x,
|
|
6855
6840
|
.y y,
|
|
@@ -6987,9 +6972,9 @@ float64_add_finite = $float_pair
|
|
|
6987
6972
|
{.overflow 0? if, {.float_res result, .flags flags} then} .then
|
|
6988
6973
|
> then} .then
|
|
6989
6974
|
> then} .then
|
|
6990
|
-
>
|
|
6975
|
+
> ;
|
|
6991
6976
|
|
|
6992
|
-
float64_add =
|
|
6977
|
+
float64_add =
|
|
6993
6978
|
<
|
|
6994
6979
|
{.x nan_float64? ifx, {qnan result, none flags} then} .then,
|
|
6995
6980
|
{.y nan_float64? ify, {qnan result, none flags} then} .then,
|
|
@@ -7000,24 +6985,24 @@ float64_add = $float_pair
|
|
|
7000
6985
|
{.x zero_float64? ifx, {.y result, none flags} then} .then,
|
|
7001
6986
|
{.y zero_float64? ify, {.x result, none flags} then} .then,
|
|
7002
6987
|
{.x finite_float64? ifx, .y finite_float64? ify, float64_add_finite then} .then
|
|
7003
|
-
>
|
|
6988
|
+
> ;
|
|
7004
6989
|
|
|
7005
|
-
negate_y_pair =
|
|
6990
|
+
negate_y_pair =
|
|
7006
6991
|
{.x x, (.y negate_float64) y}
|
|
7007
|
-
|
|
6992
|
+
;
|
|
7008
6993
|
|
|
7009
|
-
sub_float64 =
|
|
6994
|
+
sub_float64 =
|
|
7010
6995
|
negate_y_pair
|
|
7011
6996
|
add_float64
|
|
7012
|
-
|
|
6997
|
+
;
|
|
7013
6998
|
|
|
7014
|
-
float64_sub =
|
|
6999
|
+
float64_sub =
|
|
7015
7000
|
negate_y_pair
|
|
7016
7001
|
float64_add
|
|
7017
7002
|
{ .result result, (.flags flags_sub_from_add) flags }
|
|
7018
|
-
|
|
7003
|
+
;
|
|
7019
7004
|
|
|
7020
|
-
float64_mul_finite =
|
|
7005
|
+
float64_mul_finite =
|
|
7021
7006
|
{ {.x x, .y y} args }
|
|
7022
7007
|
{ .args args, {.args .x .sign x, .args .y .sign y} xor_sign sign_out }
|
|
7023
7008
|
{ .args args, .sign_out sign_out, .args .x .exponent exp_x }
|
|
@@ -7047,9 +7032,9 @@ float64_mul_finite = $float_pair
|
|
|
7047
7032
|
<
|
|
7048
7033
|
{.overflow 1? if, {.inf_res result, .flags flags} then} .then,
|
|
7049
7034
|
{.overflow 0? if, {.float_res result, .flags flags} then} .then
|
|
7050
|
-
>
|
|
7035
|
+
> ;
|
|
7051
7036
|
|
|
7052
|
-
float64_mul =
|
|
7037
|
+
float64_mul =
|
|
7053
7038
|
<
|
|
7054
7039
|
{.x nan_float64? ifx, {qnan result, none flags} then} .then,
|
|
7055
7040
|
{.y nan_float64? ify, {qnan result, none flags} then} .then,
|
|
@@ -7060,14 +7045,14 @@ float64_mul = $float_pair
|
|
|
7060
7045
|
{.x zero_float64? ifx, .y ordered_float64? ify, {zero_from_pair_sign result, none flags} then} .then,
|
|
7061
7046
|
{.y zero_float64? ify, .x ordered_float64? ifx, {zero_from_pair_sign result, none flags} then} .then,
|
|
7062
7047
|
{.x finite_float64? ifx, .y finite_float64? ify, float64_mul_finite then} .then
|
|
7063
|
-
>
|
|
7048
|
+
> ;
|
|
7064
7049
|
|
|
7065
|
-
mul_float64 =
|
|
7050
|
+
mul_float64 =
|
|
7066
7051
|
float64_mul
|
|
7067
7052
|
.result
|
|
7068
|
-
|
|
7053
|
+
;
|
|
7069
7054
|
|
|
7070
|
-
float64_div_finite =
|
|
7055
|
+
float64_div_finite =
|
|
7071
7056
|
{
|
|
7072
7057
|
(.x sig56_from_float64) sigx,
|
|
7073
7058
|
(.y sig56_from_float64) sigy,
|
|
@@ -7154,9 +7139,9 @@ float64_div_finite = $float_pair
|
|
|
7154
7139
|
<
|
|
7155
7140
|
{.overflow 1? if, {.inf_res result, .flags flags} then} .then,
|
|
7156
7141
|
{.overflow 0? if, {.float_res result, .flags flags} then} .then
|
|
7157
|
-
>
|
|
7142
|
+
> ;
|
|
7158
7143
|
|
|
7159
|
-
float64_div =
|
|
7144
|
+
float64_div =
|
|
7160
7145
|
<
|
|
7161
7146
|
{.x nan_float64? ifx, {qnan result, none flags} then} .then,
|
|
7162
7147
|
{.y nan_float64? ify, {qnan result, none flags} then} .then,
|
|
@@ -7167,12 +7152,12 @@ float64_div = $float_pair
|
|
|
7167
7152
|
{.x ordered_float64? ifx, .y zero_float64? ify, {inf_from_pair_sign result, div_by_zero flags} then} .then,
|
|
7168
7153
|
{.x zero_float64? ifx, .y ordered_float64? ify, {zero_from_pair_sign result, none flags} then} .then,
|
|
7169
7154
|
{.x finite_float64? ifx, .y finite_float64? ify, float64_div_finite then} .then
|
|
7170
|
-
>
|
|
7155
|
+
> ;
|
|
7171
7156
|
|
|
7172
|
-
div_float64 =
|
|
7157
|
+
div_float64 =
|
|
7173
7158
|
float64_div
|
|
7174
7159
|
.result
|
|
7175
|
-
|
|
7160
|
+
;
|
|
7176
7161
|
|
|
7177
7162
|
# -----------------------------------------------------------------------------
|
|
7178
7163
|
# Public API
|
|
@@ -7200,25 +7185,25 @@ neg = negate_float64;
|
|
|
7200
7185
|
# --- useful float64 constants (IEEE-754 binary64) ---
|
|
7201
7186
|
|
|
7202
7187
|
# 1.0 exponent = 1023 = 0b01111111111
|
|
7203
|
-
exp_1 = {} {1 0, 1 1, 1 2, 1 3, 1 4, 1 5, 1 6, 1 7, 1 8, 1 9, 0 10}
|
|
7188
|
+
exp_1 = {} {1 0, 1 1, 1 2, 1 3, 1 4, 1 5, 1 6, 1 7, 1 8, 1 9, 0 10} ;
|
|
7204
7189
|
|
|
7205
7190
|
# 10.0 exponent = 1026 = 1023 + 3 = 0b10000000010
|
|
7206
|
-
exp_10 = {} {0 0, 1 1, 0 2, 0 3, 0 4, 0 5, 0 6, 0 7, 0 8, 0 9, 1 10}
|
|
7191
|
+
exp_10 = {} {0 0, 1 1, 0 2, 0 3, 0 4, 0 5, 0 6, 0 7, 0 8, 0 9, 1 10} ;
|
|
7207
7192
|
|
|
7208
7193
|
# 10.0 significand = 1.01b => fraction bit 50 = 1 (2^-2), everything else 0
|
|
7209
7194
|
frac_10 = {} {0 0, 0 1, 0 2, 0 3, 0 4, 0 5, 0 6, 0 7, 0 8, 0 9, 0 10, 0 11, 0 12, 0 13, 0 14, 0 15,
|
|
7210
7195
|
0 16, 0 17, 0 18, 0 19, 0 20, 0 21, 0 22, 0 23, 0 24, 0 25, 0 26, 0 27, 0 28, 0 29, 0 30, 0 31,
|
|
7211
7196
|
0 32, 0 33, 0 34, 0 35, 0 36, 0 37, 0 38, 0 39, 0 40, 0 41, 0 42, 0 43, 0 44, 0 45, 0 46, 0 47,
|
|
7212
|
-
0 48, 0 49, 1 50, 0 51}
|
|
7197
|
+
0 48, 0 49, 1 50, 0 51} ;
|
|
7213
7198
|
|
|
7214
7199
|
# signed zeros (aliases)
|
|
7215
7200
|
0f = pos_zero;
|
|
7216
7201
|
-0f = neg_zero;
|
|
7217
7202
|
|
|
7218
7203
|
# 1.0, -1.0, 10.0
|
|
7219
|
-
1f = {} {+ sign, exp_1 exponent, frac0 fraction}
|
|
7220
|
-
-1f = {} {- sign, exp_1 exponent, frac0 fraction}
|
|
7221
|
-
10f = {} {+ sign, exp_10 exponent, frac_10 fraction}
|
|
7204
|
+
1f = {} {+ sign, exp_1 exponent, frac0 fraction} ;
|
|
7205
|
+
-1f = {} {- sign, exp_1 exponent, frac0 fraction} ;
|
|
7206
|
+
10f = {} {+ sign, exp_10 exponent, frac_10 fraction} ;
|
|
7222
7207
|
|
|
7223
7208
|
()
|
|
7224
7209
|
|
|
@@ -7232,33 +7217,33 @@ frac_10 = {} {0 0, 0 1, 0 2, 0 3, 0 4, 0 5, 0 6, 0 7, 0 8, 0 9, 0 10, 0 11, 0 12
|
|
|
7232
7217
|
exp_1024 = {}
|
|
7233
7218
|
{ 1 10,
|
|
7234
7219
|
0 9, 0 8, 0 7, 0 6, 0 5, 0 4, 0 3, 0 2, 0 1, 0 0
|
|
7235
|
-
}
|
|
7220
|
+
} ;
|
|
7236
7221
|
|
|
7237
7222
|
# exponent = 1056: 0b10000100000 (10^10 range)
|
|
7238
7223
|
exp_1e10 = {}
|
|
7239
|
-
{ 0 0, 0 1, 0 2, 0 3, 0 4, 1 5, 0 6, 0 7, 0 8, 0 9, 1 10 }
|
|
7224
|
+
{ 0 0, 0 1, 0 2, 0 3, 0 4, 1 5, 0 6, 0 7, 0 8, 0 9, 1 10 } ;
|
|
7240
7225
|
|
|
7241
7226
|
frac_1e10 = {}
|
|
7242
7227
|
{ 0 0, 0 1, 0 2, 0 3, 0 4, 0 5, 0 6, 0 7, 0 8, 0 9, 0 10, 0 11, 0 12, 0 13, 0 14, 0 15,
|
|
7243
7228
|
0 16, 0 17, 0 18, 0 19, 0 20, 0 21, 0 22, 0 23, 0 24, 0 25, 0 26, 0 27, 0 28, 1 29, 0 30, 0 31,
|
|
7244
7229
|
1 32, 1 33, 1 34, 1 35, 1 36, 0 37, 1 38, 0 39, 0 40, 0 41, 0 42, 0 43, 0 44, 1 45, 0 46, 1 47,
|
|
7245
|
-
0 48, 1 49, 0 50, 0 51 }
|
|
7230
|
+
0 48, 1 49, 0 50, 0 51 } ;
|
|
7246
7231
|
|
|
7247
7232
|
frac_1e10_p1 = {}
|
|
7248
7233
|
{ 0 0, 0 1, 0 2, 0 3, 0 4, 0 5, 0 6, 0 7, 0 8, 0 9, 0 10, 0 11, 0 12, 0 13, 0 14, 0 15,
|
|
7249
7234
|
0 16, 0 17, 0 18, 1 19, 0 20, 0 21, 0 22, 0 23, 0 24, 0 25, 0 26, 0 27, 0 28, 1 29, 0 30, 0 31,
|
|
7250
7235
|
1 32, 1 33, 1 34, 1 35, 1 36, 0 37, 1 38, 0 39, 0 40, 0 41, 0 42, 0 43, 0 44, 1 45, 0 46, 1 47,
|
|
7251
|
-
0 48, 1 49, 0 50, 0 51 }
|
|
7236
|
+
0 48, 1 49, 0 50, 0 51 } ;
|
|
7252
7237
|
|
|
7253
|
-
one = {+ sign, exp_1023 exponent, frac0 fraction}
|
|
7254
|
-
two = {+ sign, exp_1024 exponent, frac0 fraction}
|
|
7255
|
-
neg_one = {- sign, exp_1023 exponent, frac0 fraction}
|
|
7256
|
-
ten_billion = {+ sign, exp_1e10 exponent, frac_1e10 fraction}
|
|
7257
|
-
ten_billion_p1 = {+ sign, exp_1e10 exponent, frac_1e10_p1 fraction}
|
|
7238
|
+
one = {+ sign, exp_1023 exponent, frac0 fraction} ;
|
|
7239
|
+
two = {+ sign, exp_1024 exponent, frac0 fraction} ;
|
|
7240
|
+
neg_one = {- sign, exp_1023 exponent, frac0 fraction} ;
|
|
7241
|
+
ten_billion = {+ sign, exp_1e10 exponent, frac_1e10 fraction} ;
|
|
7242
|
+
ten_billion_p1 = {+ sign, exp_1e10 exponent, frac_1e10_p1 fraction} ;
|
|
7258
7243
|
|
|
7259
7244
|
# smallest positive subnormal: exponent=0, fraction LSB=1
|
|
7260
|
-
pos_denorm_min = {+ sign, exp0 exponent, frac_lsb1 fraction}
|
|
7261
|
-
neg_denorm_min = {- sign, exp0 exponent, frac_lsb1 fraction}
|
|
7245
|
+
pos_denorm_min = {+ sign, exp0 exponent, frac_lsb1 fraction} ;
|
|
7246
|
+
neg_denorm_min = {- sign, exp0 exponent, frac_lsb1 fraction} ;
|
|
7262
7247
|
|
|
7263
7248
|
# -----------------------------------------------------------------------------
|
|
7264
7249
|
# Expanded test product (make sure THIS is the last expression in the file)
|