Skip to content

Commit 3116391

Browse files
lucabertacciniStefan Machgurkaynakaklshhuettern
authored
Release 0.7.0 (#80)
Create release 0.7.0: Align CVFPU to RVV requirements (ARA branch merged) Fix f2i cast edge cases Fix RDN bug in floating-point multiplications Fix shift amount width in fma and fma_multi --------- Co-authored-by: Stefan Mach <smach@iis.ee.ethz.ch> Co-authored-by: Frank K. Gürkaynak <kgf@ee.ethz.ch> Co-authored-by: Akilesh Kannan <aklsh@tuta.io> Co-authored-by: Noah Huetter <noahhuetter@gmail.com> Co-authored-by: Stefan Mach <stefan.mach@axelera.ai> Co-authored-by: Mike Thompson <mike@openhwgroup.org> Co-authored-by: Flavien Solt <flsolt@ethz.ch> Co-authored-by: Matteo Perotti <mperotti@iis.ee.ethz.ch> Co-authored-by: Shafiullah <shafi.ullah@10xengineers.ai>
1 parent 8dc4440 commit 3116391

20 files changed

+316
-52
lines changed

Bender.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Copyright 2019 ETH Zurich and University of Bologna.
2+
# Solderpad Hardware License, Version 0.51, see LICENSE for details.
3+
# SPDX-License-Identifier: SHL-0.51
14
package:
25
name: FPnew
36
authors: ["Stefan Mach <smach@iis.ee.ethz.ch>"]

CITATION.cff

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
cff-version: 1.2.0
2+
message: "If you use FPnew, please cite it as below."
3+
authors:
4+
- family-names: "Mach"
5+
given-names: "Stefan"
6+
orcid: "https://orcid.org/0000-0002-3476-8857"
7+
title: "FPnew: - New Floating-Point Unit with Transprecision Capabilities"
8+
version: 0.6.6
9+
url: "https://github.com/pulp-platform/fpnew"
10+
preferred-citation:
11+
type: article
12+
authors:
13+
- family-names: "Mach"
14+
given-names: "Stefan"
15+
orcid: "https://orcid.org/0000-0002-3476-8857"
16+
- family-names: "Schuiki"
17+
given-names: "Fabian"
18+
orcid: "https://orcid.org/0000-0002-9923-5031"
19+
- family-names: "Zaruba"
20+
given-names: "Florian"
21+
orcid: "https://orcid.org/0000-0002-8194-6521"
22+
- family-names: "Benini"
23+
given-names: "Luca"
24+
orcid: "https://orcid.org/0000-0001-8068-3806"
25+
doi: "10.1109/TVLSI.2020.3044752"
26+
journal: "IEEE Transactions on Very Large Scale Integration (VLSI) Systems"
27+
month: 12
28+
start: 774
29+
end: 787
30+
title: "FPnew: An Open-Source Multiformat Floating-Point Unit Architecture for Energy-Proportional Transprecision Computing"
31+
issue: 4
32+
volume: 29
33+
year: 2020

README.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
Parametric floating-point unit with support for standard RISC-V formats and operations as well as transprecision formats, written in SystemVerilog.
44

5-
Maintainer: Stefan Mach <smach@iis.ee.ethz.ch>
5+
Maintainer: Luca Bertaccini <lbertaccini@iis.ee.ethz.ch>
6+
Principal Author: Stefan Mach <smach@iis.ee.ethz.ch>
67

78
## Features
89

@@ -138,6 +139,32 @@ Furthermore, this repository tries to adhere to [SemVer](https://semver.org/), a
138139

139140
FPnew is released under the *SolderPad Hardware License*, which is a permissive license based on Apache 2.0. Please refer to the [license file](LICENSE) for further information.
140141

142+
143+
## Publication
144+
145+
If you use FPnew in your work, you can cite us:
146+
147+
<details>
148+
<summary>FPnew Publication</summary>
149+
<p>
150+
151+
```
152+
@article{mach2020fpnew,
153+
title={Fpnew: An open-source multiformat floating-point unit architecture for energy-proportional transprecision computing},
154+
author={Mach, Stefan and Schuiki, Fabian and Zaruba, Florian and Benini, Luca},
155+
journal={IEEE Transactions on Very Large Scale Integration (VLSI) Systems},
156+
volume={29},
157+
number={4},
158+
pages={774--787},
159+
year={2020},
160+
publisher={IEEE}
161+
}
162+
```
163+
164+
</p>
165+
</details>
166+
167+
141168
## Acknowledgement
142169

143170
This project has received funding from the European Union's Horizon 2020 research and innovation programme under grant agreement No 732631.

docs/CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,22 @@ Versions of the IP in the same major relase are "pin-compatible" with each other
1111
## [Unreleased]
1212

1313
### Added
14+
- Citation file `CITATION.cff`
15+
- Add support for RISC-V compliant classify in vectorial mode when the vector element width is at least 10 bits
16+
- Add `mask` input signal to mask exceptions from inactive SIMD elements
17+
- Add support for rounding toward odd (RISC-V V 1.0 compliant)
18+
1419
### Changed
20+
- Code ownership to @lucabertaccini
21+
1522
### Fixed
23+
- Fix de-synchronization among vectorial lanes during variable-latency operations (`fdiv`, `fsqrt`)
1624

1725

1826
## [0.6.6] - 2021-04-19
1927

2028
### Changed
21-
- [common_cells] Bump common cells version
29+
- [common_cells] Bump common cells version [(#44)](https://github.com/pulp-platform/fpnew/issues/44)
2230

2331
## [0.6.5] - 2020-11-06
2432

docs/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# Global owners
2-
* @stmach
2+
* @lucabertaccini

docs/README.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,25 +24,26 @@ FPnew is a parametric floating-point unit which supports standard RISC-V operati
2424
The top-level module of the FPU is `fpnew_top` and its interface is further described in this section.
2525
FPnew uses a synchronous interface using handshaking to transfer data into and out of the FPU.
2626

27-
All array types are packed due to poor support of unpacked arrays in some EDA tools.
27+
All array types are packed due to poor support of unpacked arrays in some EDA tools.
2828
SystemVerilog `interface`s are not used due to poor support in some EDA tools.
2929

3030

3131
### Parameters
3232

33-
The configuration parameters use data types defined in `fpnew_pkg` which are structs containing multi-dimensional arrays of custom enumeration types.
33+
The configuration parameters use data types defined in `fpnew_pkg` which are structs containing multi-dimensional arrays of custom enumeration types.
3434
For more in-depth explanations on how to configure the unit and the layout of the types used, please refer to the [Configuration Section](#configuration).
3535

3636
| Parameter Name | Description |
3737
|------------------|------------------------------------------------------------------------------------------------------------------------------|
3838
| `Features` | Specifies the features of the FPU, such as the set of supported formats and operations. |
3939
| `Implementation` | Allows to control how the above features are implemented, such as the number of pipeline stages and architecture of subunits |
4040
| `TagType` | The SystemVerilog data type of the operation tag |
41-
41+
| `TrueSIMDClass` | If enabled, the result of a classify operation in vectorial mode will be RISC-V compliant if each output has at least 10 bits|
42+
| `EnableSIMDMask` | Enable the RISC-V floating-point status flags masking of inactive vectorial lanes. When disabled, `simd_mask_i` is inactive |
4243

4344
### Ports
4445

45-
Many ports use custom types and enumerations from `fpnew_pkg` to improve code structure internally (see [Data Types](#data-types)).
46+
Many ports use custom types and enumerations from `fpnew_pkg` to improve code structure internally (see [Data Types](#data-types)).
4647
As the width of some input/output signals is defined by the configuration, it is denoted `W` in the following table.
4748

4849
| Port Name | Direction | Type | Description |
@@ -58,6 +59,7 @@ As the width of some input/output signals is defined by the configuration, it is
5859
| `int_fmt_i` | in | `int_format_e` | Integer format |
5960
| `vectorial_op_i` | in | `logic` | Vectorial operation select |
6061
| `tag_i` | in | `TagType` | Operation tag input |
62+
| `simd_mask_i` | in | `MaskType` | Vector mask input for the status flags |
6163
| `in_valid_i` | in | `logic` | Input data valid (see [Handshake](#handshake-interface)) |
6264
| `in_ready_o` | out | `logic` | Input interface ready (see [Handshake](#handshake-interface)) |
6365
| `flush_i` | in | `logic` | Synchronous pipeline reset |
@@ -84,6 +86,7 @@ Enumeration of type `logic [2:0]` holding available rounding modes, encoded for
8486
| `RDN` | `3'b010` | Toward negative infinity |
8587
| `RUP` | `3'b011` | Toward positive infinity |
8688
| `RMM` | `3'b100` | To nearest, tie away from zero |
89+
| `ROD` | `3'b101` | To odd |
8790
| `DYN` | `3'b111` | *RISC-V Dynamic RM, invalid if passed to operations* |
8891

8992
##### `operation_e` - FP Operation
@@ -197,6 +200,10 @@ Tags are an optional feature of FPnew and can be controlled by setting the `TagT
197200
In order to disable the use of tags, set `TagType` to `logic` (the default value), and bind the `tag_i` port to a static value.
198201
Furthermore ensure that your synthesis tool removes static registers.
199202

203+
### Mask for the status flags
204+
205+
This input is meant to be used in vectorial mode. The mask for the status flags is an input vector with `NumLanes` bits, and each bit can mask the status flags of a different FPU vectorial lane. This helps not make the final output flag signal dirty due to status flags from inactive lanes.
206+
If `simd_mask_i[n] == 1'b0`, the `n`th FPU lane will be masked for this operation and its resulting status flags will not be propagated to the final output status flag.
200207

201208
## Configuration
202209

@@ -324,7 +331,7 @@ Currently, the follwoing unit types are available for the FPU operation groups:
324331
'{default: MERGED}, // DIVSQRT
325332
'{default: PARALLEL}, // NONCOMP
326333
'{default: MERGED}} // CONV`
327-
```
334+
```
328335
(all formats within operation group use same type)
329336

330337

@@ -348,7 +355,7 @@ The configuration `pipe_config_t` is an enumeration of type `logic [1:0]` holdi
348355
### Adding Custom Formats
349356

350357
In order to add custom FP or integer formats to the FPU, it is necessary to make small changes to `fpnew_pkg`.
351-
New formats can easily be added by extending the default list of available formats, and/or by changing or removing the defaults.
358+
New formats can easily be added by extending the default list of available formats, and/or by changing or removing the defaults.
352359

353360
Namely, the following parameters and types shall be adapted:
354361
```

ips_list.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Copyright 2019 ETH Zurich and University of Bologna.
2+
# Solderpad Hardware License, Version 0.51, see LICENSE for details.
3+
# SPDX-License-Identifier: SHL-0.51
14
#
25
# List of IPs and relative branch/commit-hash/tag.
36
# Uses the YAML syntax.

src/fpnew_cast_multi.sv

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// this License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
99
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
1010
// specific language governing permissions and limitations under the License.
11+
//
12+
// SPDX-License-Identifier: SHL-0.51
1113

1214
// Author: Stefan Mach <smach@iis.ee.ethz.ch>
1315

@@ -38,6 +40,7 @@ module fpnew_cast_multi #(
3840
input fpnew_pkg::fp_format_e dst_fmt_i,
3941
input fpnew_pkg::int_format_e int_fmt_i,
4042
input TagType tag_i,
43+
input logic mask_i,
4144
input AuxType aux_i,
4245
// Input Handshake
4346
input logic in_valid_i,
@@ -48,6 +51,7 @@ module fpnew_cast_multi #(
4851
output fpnew_pkg::status_t status_o,
4952
output logic extension_bit_o,
5053
output TagType tag_o,
54+
output logic mask_o,
5155
output AuxType aux_o,
5256
// Output handshake
5357
output logic out_valid_o,
@@ -114,6 +118,7 @@ module fpnew_cast_multi #(
114118
fpnew_pkg::fp_format_e [0:NUM_INP_REGS] inp_pipe_dst_fmt_q;
115119
fpnew_pkg::int_format_e [0:NUM_INP_REGS] inp_pipe_int_fmt_q;
116120
TagType [0:NUM_INP_REGS] inp_pipe_tag_q;
121+
logic [0:NUM_INP_REGS] inp_pipe_mask_q;
117122
AuxType [0:NUM_INP_REGS] inp_pipe_aux_q;
118123
logic [0:NUM_INP_REGS] inp_pipe_valid_q;
119124
// Ready signal is combinatorial for all stages
@@ -129,6 +134,7 @@ module fpnew_cast_multi #(
129134
assign inp_pipe_dst_fmt_q[0] = dst_fmt_i;
130135
assign inp_pipe_int_fmt_q[0] = int_fmt_i;
131136
assign inp_pipe_tag_q[0] = tag_i;
137+
assign inp_pipe_mask_q[0] = mask_i;
132138
assign inp_pipe_aux_q[0] = aux_i;
133139
assign inp_pipe_valid_q[0] = in_valid_i;
134140
// Input stage: Propagate pipeline ready signal to updtream circuitry
@@ -155,6 +161,7 @@ module fpnew_cast_multi #(
155161
`FFL(inp_pipe_dst_fmt_q[i+1], inp_pipe_dst_fmt_q[i], reg_ena, fpnew_pkg::fp_format_e'(0))
156162
`FFL(inp_pipe_int_fmt_q[i+1], inp_pipe_int_fmt_q[i], reg_ena, fpnew_pkg::int_format_e'(0))
157163
`FFL(inp_pipe_tag_q[i+1], inp_pipe_tag_q[i], reg_ena, TagType'('0))
164+
`FFL(inp_pipe_mask_q[i+1], inp_pipe_mask_q[i], reg_ena, '0)
158165
`FFL(inp_pipe_aux_q[i+1], inp_pipe_aux_q[i], reg_ena, AuxType'('0))
159166
end
160167
// Output stage: assign selected pipe outputs to signals for later use
@@ -328,6 +335,7 @@ module fpnew_cast_multi #(
328335
fpnew_pkg::fp_format_e [0:NUM_MID_REGS] mid_pipe_dst_fmt_q;
329336
fpnew_pkg::int_format_e [0:NUM_MID_REGS] mid_pipe_int_fmt_q;
330337
TagType [0:NUM_MID_REGS] mid_pipe_tag_q;
338+
logic [0:NUM_MID_REGS] mid_pipe_mask_q;
331339
AuxType [0:NUM_MID_REGS] mid_pipe_aux_q;
332340
logic [0:NUM_MID_REGS] mid_pipe_valid_q;
333341
// Ready signal is combinatorial for all stages
@@ -348,6 +356,7 @@ module fpnew_cast_multi #(
348356
assign mid_pipe_dst_fmt_q[0] = dst_fmt_q;
349357
assign mid_pipe_int_fmt_q[0] = int_fmt_q;
350358
assign mid_pipe_tag_q[0] = inp_pipe_tag_q[NUM_INP_REGS];
359+
assign mid_pipe_mask_q[0] = inp_pipe_mask_q[NUM_INP_REGS];
351360
assign mid_pipe_aux_q[0] = inp_pipe_aux_q[NUM_INP_REGS];
352361
assign mid_pipe_valid_q[0] = inp_pipe_valid_q[NUM_INP_REGS];
353362
// Input stage: Propagate pipeline ready signal to input pipe
@@ -380,6 +389,7 @@ module fpnew_cast_multi #(
380389
`FFL(mid_pipe_dst_fmt_q[i+1], mid_pipe_dst_fmt_q[i], reg_ena, fpnew_pkg::fp_format_e'(0))
381390
`FFL(mid_pipe_int_fmt_q[i+1], mid_pipe_int_fmt_q[i], reg_ena, fpnew_pkg::int_format_e'(0))
382391
`FFL(mid_pipe_tag_q[i+1], mid_pipe_tag_q[i], reg_ena, TagType'('0))
392+
`FFL(mid_pipe_mask_q[i+1], mid_pipe_mask_q[i], reg_ena, '0)
383393
`FFL(mid_pipe_aux_q[i+1], mid_pipe_aux_q[i], reg_ena, AuxType'('0))
384394
end
385395
// Output stage: assign selected pipe outputs to signals for later use
@@ -489,6 +499,7 @@ module fpnew_cast_multi #(
489499
logic [NUM_FORMATS-1:0] fmt_uf_after_round;
490500

491501
logic [NUM_INT_FORMATS-1:0][WIDTH-1:0] ifmt_pre_round_abs; // per format
502+
logic [NUM_INT_FORMATS-1:0] ifmt_of_after_round;
492503

493504
logic rounded_sign;
494505
logic [WIDTH-1:0] rounded_abs; // absolute value of result after rounding
@@ -573,14 +584,33 @@ module fpnew_cast_multi #(
573584
end
574585
end
575586

576-
// Classification after rounding select by destination format
577-
assign uf_after_round = fmt_uf_after_round[dst_fmt_q2];
578-
assign of_after_round = fmt_of_after_round[dst_fmt_q2];
579-
580587
// Negative integer result needs to be brought into two's complement
581588
assign rounded_int_res = rounded_sign ? unsigned'(-rounded_abs) : rounded_abs;
582589
assign rounded_int_res_zero = (rounded_int_res == '0);
583590

591+
// Detect integer overflows after rounding (only positives)
592+
for (genvar ifmt = 0; ifmt < int'(NUM_INT_FORMATS); ifmt++) begin : gen_int_overflow
593+
// Set up some constants
594+
localparam int unsigned INT_WIDTH = fpnew_pkg::int_width(fpnew_pkg::int_format_e'(ifmt));
595+
596+
if (IntFmtConfig[ifmt]) begin : active_format
597+
always_comb begin : detect_overflow
598+
ifmt_of_after_round[ifmt] = 1'b0;
599+
// Int result can overflow if we're at the max exponent
600+
if (!rounded_sign && input_exp_q == signed'(INT_WIDTH - 2 + op_mod_q2)) begin
601+
// Check whether the rounded MSB differs from unrounded MSB
602+
ifmt_of_after_round[ifmt] = ~rounded_int_res[INT_WIDTH-2+op_mod_q2];
603+
end
604+
end
605+
end else begin : inactive_format
606+
assign ifmt_of_after_round[ifmt] = fpnew_pkg::DONT_CARE;
607+
end
608+
end
609+
610+
// Classification after rounding select by destination format
611+
assign uf_after_round = fmt_uf_after_round[dst_fmt_q2];
612+
assign of_after_round = dst_is_int_q ? ifmt_of_after_round[int_fmt_q2] : fmt_of_after_round[dst_fmt_q2];
613+
584614
// -------------------------
585615
// FP Special case handling
586616
// -------------------------
@@ -664,7 +694,7 @@ module fpnew_cast_multi #(
664694

665695
// Detect special case from source format (inf, nan, overflow, nan-boxing or negative unsigned)
666696
assign int_result_is_special = info_q.is_nan | info_q.is_inf |
667-
of_before_round | ~info_q.is_boxed |
697+
of_before_round | of_after_round | ~info_q.is_boxed |
668698
(input_sign_q & op_mod_q2 & ~rounded_int_res_zero);
669699

670700
// All integer special cases are invalid
@@ -714,6 +744,7 @@ module fpnew_cast_multi #(
714744
fpnew_pkg::status_t [0:NUM_OUT_REGS] out_pipe_status_q;
715745
logic [0:NUM_OUT_REGS] out_pipe_ext_bit_q;
716746
TagType [0:NUM_OUT_REGS] out_pipe_tag_q;
747+
logic [0:NUM_OUT_REGS] out_pipe_mask_q;
717748
AuxType [0:NUM_OUT_REGS] out_pipe_aux_q;
718749
logic [0:NUM_OUT_REGS] out_pipe_valid_q;
719750
// Ready signal is combinatorial for all stages
@@ -724,6 +755,7 @@ module fpnew_cast_multi #(
724755
assign out_pipe_status_q[0] = status_d;
725756
assign out_pipe_ext_bit_q[0] = extension_bit;
726757
assign out_pipe_tag_q[0] = mid_pipe_tag_q[NUM_MID_REGS];
758+
assign out_pipe_mask_q[0] = mid_pipe_mask_q[NUM_MID_REGS];
727759
assign out_pipe_aux_q[0] = mid_pipe_aux_q[NUM_MID_REGS];
728760
assign out_pipe_valid_q[0] = mid_pipe_valid_q[NUM_MID_REGS];
729761
// Input stage: Propagate pipeline ready signal to inside pipe
@@ -745,6 +777,7 @@ module fpnew_cast_multi #(
745777
`FFL(out_pipe_status_q[i+1], out_pipe_status_q[i], reg_ena, '0)
746778
`FFL(out_pipe_ext_bit_q[i+1], out_pipe_ext_bit_q[i], reg_ena, '0)
747779
`FFL(out_pipe_tag_q[i+1], out_pipe_tag_q[i], reg_ena, TagType'('0))
780+
`FFL(out_pipe_mask_q[i+1], out_pipe_mask_q[i], reg_ena, '0)
748781
`FFL(out_pipe_aux_q[i+1], out_pipe_aux_q[i], reg_ena, AuxType'('0))
749782
end
750783
// Output stage: Ready travels backwards from output side, driven by downstream circuitry
@@ -754,6 +787,7 @@ module fpnew_cast_multi #(
754787
assign status_o = out_pipe_status_q[NUM_OUT_REGS];
755788
assign extension_bit_o = out_pipe_ext_bit_q[NUM_OUT_REGS];
756789
assign tag_o = out_pipe_tag_q[NUM_OUT_REGS];
790+
assign mask_o = out_pipe_mask_q[NUM_OUT_REGS];
757791
assign aux_o = out_pipe_aux_q[NUM_OUT_REGS];
758792
assign out_valid_o = out_pipe_valid_q[NUM_OUT_REGS];
759793
assign busy_o = (| {inp_pipe_valid_q, mid_pipe_valid_q, out_pipe_valid_q});

src/fpnew_classifier.sv

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// this License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
99
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
1010
// specific language governing permissions and limitations under the License.
11+
//
12+
// SPDX-License-Identifier: SHL-0.51
1113

1214
// Author: Stefan Mach <smach@iis.ee.ethz.ch>
1315

0 commit comments

Comments
 (0)