-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <[email protected]> Co-authored-by: Frank K. Gürkaynak <[email protected]> Co-authored-by: Akilesh Kannan <[email protected]> Co-authored-by: Noah Huetter <[email protected]> Co-authored-by: Stefan Mach <[email protected]> Co-authored-by: Mike Thompson <[email protected]> Co-authored-by: Flavien Solt <[email protected]> Co-authored-by: Matteo Perotti <[email protected]> Co-authored-by: Shafiullah <[email protected]>
- Loading branch information
1 parent
8dc4440
commit 3116391
Showing
20 changed files
with
316 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
# Copyright 2019 ETH Zurich and University of Bologna. | ||
# Solderpad Hardware License, Version 0.51, see LICENSE for details. | ||
# SPDX-License-Identifier: SHL-0.51 | ||
package: | ||
name: FPnew | ||
authors: ["Stefan Mach <[email protected]>"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
cff-version: 1.2.0 | ||
message: "If you use FPnew, please cite it as below." | ||
authors: | ||
- family-names: "Mach" | ||
given-names: "Stefan" | ||
orcid: "https://orcid.org/0000-0002-3476-8857" | ||
title: "FPnew: - New Floating-Point Unit with Transprecision Capabilities" | ||
version: 0.6.6 | ||
url: "https://github.com/pulp-platform/fpnew" | ||
preferred-citation: | ||
type: article | ||
authors: | ||
- family-names: "Mach" | ||
given-names: "Stefan" | ||
orcid: "https://orcid.org/0000-0002-3476-8857" | ||
- family-names: "Schuiki" | ||
given-names: "Fabian" | ||
orcid: "https://orcid.org/0000-0002-9923-5031" | ||
- family-names: "Zaruba" | ||
given-names: "Florian" | ||
orcid: "https://orcid.org/0000-0002-8194-6521" | ||
- family-names: "Benini" | ||
given-names: "Luca" | ||
orcid: "https://orcid.org/0000-0001-8068-3806" | ||
doi: "10.1109/TVLSI.2020.3044752" | ||
journal: "IEEE Transactions on Very Large Scale Integration (VLSI) Systems" | ||
month: 12 | ||
start: 774 | ||
end: 787 | ||
title: "FPnew: An Open-Source Multiformat Floating-Point Unit Architecture for Energy-Proportional Transprecision Computing" | ||
issue: 4 | ||
volume: 29 | ||
year: 2020 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,8 @@ | |
|
||
Parametric floating-point unit with support for standard RISC-V formats and operations as well as transprecision formats, written in SystemVerilog. | ||
|
||
Maintainer: Stefan Mach <[email protected]> | ||
Maintainer: Luca Bertaccini <[email protected]> | ||
Principal Author: Stefan Mach <[email protected]> | ||
|
||
## Features | ||
|
||
|
@@ -138,6 +139,32 @@ Furthermore, this repository tries to adhere to [SemVer](https://semver.org/), a | |
|
||
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. | ||
|
||
|
||
## Publication | ||
|
||
If you use FPnew in your work, you can cite us: | ||
|
||
<details> | ||
<summary>FPnew Publication</summary> | ||
<p> | ||
|
||
``` | ||
@article{mach2020fpnew, | ||
title={Fpnew: An open-source multiformat floating-point unit architecture for energy-proportional transprecision computing}, | ||
author={Mach, Stefan and Schuiki, Fabian and Zaruba, Florian and Benini, Luca}, | ||
journal={IEEE Transactions on Very Large Scale Integration (VLSI) Systems}, | ||
volume={29}, | ||
number={4}, | ||
pages={774--787}, | ||
year={2020}, | ||
publisher={IEEE} | ||
} | ||
``` | ||
|
||
</p> | ||
</details> | ||
|
||
|
||
## Acknowledgement | ||
|
||
This project has received funding from the European Union's Horizon 2020 research and innovation programme under grant agreement No 732631. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# Global owners | ||
* @stmach | ||
* @lucabertaccini |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,8 @@ | |
// this License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
// CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations under the License. | ||
// | ||
// SPDX-License-Identifier: SHL-0.51 | ||
|
||
// Author: Stefan Mach <[email protected]> | ||
|
||
|
@@ -38,6 +40,7 @@ module fpnew_cast_multi #( | |
input fpnew_pkg::fp_format_e dst_fmt_i, | ||
input fpnew_pkg::int_format_e int_fmt_i, | ||
input TagType tag_i, | ||
input logic mask_i, | ||
input AuxType aux_i, | ||
// Input Handshake | ||
input logic in_valid_i, | ||
|
@@ -48,6 +51,7 @@ module fpnew_cast_multi #( | |
output fpnew_pkg::status_t status_o, | ||
output logic extension_bit_o, | ||
output TagType tag_o, | ||
output logic mask_o, | ||
output AuxType aux_o, | ||
// Output handshake | ||
output logic out_valid_o, | ||
|
@@ -114,6 +118,7 @@ module fpnew_cast_multi #( | |
fpnew_pkg::fp_format_e [0:NUM_INP_REGS] inp_pipe_dst_fmt_q; | ||
fpnew_pkg::int_format_e [0:NUM_INP_REGS] inp_pipe_int_fmt_q; | ||
TagType [0:NUM_INP_REGS] inp_pipe_tag_q; | ||
logic [0:NUM_INP_REGS] inp_pipe_mask_q; | ||
AuxType [0:NUM_INP_REGS] inp_pipe_aux_q; | ||
logic [0:NUM_INP_REGS] inp_pipe_valid_q; | ||
// Ready signal is combinatorial for all stages | ||
|
@@ -129,6 +134,7 @@ module fpnew_cast_multi #( | |
assign inp_pipe_dst_fmt_q[0] = dst_fmt_i; | ||
assign inp_pipe_int_fmt_q[0] = int_fmt_i; | ||
assign inp_pipe_tag_q[0] = tag_i; | ||
assign inp_pipe_mask_q[0] = mask_i; | ||
assign inp_pipe_aux_q[0] = aux_i; | ||
assign inp_pipe_valid_q[0] = in_valid_i; | ||
// Input stage: Propagate pipeline ready signal to updtream circuitry | ||
|
@@ -155,6 +161,7 @@ module fpnew_cast_multi #( | |
`FFL(inp_pipe_dst_fmt_q[i+1], inp_pipe_dst_fmt_q[i], reg_ena, fpnew_pkg::fp_format_e'(0)) | ||
`FFL(inp_pipe_int_fmt_q[i+1], inp_pipe_int_fmt_q[i], reg_ena, fpnew_pkg::int_format_e'(0)) | ||
`FFL(inp_pipe_tag_q[i+1], inp_pipe_tag_q[i], reg_ena, TagType'('0)) | ||
`FFL(inp_pipe_mask_q[i+1], inp_pipe_mask_q[i], reg_ena, '0) | ||
`FFL(inp_pipe_aux_q[i+1], inp_pipe_aux_q[i], reg_ena, AuxType'('0)) | ||
end | ||
// Output stage: assign selected pipe outputs to signals for later use | ||
|
@@ -328,6 +335,7 @@ module fpnew_cast_multi #( | |
fpnew_pkg::fp_format_e [0:NUM_MID_REGS] mid_pipe_dst_fmt_q; | ||
fpnew_pkg::int_format_e [0:NUM_MID_REGS] mid_pipe_int_fmt_q; | ||
TagType [0:NUM_MID_REGS] mid_pipe_tag_q; | ||
logic [0:NUM_MID_REGS] mid_pipe_mask_q; | ||
AuxType [0:NUM_MID_REGS] mid_pipe_aux_q; | ||
logic [0:NUM_MID_REGS] mid_pipe_valid_q; | ||
// Ready signal is combinatorial for all stages | ||
|
@@ -348,6 +356,7 @@ module fpnew_cast_multi #( | |
assign mid_pipe_dst_fmt_q[0] = dst_fmt_q; | ||
assign mid_pipe_int_fmt_q[0] = int_fmt_q; | ||
assign mid_pipe_tag_q[0] = inp_pipe_tag_q[NUM_INP_REGS]; | ||
assign mid_pipe_mask_q[0] = inp_pipe_mask_q[NUM_INP_REGS]; | ||
assign mid_pipe_aux_q[0] = inp_pipe_aux_q[NUM_INP_REGS]; | ||
assign mid_pipe_valid_q[0] = inp_pipe_valid_q[NUM_INP_REGS]; | ||
// Input stage: Propagate pipeline ready signal to input pipe | ||
|
@@ -380,6 +389,7 @@ module fpnew_cast_multi #( | |
`FFL(mid_pipe_dst_fmt_q[i+1], mid_pipe_dst_fmt_q[i], reg_ena, fpnew_pkg::fp_format_e'(0)) | ||
`FFL(mid_pipe_int_fmt_q[i+1], mid_pipe_int_fmt_q[i], reg_ena, fpnew_pkg::int_format_e'(0)) | ||
`FFL(mid_pipe_tag_q[i+1], mid_pipe_tag_q[i], reg_ena, TagType'('0)) | ||
`FFL(mid_pipe_mask_q[i+1], mid_pipe_mask_q[i], reg_ena, '0) | ||
`FFL(mid_pipe_aux_q[i+1], mid_pipe_aux_q[i], reg_ena, AuxType'('0)) | ||
end | ||
// Output stage: assign selected pipe outputs to signals for later use | ||
|
@@ -489,6 +499,7 @@ module fpnew_cast_multi #( | |
logic [NUM_FORMATS-1:0] fmt_uf_after_round; | ||
|
||
logic [NUM_INT_FORMATS-1:0][WIDTH-1:0] ifmt_pre_round_abs; // per format | ||
logic [NUM_INT_FORMATS-1:0] ifmt_of_after_round; | ||
|
||
logic rounded_sign; | ||
logic [WIDTH-1:0] rounded_abs; // absolute value of result after rounding | ||
|
@@ -573,14 +584,33 @@ module fpnew_cast_multi #( | |
end | ||
end | ||
|
||
// Classification after rounding select by destination format | ||
assign uf_after_round = fmt_uf_after_round[dst_fmt_q2]; | ||
assign of_after_round = fmt_of_after_round[dst_fmt_q2]; | ||
|
||
// Negative integer result needs to be brought into two's complement | ||
assign rounded_int_res = rounded_sign ? unsigned'(-rounded_abs) : rounded_abs; | ||
assign rounded_int_res_zero = (rounded_int_res == '0); | ||
|
||
// Detect integer overflows after rounding (only positives) | ||
for (genvar ifmt = 0; ifmt < int'(NUM_INT_FORMATS); ifmt++) begin : gen_int_overflow | ||
// Set up some constants | ||
localparam int unsigned INT_WIDTH = fpnew_pkg::int_width(fpnew_pkg::int_format_e'(ifmt)); | ||
|
||
if (IntFmtConfig[ifmt]) begin : active_format | ||
always_comb begin : detect_overflow | ||
ifmt_of_after_round[ifmt] = 1'b0; | ||
// Int result can overflow if we're at the max exponent | ||
if (!rounded_sign && input_exp_q == signed'(INT_WIDTH - 2 + op_mod_q2)) begin | ||
// Check whether the rounded MSB differs from unrounded MSB | ||
ifmt_of_after_round[ifmt] = ~rounded_int_res[INT_WIDTH-2+op_mod_q2]; | ||
end | ||
end | ||
end else begin : inactive_format | ||
assign ifmt_of_after_round[ifmt] = fpnew_pkg::DONT_CARE; | ||
end | ||
end | ||
|
||
// Classification after rounding select by destination format | ||
assign uf_after_round = fmt_uf_after_round[dst_fmt_q2]; | ||
assign of_after_round = dst_is_int_q ? ifmt_of_after_round[int_fmt_q2] : fmt_of_after_round[dst_fmt_q2]; | ||
|
||
// ------------------------- | ||
// FP Special case handling | ||
// ------------------------- | ||
|
@@ -664,7 +694,7 @@ module fpnew_cast_multi #( | |
|
||
// Detect special case from source format (inf, nan, overflow, nan-boxing or negative unsigned) | ||
assign int_result_is_special = info_q.is_nan | info_q.is_inf | | ||
of_before_round | ~info_q.is_boxed | | ||
of_before_round | of_after_round | ~info_q.is_boxed | | ||
(input_sign_q & op_mod_q2 & ~rounded_int_res_zero); | ||
|
||
// All integer special cases are invalid | ||
|
@@ -714,6 +744,7 @@ module fpnew_cast_multi #( | |
fpnew_pkg::status_t [0:NUM_OUT_REGS] out_pipe_status_q; | ||
logic [0:NUM_OUT_REGS] out_pipe_ext_bit_q; | ||
TagType [0:NUM_OUT_REGS] out_pipe_tag_q; | ||
logic [0:NUM_OUT_REGS] out_pipe_mask_q; | ||
AuxType [0:NUM_OUT_REGS] out_pipe_aux_q; | ||
logic [0:NUM_OUT_REGS] out_pipe_valid_q; | ||
// Ready signal is combinatorial for all stages | ||
|
@@ -724,6 +755,7 @@ module fpnew_cast_multi #( | |
assign out_pipe_status_q[0] = status_d; | ||
assign out_pipe_ext_bit_q[0] = extension_bit; | ||
assign out_pipe_tag_q[0] = mid_pipe_tag_q[NUM_MID_REGS]; | ||
assign out_pipe_mask_q[0] = mid_pipe_mask_q[NUM_MID_REGS]; | ||
assign out_pipe_aux_q[0] = mid_pipe_aux_q[NUM_MID_REGS]; | ||
assign out_pipe_valid_q[0] = mid_pipe_valid_q[NUM_MID_REGS]; | ||
// Input stage: Propagate pipeline ready signal to inside pipe | ||
|
@@ -745,6 +777,7 @@ module fpnew_cast_multi #( | |
`FFL(out_pipe_status_q[i+1], out_pipe_status_q[i], reg_ena, '0) | ||
`FFL(out_pipe_ext_bit_q[i+1], out_pipe_ext_bit_q[i], reg_ena, '0) | ||
`FFL(out_pipe_tag_q[i+1], out_pipe_tag_q[i], reg_ena, TagType'('0)) | ||
`FFL(out_pipe_mask_q[i+1], out_pipe_mask_q[i], reg_ena, '0) | ||
`FFL(out_pipe_aux_q[i+1], out_pipe_aux_q[i], reg_ena, AuxType'('0)) | ||
end | ||
// Output stage: Ready travels backwards from output side, driven by downstream circuitry | ||
|
@@ -754,6 +787,7 @@ module fpnew_cast_multi #( | |
assign status_o = out_pipe_status_q[NUM_OUT_REGS]; | ||
assign extension_bit_o = out_pipe_ext_bit_q[NUM_OUT_REGS]; | ||
assign tag_o = out_pipe_tag_q[NUM_OUT_REGS]; | ||
assign mask_o = out_pipe_mask_q[NUM_OUT_REGS]; | ||
assign aux_o = out_pipe_aux_q[NUM_OUT_REGS]; | ||
assign out_valid_o = out_pipe_valid_q[NUM_OUT_REGS]; | ||
assign busy_o = (| {inp_pipe_valid_q, mid_pipe_valid_q, out_pipe_valid_q}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,8 @@ | |
// this License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
// CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations under the License. | ||
// | ||
// SPDX-License-Identifier: SHL-0.51 | ||
|
||
// Author: Stefan Mach <[email protected]> | ||
|
||
|
Oops, something went wrong.