From 9f40ad57cb212e925dbc7cb2ff575cd22a93995f Mon Sep 17 00:00:00 2001 From: Florian Zaruba Date: Sun, 12 May 2024 20:15:50 +0200 Subject: [PATCH] Make `D` independent on `xlen` (#2005) A 64-bit core might very well support just single-precision. --- core/fpu_wrap.sv | 2 +- core/include/build_config_pkg.sv | 2 +- core/include/config_pkg.sv | 2 ++ core/include/cv32a60x_config_pkg.sv | 1 + core/include/cv32a65x_config_pkg.sv | 1 + core/include/cv32a6_embedded_config_pkg.sv | 1 + core/include/cv32a6_ima_sv32_fpga_config_pkg.sv | 1 + core/include/cv32a6_imac_sv0_config_pkg.sv | 1 + core/include/cv32a6_imac_sv32_config_pkg.sv | 1 + core/include/cv32a6_imafc_sv32_config_pkg.sv | 1 + core/include/cv64a6_imadfcv_sv39_polara_config_pkg.sv | 1 + core/include/cv64a6_imafdc_sv39_config_pkg.sv | 1 + core/include/cv64a6_imafdc_sv39_hpdcache_config_pkg.sv | 1 + core/include/cv64a6_imafdc_sv39_openpiton_config_pkg.sv | 1 + core/include/cv64a6_imafdc_sv39_wb_config_pkg.sv | 1 + core/include/cv64a6_imafdch_sv39_config_pkg.sv | 1 + core/include/cv64a6_imafdch_sv39_wb_config_pkg.sv | 1 + core/include/cv64a6_imafdcv_sv39_config_pkg.sv | 1 + 18 files changed, 19 insertions(+), 2 deletions(-) diff --git a/core/fpu_wrap.sv b/core/fpu_wrap.sv index edcd3eccf..c30033463 100644 --- a/core/fpu_wrap.sv +++ b/core/fpu_wrap.sv @@ -61,7 +61,7 @@ module fpu_wrap // Features (enabled formats, vectors etc.) localparam fpnew_pkg::fpu_features_t FPU_FEATURES = '{ - Width: unsigned'(CVA6Cfg.XLEN), // parameterized using CVA6Cfg.XLEN + Width: unsigned'(CVA6Cfg.FLen), // parameterized using CVA6Cfg.FLen EnableVectors: CVA6Cfg.XFVec, EnableNanBox: 1'b1, FpFmtMask: {CVA6Cfg.RVF, CVA6Cfg.RVD, CVA6Cfg.XF16, CVA6Cfg.XF8, CVA6Cfg.XF16ALT}, diff --git a/core/include/build_config_pkg.sv b/core/include/build_config_pkg.sv index c86c89cf2..61cb82b14 100644 --- a/core/include/build_config_pkg.sv +++ b/core/include/build_config_pkg.sv @@ -4,7 +4,7 @@ package build_config_pkg; bit IS_XLEN32 = (CVA6Cfg.XLEN == 32) ? 1'b1 : 1'b0; bit IS_XLEN64 = (CVA6Cfg.XLEN == 32) ? 1'b0 : 1'b1; bit RVF = (IS_XLEN64 | IS_XLEN32) & CVA6Cfg.FpuEn; - bit RVD = (IS_XLEN64 ? 1 : 0) & CVA6Cfg.FpuEn; + bit RVD = (IS_XLEN64 ? 1 : 0) & CVA6Cfg.FpuEn & CVA6Cfg.RVD; bit FpPresent = RVF | RVD | CVA6Cfg.XF16 | CVA6Cfg.XF16ALT | CVA6Cfg.XF8; bit NSX = CVA6Cfg.XF16 | CVA6Cfg.XF16ALT | CVA6Cfg.XF8 | CVA6Cfg.XFVec; // Are non-standard extensions present? int unsigned FLen = RVD ? 64 : // D ext. diff --git a/core/include/config_pkg.sv b/core/include/config_pkg.sv index 83685b3bc..48b0b34d6 100644 --- a/core/include/config_pkg.sv +++ b/core/include/config_pkg.sv @@ -66,6 +66,8 @@ package config_pkg; bit RVZiCond; // Floating Point bit FpuEn; + // Floating Point + bit RVD; // Non standard 16bits Floating Point extension bit XF16; // Non standard 16bits Floating Point Alt extension diff --git a/core/include/cv32a60x_config_pkg.sv b/core/include/cv32a60x_config_pkg.sv index a81dcd986..cea703314 100644 --- a/core/include/cv32a60x_config_pkg.sv +++ b/core/include/cv32a60x_config_pkg.sv @@ -88,6 +88,7 @@ package cva6_config_pkg; MemTidWidth: unsigned'(CVA6ConfigMemTidWidth), NrLoadBufEntries: unsigned'(CVA6ConfigNrLoadBufEntries), FpuEn: bit'(CVA6ConfigFpuEn), + RVD: bit'(CVA6ConfigFpuEn), XF16: bit'(CVA6ConfigF16En), XF16ALT: bit'(CVA6ConfigF16AltEn), XF8: bit'(CVA6ConfigF8En), diff --git a/core/include/cv32a65x_config_pkg.sv b/core/include/cv32a65x_config_pkg.sv index 9a5c4d461..30ab14a74 100644 --- a/core/include/cv32a65x_config_pkg.sv +++ b/core/include/cv32a65x_config_pkg.sv @@ -45,6 +45,7 @@ package cva6_config_pkg; MemTidWidth: unsigned'(2), NrLoadBufEntries: unsigned'(CVA6ConfigNrLoadBufEntries), FpuEn: bit'(0), + RVD: bit'(0), XF16: bit'(0), XF16ALT: bit'(0), XF8: bit'(0), diff --git a/core/include/cv32a6_embedded_config_pkg.sv b/core/include/cv32a6_embedded_config_pkg.sv index 78db77d29..f5c958d29 100644 --- a/core/include/cv32a6_embedded_config_pkg.sv +++ b/core/include/cv32a6_embedded_config_pkg.sv @@ -87,6 +87,7 @@ package cva6_config_pkg; MemTidWidth: unsigned'(CVA6ConfigMemTidWidth), NrLoadBufEntries: unsigned'(CVA6ConfigNrLoadBufEntries), FpuEn: bit'(CVA6ConfigFpuEn), + RVD: bit'(CVA6ConfigFpuEn), XF16: bit'(CVA6ConfigF16En), XF16ALT: bit'(CVA6ConfigF16AltEn), XF8: bit'(CVA6ConfigF8En), diff --git a/core/include/cv32a6_ima_sv32_fpga_config_pkg.sv b/core/include/cv32a6_ima_sv32_fpga_config_pkg.sv index cdaa26a36..944e16d2d 100644 --- a/core/include/cv32a6_ima_sv32_fpga_config_pkg.sv +++ b/core/include/cv32a6_ima_sv32_fpga_config_pkg.sv @@ -88,6 +88,7 @@ package cva6_config_pkg; MemTidWidth: unsigned'(CVA6ConfigMemTidWidth), NrLoadBufEntries: unsigned'(CVA6ConfigNrLoadBufEntries), FpuEn: bit'(CVA6ConfigFpuEn), + RVD: bit'(CVA6ConfigFpuEn), XF16: bit'(CVA6ConfigF16En), XF16ALT: bit'(CVA6ConfigF16AltEn), XF8: bit'(CVA6ConfigF8En), diff --git a/core/include/cv32a6_imac_sv0_config_pkg.sv b/core/include/cv32a6_imac_sv0_config_pkg.sv index 9d4f3d3b7..9d7c45ab7 100644 --- a/core/include/cv32a6_imac_sv0_config_pkg.sv +++ b/core/include/cv32a6_imac_sv0_config_pkg.sv @@ -88,6 +88,7 @@ package cva6_config_pkg; MemTidWidth: unsigned'(CVA6ConfigMemTidWidth), NrLoadBufEntries: unsigned'(CVA6ConfigNrLoadBufEntries), FpuEn: bit'(CVA6ConfigFpuEn), + RVD: bit'(CVA6ConfigFpuEn), XF16: bit'(CVA6ConfigF16En), XF16ALT: bit'(CVA6ConfigF16AltEn), XF8: bit'(CVA6ConfigF8En), diff --git a/core/include/cv32a6_imac_sv32_config_pkg.sv b/core/include/cv32a6_imac_sv32_config_pkg.sv index a2774e5f9..abbff5ab2 100644 --- a/core/include/cv32a6_imac_sv32_config_pkg.sv +++ b/core/include/cv32a6_imac_sv32_config_pkg.sv @@ -88,6 +88,7 @@ package cva6_config_pkg; MemTidWidth: unsigned'(CVA6ConfigMemTidWidth), NrLoadBufEntries: unsigned'(CVA6ConfigNrLoadBufEntries), FpuEn: bit'(CVA6ConfigFpuEn), + RVD: bit'(CVA6ConfigFpuEn), XF16: bit'(CVA6ConfigF16En), XF16ALT: bit'(CVA6ConfigF16AltEn), XF8: bit'(CVA6ConfigF8En), diff --git a/core/include/cv32a6_imafc_sv32_config_pkg.sv b/core/include/cv32a6_imafc_sv32_config_pkg.sv index 2a54267b1..dd38dd112 100644 --- a/core/include/cv32a6_imafc_sv32_config_pkg.sv +++ b/core/include/cv32a6_imafc_sv32_config_pkg.sv @@ -88,6 +88,7 @@ package cva6_config_pkg; MemTidWidth: unsigned'(CVA6ConfigMemTidWidth), NrLoadBufEntries: unsigned'(CVA6ConfigNrLoadBufEntries), FpuEn: bit'(CVA6ConfigFpuEn), + RVD: bit'(CVA6ConfigFpuEn), XF16: bit'(CVA6ConfigF16En), XF16ALT: bit'(CVA6ConfigF16AltEn), XF8: bit'(CVA6ConfigF8En), diff --git a/core/include/cv64a6_imadfcv_sv39_polara_config_pkg.sv b/core/include/cv64a6_imadfcv_sv39_polara_config_pkg.sv index ef4ff6220..1cd678ca7 100644 --- a/core/include/cv64a6_imadfcv_sv39_polara_config_pkg.sv +++ b/core/include/cv64a6_imadfcv_sv39_polara_config_pkg.sv @@ -88,6 +88,7 @@ package cva6_config_pkg; MemTidWidth: unsigned'(CVA6ConfigMemTidWidth), NrLoadBufEntries: unsigned'(CVA6ConfigNrLoadBufEntries), FpuEn: bit'(CVA6ConfigFpuEn), + RVD: bit'(CVA6ConfigFpuEn), XF16: bit'(CVA6ConfigF16En), XF16ALT: bit'(CVA6ConfigF16AltEn), XF8: bit'(CVA6ConfigF8En), diff --git a/core/include/cv64a6_imafdc_sv39_config_pkg.sv b/core/include/cv64a6_imafdc_sv39_config_pkg.sv index a9c29be88..ff47f29fa 100644 --- a/core/include/cv64a6_imafdc_sv39_config_pkg.sv +++ b/core/include/cv64a6_imafdc_sv39_config_pkg.sv @@ -88,6 +88,7 @@ package cva6_config_pkg; MemTidWidth: unsigned'(CVA6ConfigMemTidWidth), NrLoadBufEntries: unsigned'(CVA6ConfigNrLoadBufEntries), FpuEn: bit'(CVA6ConfigFpuEn), + RVD: bit'(CVA6ConfigFpuEn), XF16: bit'(CVA6ConfigF16En), XF16ALT: bit'(CVA6ConfigF16AltEn), XF8: bit'(CVA6ConfigF8En), diff --git a/core/include/cv64a6_imafdc_sv39_hpdcache_config_pkg.sv b/core/include/cv64a6_imafdc_sv39_hpdcache_config_pkg.sv index 9e33e8995..4b30636ec 100644 --- a/core/include/cv64a6_imafdc_sv39_hpdcache_config_pkg.sv +++ b/core/include/cv64a6_imafdc_sv39_hpdcache_config_pkg.sv @@ -95,6 +95,7 @@ package cva6_config_pkg; MemTidWidth: unsigned'(CVA6ConfigMemTidWidth), NrLoadBufEntries: unsigned'(CVA6ConfigNrLoadBufEntries), FpuEn: bit'(CVA6ConfigFpuEn), + RVD: bit'(CVA6ConfigFpuEn), XF16: bit'(CVA6ConfigF16En), XF16ALT: bit'(CVA6ConfigF16AltEn), XF8: bit'(CVA6ConfigF8En), diff --git a/core/include/cv64a6_imafdc_sv39_openpiton_config_pkg.sv b/core/include/cv64a6_imafdc_sv39_openpiton_config_pkg.sv index 513cb3d2f..cf780d2f1 100644 --- a/core/include/cv64a6_imafdc_sv39_openpiton_config_pkg.sv +++ b/core/include/cv64a6_imafdc_sv39_openpiton_config_pkg.sv @@ -88,6 +88,7 @@ package cva6_config_pkg; MemTidWidth: unsigned'(CVA6ConfigMemTidWidth), NrLoadBufEntries: unsigned'(CVA6ConfigNrLoadBufEntries), FpuEn: bit'(CVA6ConfigFpuEn), + RVD: bit'(CVA6ConfigFpuEn), XF16: bit'(CVA6ConfigF16En), XF16ALT: bit'(CVA6ConfigF16AltEn), XF8: bit'(CVA6ConfigF8En), diff --git a/core/include/cv64a6_imafdc_sv39_wb_config_pkg.sv b/core/include/cv64a6_imafdc_sv39_wb_config_pkg.sv index 15464173a..322de51bd 100644 --- a/core/include/cv64a6_imafdc_sv39_wb_config_pkg.sv +++ b/core/include/cv64a6_imafdc_sv39_wb_config_pkg.sv @@ -88,6 +88,7 @@ package cva6_config_pkg; MemTidWidth: unsigned'(CVA6ConfigMemTidWidth), NrLoadBufEntries: unsigned'(CVA6ConfigNrLoadBufEntries), FpuEn: bit'(CVA6ConfigFpuEn), + RVD: bit'(CVA6ConfigFpuEn), XF16: bit'(CVA6ConfigF16En), XF16ALT: bit'(CVA6ConfigF16AltEn), XF8: bit'(CVA6ConfigF8En), diff --git a/core/include/cv64a6_imafdch_sv39_config_pkg.sv b/core/include/cv64a6_imafdch_sv39_config_pkg.sv index d0234321f..7054ea463 100644 --- a/core/include/cv64a6_imafdch_sv39_config_pkg.sv +++ b/core/include/cv64a6_imafdch_sv39_config_pkg.sv @@ -88,6 +88,7 @@ package cva6_config_pkg; MemTidWidth: unsigned'(CVA6ConfigMemTidWidth), NrLoadBufEntries: unsigned'(CVA6ConfigNrLoadBufEntries), FpuEn: bit'(CVA6ConfigFpuEn), + RVD: bit'(CVA6ConfigFpuEn), XF16: bit'(CVA6ConfigF16En), XF16ALT: bit'(CVA6ConfigF16AltEn), XF8: bit'(CVA6ConfigF8En), diff --git a/core/include/cv64a6_imafdch_sv39_wb_config_pkg.sv b/core/include/cv64a6_imafdch_sv39_wb_config_pkg.sv index 09f6dd430..24418b4e2 100644 --- a/core/include/cv64a6_imafdch_sv39_wb_config_pkg.sv +++ b/core/include/cv64a6_imafdch_sv39_wb_config_pkg.sv @@ -88,6 +88,7 @@ package cva6_config_pkg; MemTidWidth: unsigned'(CVA6ConfigMemTidWidth), NrLoadBufEntries: unsigned'(CVA6ConfigNrLoadBufEntries), FpuEn: bit'(CVA6ConfigFpuEn), + RVD: bit'(CVA6ConfigFpuEn), XF16: bit'(CVA6ConfigF16En), XF16ALT: bit'(CVA6ConfigF16AltEn), XF8: bit'(CVA6ConfigF8En), diff --git a/core/include/cv64a6_imafdcv_sv39_config_pkg.sv b/core/include/cv64a6_imafdcv_sv39_config_pkg.sv index 194edb99b..ea58f11c3 100644 --- a/core/include/cv64a6_imafdcv_sv39_config_pkg.sv +++ b/core/include/cv64a6_imafdcv_sv39_config_pkg.sv @@ -88,6 +88,7 @@ package cva6_config_pkg; MemTidWidth: unsigned'(CVA6ConfigMemTidWidth), NrLoadBufEntries: unsigned'(CVA6ConfigNrLoadBufEntries), FpuEn: bit'(CVA6ConfigFpuEn), + RVD: bit'(CVA6ConfigFpuEn), XF16: bit'(CVA6ConfigF16En), XF16ALT: bit'(CVA6ConfigF16AltEn), XF8: bit'(CVA6ConfigF8En),