From b8522c49870def657dc013433000c0e5d803eb7b Mon Sep 17 00:00:00 2001 From: Kevin Kim Date: Thu, 24 Aug 2023 09:00:17 -0700 Subject: [PATCH 01/20] update wrappers --- src/wrappers/drsuwrapper.sv | 7 ++++--- src/wrappers/fdivsqrt.sv | 0 src/wrappers/wallypipelinedcorewrapper.sv | 10 +++++----- 3 files changed, 9 insertions(+), 8 deletions(-) delete mode 100644 src/wrappers/fdivsqrt.sv diff --git a/src/wrappers/drsuwrapper.sv b/src/wrappers/drsuwrapper.sv index cb97a4aab..dae37e5bb 100644 --- a/src/wrappers/drsuwrapper.sv +++ b/src/wrappers/drsuwrapper.sv @@ -1,5 +1,5 @@ /////////////////////////////////////////// -// drsu.sv +// drsuwrapper.sv // // Written: kekim@hmc.edu // Modified:19 May 2023 @@ -29,7 +29,8 @@ import cvw::*; -module drsuwrapper( +`include "parameter-defs.vh" +module drsuwrapper ( input logic clk, input logic reset, input logic [1:0] FmtE, @@ -57,7 +58,7 @@ module drsuwrapper( ); //`include "parameter-defs.vh" -drsu #(P) d(.*); + drsu #(P) drsucore(.*); endmodule \ No newline at end of file diff --git a/src/wrappers/fdivsqrt.sv b/src/wrappers/fdivsqrt.sv deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/wrappers/wallypipelinedcorewrapper.sv b/src/wrappers/wallypipelinedcorewrapper.sv index bc5f63d1c..1d8f4f774 100644 --- a/src/wrappers/wallypipelinedcorewrapper.sv +++ b/src/wrappers/wallypipelinedcorewrapper.sv @@ -30,18 +30,19 @@ import cvw::*; +`include "parameter-defs.vh" module wallypipelinedcorewrapper ( input logic clk, reset, // Privileged input logic MTimerInt, MExtInt, SExtInt, MSwInt, input logic [63:0] MTIME_CLINT, // Bus Interface - input logic [AHBW-1:0] HRDATA, + input logic [32-1:0] HRDATA, input logic HREADY, HRESP, output logic HCLK, HRESETn, - output logic [PA_BITS-1:0] HADDR, - output logic [AHBW-1:0] HWDATA, - output logic [XLEN/8-1:0] HWSTRB, + output logic [34-1:0] HADDR, + output logic [32-1:0] HWDATA, + output logic [32/8-1:0] HWSTRB, output logic HWRITE, output logic [2:0] HSIZE, output logic [2:0] HBURST, @@ -49,7 +50,6 @@ module wallypipelinedcorewrapper ( output logic [1:0] HTRANS, output logic HMASTLOCK ); - `include "parameter-defs.vh" wallypipelinedcore #(P) core(.*); From 7cb3d87554556b4b7428d1324c09981d19cdb989 Mon Sep 17 00:00:00 2001 From: Kevin Kim Date: Thu, 24 Aug 2023 09:19:23 -0700 Subject: [PATCH 02/20] synth fix --- synthDC/scripts/synth.tcl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/synthDC/scripts/synth.tcl b/synthDC/scripts/synth.tcl index 7a8c2e7bf..8bb5140fa 100755 --- a/synthDC/scripts/synth.tcl +++ b/synthDC/scripts/synth.tcl @@ -24,8 +24,7 @@ set saifpower $::env(SAIFPOWER) set maxopt $::env(MAXOPT) set drive $::env(DRIVE) -eval file copy -force [glob ${cfg}/*.vh] {$outputDir/hdl/} -eval file copy -force [glob ${cfg}/*.vh] {$outputDir/hdl/} +eval file copy -force [glob ${cfg}/*.vh] {$outputDir/config/} eval file copy -force [glob ${hdl_src}/cvw.sv] {$outputDir/hdl/} eval file copy -force [glob ${hdl_src}/../fpga/src/wallypipelinedsocwrapper.sv] {$outputDir/hdl/} eval file copy -force [glob ${hdl_src}/*/*.sv] {$outputDir/hdl/} From bfba32dfd989972c06cf392c2f5972cb1281d49e Mon Sep 17 00:00:00 2001 From: Kevin Kim Date: Sat, 26 Aug 2023 20:20:20 -0700 Subject: [PATCH 03/20] synthesis works --- config/shared/parameter-defs.vh | 2 +- {src/wrappers => fpga/src}/drsuwrapper.sv | 0 src/wrappers/wallypipelinedcorewrapper.sv | 4 ++-- synthDC/scripts/synth.tcl | 9 ++++----- 4 files changed, 7 insertions(+), 8 deletions(-) rename {src/wrappers => fpga/src}/drsuwrapper.sv (100%) diff --git a/config/shared/parameter-defs.vh b/config/shared/parameter-defs.vh index 6e01aabb4..9ce59950e 100644 --- a/config/shared/parameter-defs.vh +++ b/config/shared/parameter-defs.vh @@ -3,7 +3,7 @@ `include "BranchPredictorType.vh" -parameter cvw_t P = '{ +localparam cvw_t P = '{ FPGA : FPGA, XLEN : XLEN, IEEE754 : IEEE754, diff --git a/src/wrappers/drsuwrapper.sv b/fpga/src/drsuwrapper.sv similarity index 100% rename from src/wrappers/drsuwrapper.sv rename to fpga/src/drsuwrapper.sv diff --git a/src/wrappers/wallypipelinedcorewrapper.sv b/src/wrappers/wallypipelinedcorewrapper.sv index 1d8f4f774..09309bf0e 100644 --- a/src/wrappers/wallypipelinedcorewrapper.sv +++ b/src/wrappers/wallypipelinedcorewrapper.sv @@ -37,10 +37,10 @@ module wallypipelinedcorewrapper ( input logic MTimerInt, MExtInt, SExtInt, MSwInt, input logic [63:0] MTIME_CLINT, // Bus Interface - input logic [32-1:0] HRDATA, + input logic [P.XLEN-1:0] HRDATA, input logic HREADY, HRESP, output logic HCLK, HRESETn, - output logic [34-1:0] HADDR, + output logic [P.PA_BITS-1:0] HADDR, output logic [32-1:0] HWDATA, output logic [32/8-1:0] HWSTRB, output logic HWRITE, diff --git a/synthDC/scripts/synth.tcl b/synthDC/scripts/synth.tcl index 8bb5140fa..a5b435c13 100755 --- a/synthDC/scripts/synth.tcl +++ b/synthDC/scripts/synth.tcl @@ -25,20 +25,19 @@ set maxopt $::env(MAXOPT) set drive $::env(DRIVE) eval file copy -force [glob ${cfg}/*.vh] {$outputDir/config/} +eval file copy -force [glob ${cfg}/*.vh] {$outputDir/hdl/} eval file copy -force [glob ${hdl_src}/cvw.sv] {$outputDir/hdl/} -eval file copy -force [glob ${hdl_src}/../fpga/src/wallypipelinedsocwrapper.sv] {$outputDir/hdl/} +#eval file copy -force [glob ${hdl_src}/../fpga/src/wallypipelinedsocwrapper.sv] {$outputDir/hdl/} eval file copy -force [glob ${hdl_src}/*/*.sv] {$outputDir/hdl/} eval file copy -force [glob ${hdl_src}/*/*/*.sv] {$outputDir/hdl/} -# Only for FMA class project; comment out when done -# eval file copy -force [glob ${hdl_src}/fma/fma16.v] {hdl/} - # Enables name mapping if { $saifpower == 1 } { saif_map -start } # Verilog files +#set my_verilog_files [glob $outputDir/hdl/cvw.sv $outputDir/hdl/*.sv $outputDir/config/*.vh] set my_verilog_files [glob $outputDir/hdl/cvw.sv $outputDir/hdl/*.sv] # Set toplevel @@ -75,7 +74,7 @@ if { [shell_is_in_topographical_mode] } { #set alib_library_analysis_path ./$outputDir define_design_lib WORK -path ./$outputDir/WORK analyze -f sverilog -lib WORK $my_verilog_files -elaborate $my_toplevel -parameter P -lib WORK +elaborate $my_toplevel -lib WORK # Set the current_design current_design $my_toplevel From e75c5d46e4925a378096854c977f00ae5ec67055 Mon Sep 17 00:00:00 2001 From: Kevin Kim Date: Sat, 26 Aug 2023 20:25:47 -0700 Subject: [PATCH 04/20] created wrappers directory in synth/ --- {fpga/src => synthDC/wrappers}/drsuwrapper.sv | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {fpga/src => synthDC/wrappers}/drsuwrapper.sv (100%) diff --git a/fpga/src/drsuwrapper.sv b/synthDC/wrappers/drsuwrapper.sv similarity index 100% rename from fpga/src/drsuwrapper.sv rename to synthDC/wrappers/drsuwrapper.sv From 4feabdcf11a30ed80c164040ca18d322c3879c88 Mon Sep 17 00:00:00 2001 From: Kevin Kim Date: Mon, 11 Sep 2023 17:08:48 -0700 Subject: [PATCH 05/20] cleaning --- src/wrappers/fdivsqrt.sv | 0 src/wrappers/wallypipelinedcorewrapper.sv | 10 +++++----- synthDC/scripts/synth.tcl | 4 +--- {src => synthDC}/wrappers/drsuwrapper.sv | 7 ++++--- 4 files changed, 10 insertions(+), 11 deletions(-) delete mode 100644 src/wrappers/fdivsqrt.sv rename {src => synthDC}/wrappers/drsuwrapper.sv (95%) diff --git a/src/wrappers/fdivsqrt.sv b/src/wrappers/fdivsqrt.sv deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/wrappers/wallypipelinedcorewrapper.sv b/src/wrappers/wallypipelinedcorewrapper.sv index bc5f63d1c..09309bf0e 100644 --- a/src/wrappers/wallypipelinedcorewrapper.sv +++ b/src/wrappers/wallypipelinedcorewrapper.sv @@ -30,18 +30,19 @@ import cvw::*; +`include "parameter-defs.vh" module wallypipelinedcorewrapper ( input logic clk, reset, // Privileged input logic MTimerInt, MExtInt, SExtInt, MSwInt, input logic [63:0] MTIME_CLINT, // Bus Interface - input logic [AHBW-1:0] HRDATA, + input logic [P.XLEN-1:0] HRDATA, input logic HREADY, HRESP, output logic HCLK, HRESETn, - output logic [PA_BITS-1:0] HADDR, - output logic [AHBW-1:0] HWDATA, - output logic [XLEN/8-1:0] HWSTRB, + output logic [P.PA_BITS-1:0] HADDR, + output logic [32-1:0] HWDATA, + output logic [32/8-1:0] HWSTRB, output logic HWRITE, output logic [2:0] HSIZE, output logic [2:0] HBURST, @@ -49,7 +50,6 @@ module wallypipelinedcorewrapper ( output logic [1:0] HTRANS, output logic HMASTLOCK ); - `include "parameter-defs.vh" wallypipelinedcore #(P) core(.*); diff --git a/synthDC/scripts/synth.tcl b/synthDC/scripts/synth.tcl index 075bb5db9..7bf1f0f96 100755 --- a/synthDC/scripts/synth.tcl +++ b/synthDC/scripts/synth.tcl @@ -36,15 +36,13 @@ if {$wrapper ==1 } { } -# Only for FMA class project; comment out when done -# eval file copy -force [glob ${hdl_src}/fma/fma16.v] {hdl/} - # Enables name mapping if { $saifpower == 1 } { saif_map -start } # Verilog files +#set my_verilog_files [glob $outputDir/hdl/cvw.sv $outputDir/hdl/*.sv $outputDir/config/*.vh] set my_verilog_files [glob $outputDir/hdl/cvw.sv $outputDir/hdl/*.sv] # Set toplevel diff --git a/src/wrappers/drsuwrapper.sv b/synthDC/wrappers/drsuwrapper.sv similarity index 95% rename from src/wrappers/drsuwrapper.sv rename to synthDC/wrappers/drsuwrapper.sv index cb97a4aab..dae37e5bb 100644 --- a/src/wrappers/drsuwrapper.sv +++ b/synthDC/wrappers/drsuwrapper.sv @@ -1,5 +1,5 @@ /////////////////////////////////////////// -// drsu.sv +// drsuwrapper.sv // // Written: kekim@hmc.edu // Modified:19 May 2023 @@ -29,7 +29,8 @@ import cvw::*; -module drsuwrapper( +`include "parameter-defs.vh" +module drsuwrapper ( input logic clk, input logic reset, input logic [1:0] FmtE, @@ -57,7 +58,7 @@ module drsuwrapper( ); //`include "parameter-defs.vh" -drsu #(P) d(.*); + drsu #(P) drsucore(.*); endmodule \ No newline at end of file From 06ed3a25ef9a10f3fd9664cdfa75e74dc17f55e9 Mon Sep 17 00:00:00 2001 From: Kevin Kim Date: Tue, 17 Oct 2023 11:43:43 -0700 Subject: [PATCH 06/20] started fp-synth script --- synthDC/scripts/fp-synth.sh | 62 +++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 synthDC/scripts/fp-synth.sh diff --git a/synthDC/scripts/fp-synth.sh b/synthDC/scripts/fp-synth.sh new file mode 100644 index 000000000..528ab86e8 --- /dev/null +++ b/synthDC/scripts/fp-synth.sh @@ -0,0 +1,62 @@ +#!/bin/bash + +# RADIX 2 +setRADIXeq2 () { +sed -i "157s/RADIX.*/RADIX = 32\'h2/" $WALLY/config/rv64gc/config.vh +sed -i "157s/RADIX.*/RADIX = 32\'h2/" $WALLY/config/rv32gc/config.vh +} + +# K = 1 +setKeq1 () { +sed -i "158s/DIVCOPIES.*/DIVCOPIES = 32\'h1/" $WALLY/config/rv64gc/config.vh +sed -i "158s/DIVCOPIES.*/DIVCOPIES = 32\'h1/" $WALLY/config/rv32gc/config.vh +} + +# K = 2 +setKeq2 () { +sed -i "158s/DIVCOPIES.*/DIVCOPIES = 32\'h2/" $WALLY/config/rv64gc/config.vh +sed -i "158s/DIVCOPIES.*/DIVCOPIES = 32\'h2/" $WALLY/config/rv32gc/config.vh +} + +# K = 4 +setKeq4 () { +sed -i "158s/DIVCOPIES.*/DIVCOPIES = 32\'h4/" $WALLY/config/rv64gc/config.vh +sed -i "158s/DIVCOPIES.*/DIVCOPIES = 32\'h4/" $WALLY/config/rv32gc/config.vh +} + +# RADIX 4 +setRADIXeq4 () { +sed -i "157s/RADIX.*/RADIX = 32\'h4/" $WALLY/config/rv64gc/config.vh +sed -i "157s/RADIX.*/RADIX = 32\'h4/" $WALLY/config/rv32gc/config.vh +} + +# IDIVBITS = 1 +setIDIVBITSeq1 () { +sed -i "80s/IDIV_BITSPERCYCLE.*/IDIV_BITSPERCYCLE = 32\'d1/" $WALLY/config/rv64gc/config.vh +sed -i "80s/IDIV_BITSPERCYCLE.*/IDIV_BITSPERCYCLE = 32\'d1/" $WALLY/config/rv32gc/config.vh +} + +# IDIVBITS = 2 +setIDIVBITSeq2 () { +sed -i "80s/IDIV_BITSPERCYCLE.*/IDIV_BITSPERCYCLE = 32\'d2/" $WALLY/config/rv64gc/config.vh +sed -i "80s/IDIV_BITSPERCYCLE.*/IDIV_BITSPERCYCLE = 32\'d2/" $WALLY/config/rv32gc/config.vh +} + +# IDIVBITS = 4 +setIDIVBITSeq1 () { +sed -i "80s/IDIV_BITSPERCYCLE.*/IDIV_BITSPERCYCLE = 32\'d4/" $WALLY/config/rv64gc/config.vh +sed -i "80s/IDIV_BITSPERCYCLE.*/IDIV_BITSPERCYCLE = 32\'d4/" $WALLY/config/rv32gc/config.vh +} + +# IDIV ON FPU +setIDIVeq1 () { +sed -i "81s/IDIV_ON_FPU.*/IDIV_ON_FPU = 1/" $WALLY/config/rv64gc/config.vh +sed -i "81s/IDIV_ON_FPU.*/IDIV_ON_FPU = 1/" $WALLY/config/rv32gc/config.vh +} + +# IDIV NOT ON FPU +setIDIVeq0 () { +sed -i "81s/IDIV_ON_FPU.*/IDIV_ON_FPU = 0/" $WALLY/config/rv64gc/config.vh +sed -i "81s/IDIV_ON_FPU.*/IDIV_ON_FPU = 0/" $WALLY/config/rv32gc/config.vh +} + From 9304ad8fd959e84f4c27ccadbf2c1bf08d394b31 Mon Sep 17 00:00:00 2001 From: Kevin Kim Date: Tue, 17 Oct 2023 15:45:13 -0700 Subject: [PATCH 07/20] progress on fp-synth --- src/wrappers/wallypipelinedcorewrapper.sv | 56 ---------------- synthDC/scripts/fp-synth.sh | 82 ++++++++++++++--------- 2 files changed, 50 insertions(+), 88 deletions(-) delete mode 100644 src/wrappers/wallypipelinedcorewrapper.sv diff --git a/src/wrappers/wallypipelinedcorewrapper.sv b/src/wrappers/wallypipelinedcorewrapper.sv deleted file mode 100644 index 09309bf0e..000000000 --- a/src/wrappers/wallypipelinedcorewrapper.sv +++ /dev/null @@ -1,56 +0,0 @@ -/////////////////////////////////////////// -// wallypipelinedcorewrapper.sv -// -// Written: Kevin Kim kekim@hmc.edu 21 August 2023 -// Modified: -// -// Purpose: A wrapper to set parameters. Vivado cannot set the top level parameters because it only supports verilog, -// not system verilog. -// -// A component of the Wally configurable RISC-V project. -// -// Copyright (C) 2021 Harvey Mudd College & Oklahoma State University -// -// SPDX-License-Identifier: Apache-2.0 WITH SHL-2.1 -// -// Licensed under the Solderpad Hardware License v 2.1 (the “License”); you may not use this file -// except in compliance with the License, or, at your option, the Apache License version 2.0. You -// may obtain a copy of the License at -// -// https://solderpad.org/licenses/SHL-2.1/ -// -// Unless required by applicable law or agreed to in writing, any work distributed under the -// 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. -//////////////////////////////////////////////////////////////////////////////////////////////// - -//`include "BranchPredictorType.vh" -`include "config.vh" - -import cvw::*; - -`include "parameter-defs.vh" -module wallypipelinedcorewrapper ( - input logic clk, reset, - // Privileged - input logic MTimerInt, MExtInt, SExtInt, MSwInt, - input logic [63:0] MTIME_CLINT, - // Bus Interface - input logic [P.XLEN-1:0] HRDATA, - input logic HREADY, HRESP, - output logic HCLK, HRESETn, - output logic [P.PA_BITS-1:0] HADDR, - output logic [32-1:0] HWDATA, - output logic [32/8-1:0] HWSTRB, - output logic HWRITE, - output logic [2:0] HSIZE, - output logic [2:0] HBURST, - output logic [3:0] HPROT, - output logic [1:0] HTRANS, - output logic HMASTLOCK -); - - wallypipelinedcore #(P) core(.*); - -endmodule diff --git a/synthDC/scripts/fp-synth.sh b/synthDC/scripts/fp-synth.sh index 528ab86e8..b3867754c 100644 --- a/synthDC/scripts/fp-synth.sh +++ b/synthDC/scripts/fp-synth.sh @@ -2,61 +2,79 @@ # RADIX 2 setRADIXeq2 () { -sed -i "157s/RADIX.*/RADIX = 32\'h2/" $WALLY/config/rv64gc/config.vh -sed -i "157s/RADIX.*/RADIX = 32\'h2/" $WALLY/config/rv32gc/config.vh -} - -# K = 1 -setKeq1 () { -sed -i "158s/DIVCOPIES.*/DIVCOPIES = 32\'h1/" $WALLY/config/rv64gc/config.vh -sed -i "158s/DIVCOPIES.*/DIVCOPIES = 32\'h1/" $WALLY/config/rv32gc/config.vh -} - -# K = 2 -setKeq2 () { -sed -i "158s/DIVCOPIES.*/DIVCOPIES = 32\'h2/" $WALLY/config/rv64gc/config.vh -sed -i "158s/DIVCOPIES.*/DIVCOPIES = 32\'h2/" $WALLY/config/rv32gc/config.vh -} - -# K = 4 -setKeq4 () { -sed -i "158s/DIVCOPIES.*/DIVCOPIES = 32\'h4/" $WALLY/config/rv64gc/config.vh -sed -i "158s/DIVCOPIES.*/DIVCOPIES = 32\'h4/" $WALLY/config/rv32gc/config.vh +sed -i "157s/RADIX.*/RADIX = 32\'h2;/" $WALLY/config/rv64gc/config.vh +sed -i "157s/RADIX.*/RADIX = 32\'h2;/" $WALLY/config/rv32gc/config.vh } # RADIX 4 setRADIXeq4 () { -sed -i "157s/RADIX.*/RADIX = 32\'h4/" $WALLY/config/rv64gc/config.vh -sed -i "157s/RADIX.*/RADIX = 32\'h4/" $WALLY/config/rv32gc/config.vh +sed -i "157s/RADIX.*/RADIX = 32\'h4;/" $WALLY/config/rv64gc/config.vh +sed -i "157s/RADIX.*/RADIX = 32\'h4;/" $WALLY/config/rv32gc/config.vh +} + +# K = 1 +setKeq1 () { +sed -i "158s/DIVCOPIES.*/DIVCOPIES = 32\'h1;/" $WALLY/config/rv64gc/config.vh +sed -i "158s/DIVCOPIES.*/DIVCOPIES = 32\'h1;/" $WALLY/config/rv32gc/config.vh +} + +# K = 2 +setKeq2 () { +sed -i "158s/DIVCOPIES.*/DIVCOPIES = 32\'h2;/" $WALLY/config/rv64gc/config.vh +sed -i "158s/DIVCOPIES.*/DIVCOPIES = 32\'h2;/" $WALLY/config/rv32gc/config.vh +} + +# K = 4 +setKeq4 () { +sed -i "158s/DIVCOPIES.*/DIVCOPIES = 32\'h4;/" $WALLY/config/rv64gc/config.vh +sed -i "158s/DIVCOPIES.*/DIVCOPIES = 32\'h4;/" $WALLY/config/rv32gc/config.vh } # IDIVBITS = 1 setIDIVBITSeq1 () { -sed -i "80s/IDIV_BITSPERCYCLE.*/IDIV_BITSPERCYCLE = 32\'d1/" $WALLY/config/rv64gc/config.vh -sed -i "80s/IDIV_BITSPERCYCLE.*/IDIV_BITSPERCYCLE = 32\'d1/" $WALLY/config/rv32gc/config.vh +sed -i "80s/IDIV_BITSPERCYCLE.*/IDIV_BITSPERCYCLE = 32;\'d1/" $WALLY/config/rv64gc/config.vh +sed -i "80s/IDIV_BITSPERCYCLE.*/IDIV_BITSPERCYCLE = 32;\'d1/" $WALLY/config/rv32gc/config.vh } # IDIVBITS = 2 setIDIVBITSeq2 () { -sed -i "80s/IDIV_BITSPERCYCLE.*/IDIV_BITSPERCYCLE = 32\'d2/" $WALLY/config/rv64gc/config.vh -sed -i "80s/IDIV_BITSPERCYCLE.*/IDIV_BITSPERCYCLE = 32\'d2/" $WALLY/config/rv32gc/config.vh +sed -i "80s/IDIV_BITSPERCYCLE.*/IDIV_BITSPERCYCLE = 32;\'d2/" $WALLY/config/rv64gc/config.vh +sed -i "80s/IDIV_BITSPERCYCLE.*/IDIV_BITSPERCYCLE = 32;\'d2/" $WALLY/config/rv32gc/config.vh } # IDIVBITS = 4 setIDIVBITSeq1 () { -sed -i "80s/IDIV_BITSPERCYCLE.*/IDIV_BITSPERCYCLE = 32\'d4/" $WALLY/config/rv64gc/config.vh -sed -i "80s/IDIV_BITSPERCYCLE.*/IDIV_BITSPERCYCLE = 32\'d4/" $WALLY/config/rv32gc/config.vh +sed -i "80s/IDIV_BITSPERCYCLE.*/IDIV_BITSPERCYCLE = 32;\'d4/" $WALLY/config/rv64gc/config.vh +sed -i "80s/IDIV_BITSPERCYCLE.*/IDIV_BITSPERCYCLE = 32;\'d4/" $WALLY/config/rv32gc/config.vh } # IDIV ON FPU setIDIVeq1 () { -sed -i "81s/IDIV_ON_FPU.*/IDIV_ON_FPU = 1/" $WALLY/config/rv64gc/config.vh -sed -i "81s/IDIV_ON_FPU.*/IDIV_ON_FPU = 1/" $WALLY/config/rv32gc/config.vh +sed -i "81s/IDIV_ON_FPU.*/IDIV_ON_FPU = 1;/" $WALLY/config/rv64gc/config.vh +sed -i "81s/IDIV_ON_FPU.*/IDIV_ON_FPU = 1;/" $WALLY/config/rv32gc/config.vh } # IDIV NOT ON FPU setIDIVeq0 () { -sed -i "81s/IDIV_ON_FPU.*/IDIV_ON_FPU = 0/" $WALLY/config/rv64gc/config.vh -sed -i "81s/IDIV_ON_FPU.*/IDIV_ON_FPU = 0/" $WALLY/config/rv32gc/config.vh +sed -i "81s/IDIV_ON_FPU.*/IDIV_ON_FPU = 0;/" $WALLY/config/rv64gc/config.vh +sed -i "81s/IDIV_ON_FPU.*/IDIV_ON_FPU = 0;/" $WALLY/config/rv32gc/config.vh } +# Synthesize Integer Divider +synthIntDiv () { + +} + +# Synthesize FP Divider Unit + +synthFPDiv () { + +} + +# forms title for synthesis +getTitle () { +RADIX=$(sed -n "157p" $WALLY/config/rv64gc/config.vh | tail -c 3 | head -c 1) +K=$(sed -n "158p" $WALLY/config/rv64gc/config.vh | tail -c 3 | head -c 1) +IDIV=$(sed -n "81p" $WALLY/config/rv64gc/config.vh | tail -c 3 | head -c 1) +IDIVBITS=$(sed -n "80p" $WALLY/config/rv64gc/config.vh | tail -c 3 | head -c 1) +} \ No newline at end of file From 93e8495818ec6729b7fc17691805bd1c83aec9de Mon Sep 17 00:00:00 2001 From: Kevin Kim Date: Wed, 18 Oct 2023 10:28:14 -0700 Subject: [PATCH 08/20] bug fix in getTitle, added synth functions --- synthDC/scripts/fp-synth.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/synthDC/scripts/fp-synth.sh b/synthDC/scripts/fp-synth.sh index b3867754c..2fbdf5b14 100644 --- a/synthDC/scripts/fp-synth.sh +++ b/synthDC/scripts/fp-synth.sh @@ -62,13 +62,19 @@ sed -i "81s/IDIV_ON_FPU.*/IDIV_ON_FPU = 0;/" $WALLY/config/rv32gc/config.vh # Synthesize Integer Divider synthIntDiv () { - +make -C $WALLY/synthDC synth DESIGN=div TECH=tsmc28 CONFIG=rv32gc FREQ=3000 WRAPPER=1 TITLE=$(getTitle) +make -C $WALLY/synthDC synth DESIGN=div TECH=tsmc28 CONFIG=rv64gc FREQ=3000 WRAPPER=1 TITLE=$(getTitle) +make -C $WALLY/synthDC synth DESIGN=div TECH=tsmc28 CONFIG=rv32gc FREQ=100 WRAPPER=1 TITLE=$(getTitle) +make -C $WALLY/synthDC synth DESIGN=div TECH=tsmc28 CONFIG=rv64gc FREQ=100 WRAPPER=1 TITLE=$(getTitle) } # Synthesize FP Divider Unit synthFPDiv () { - +make -C $WALLY/synthDC synth DESIGN=drsu TECH=tsmc28 CONFIG=rv32gc FREQ=3000 WRAPPER=1 TITLE=$(getTitle) +make -C $WALLY/synthDC synth DESIGN=drsu TECH=tsmc28 CONFIG=rv64gc FREQ=3000 WRAPPER=1 TITLE=$(getTitle) +make -C $WALLY/synthDC synth DESIGN=drsu TECH=tsmc28 CONFIG=rv32gc FREQ=100 WRAPPER=1 TITLE=$(getTitle) +make -C $WALLY/synthDC synth DESIGN=drsu TECH=tsmc28 CONFIG=rv64gc FREQ=100 WRAPPER=1 TITLE=$(getTitle) } # forms title for synthesis @@ -77,4 +83,6 @@ RADIX=$(sed -n "157p" $WALLY/config/rv64gc/config.vh | tail -c 3 | head -c 1) K=$(sed -n "158p" $WALLY/config/rv64gc/config.vh | tail -c 3 | head -c 1) IDIV=$(sed -n "81p" $WALLY/config/rv64gc/config.vh | tail -c 3 | head -c 1) IDIVBITS=$(sed -n "80p" $WALLY/config/rv64gc/config.vh | tail -c 3 | head -c 1) +title="RADIX_${RADIX}_K_${K}_INTDIV_${IDIV}_IDIVBITS_${IDIVBITS}" +echo $title } \ No newline at end of file From 3ec8f2f6f2bdb22cab83f02649aa8ac6e9b6d55c Mon Sep 17 00:00:00 2001 From: Kevin Kim Date: Wed, 18 Oct 2023 14:22:57 -0700 Subject: [PATCH 09/20] bug fix in wrapper generation --- synthDC/scripts/wrapperGen.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/synthDC/scripts/wrapperGen.py b/synthDC/scripts/wrapperGen.py index 3c36e2d63..e931d0a65 100755 --- a/synthDC/scripts/wrapperGen.py +++ b/synthDC/scripts/wrapperGen.py @@ -43,7 +43,7 @@ index=0 # string copy logic for l in lines: - if l.find("module") == 0: + if l.lstrip().find("module") == 0: lineModuleStart = index moduleName = l.split()[1] writeBuf = True @@ -51,7 +51,7 @@ for l in lines: continue if (writeBuf): buf += l - if l.find (");") == 0: + if l.lstrip().find (");") == 0: lineModuleEnd = index break index+=1 From ac458995cae3dd490973075f863c5317aade6425 Mon Sep 17 00:00:00 2001 From: Kevin Kim Date: Fri, 20 Oct 2023 20:04:18 -0700 Subject: [PATCH 10/20] added area + timing grabber to synth-fp --- synthDC/scripts/fp-synth.sh | 52 +++++++++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 2 deletions(-) mode change 100644 => 100755 synthDC/scripts/fp-synth.sh diff --git a/synthDC/scripts/fp-synth.sh b/synthDC/scripts/fp-synth.sh old mode 100644 new mode 100755 index 2fbdf5b14..35fa54ac8 --- a/synthDC/scripts/fp-synth.sh +++ b/synthDC/scripts/fp-synth.sh @@ -43,7 +43,7 @@ sed -i "80s/IDIV_BITSPERCYCLE.*/IDIV_BITSPERCYCLE = 32;\'d2/" $WALLY/config/rv32 } # IDIVBITS = 4 -setIDIVBITSeq1 () { +setIDIVBITSeq4 () { sed -i "80s/IDIV_BITSPERCYCLE.*/IDIV_BITSPERCYCLE = 32;\'d4/" $WALLY/config/rv64gc/config.vh sed -i "80s/IDIV_BITSPERCYCLE.*/IDIV_BITSPERCYCLE = 32;\'d4/" $WALLY/config/rv32gc/config.vh } @@ -77,7 +77,30 @@ make -C $WALLY/synthDC synth DESIGN=drsu TECH=tsmc28 CONFIG=rv32gc FREQ=100 WRAP make -C $WALLY/synthDC synth DESIGN=drsu TECH=tsmc28 CONFIG=rv64gc FREQ=100 WRAPPER=1 TITLE=$(getTitle) } +synthAll () { + synthIntDiv + synthFPDiv +} + + +# Synthesize DivSqrt Preprocessor + +synthFPDivsqrtpreproc () { +make -C $WALLY/synthDC synth DESIGN=fdivsqrtpreproc TECH=tsmc28 CONFIG=rv32gc FREQ=3000 WRAPPER=1 TITLE=$(getTitle) +make -C $WALLY/synthDC synth DESIGN=fdivsqrtpreproc TECH=tsmc28 CONFIG=rv64gc FREQ=3000 WRAPPER=1 TITLE=$(getTitle) +make -C $WALLY/synthDC synth DESIGN=fdivsqrtpreproc TECH=tsmc28 CONFIG=rv32gc FREQ=100 WRAPPER=1 TITLE=$(getTitle) +make -C $WALLY/synthDC synth DESIGN=fdivsqrtpreproc TECH=tsmc28 CONFIG=rv64gc FREQ=100 WRAPPER=1 TITLE=$(getTitle) +} + +synthFPDiviter () { +make -C $WALLY/synthDC synth DESIGN=fdivsqrtiter TECH=tsmc28 CONFIG=rv32gc FREQ=3000 WRAPPER=1 TITLE=$(getTitle) +make -C $WALLY/synthDC synth DESIGN=fdivsqrtiter TECH=tsmc28 CONFIG=rv64gc FREQ=3000 WRAPPER=1 TITLE=$(getTitle) +make -C $WALLY/synthDC synth DESIGN=fdivsqrtiter TECH=tsmc28 CONFIG=rv32gc FREQ=100 WRAPPER=1 TITLE=$(getTitle) +make -C $WALLY/synthDC synth DESIGN=fdivsqrtiter TECH=tsmc28 CONFIG=rv64gc FREQ=100 WRAPPER=1 TITLE=$(getTitle) +} + # forms title for synthesis + getTitle () { RADIX=$(sed -n "157p" $WALLY/config/rv64gc/config.vh | tail -c 3 | head -c 1) K=$(sed -n "158p" $WALLY/config/rv64gc/config.vh | tail -c 3 | head -c 1) @@ -85,4 +108,29 @@ IDIV=$(sed -n "81p" $WALLY/config/rv64gc/config.vh | tail -c 3 | head -c 1) IDIVBITS=$(sed -n "80p" $WALLY/config/rv64gc/config.vh | tail -c 3 | head -c 1) title="RADIX_${RADIX}_K_${K}_INTDIV_${IDIV}_IDIVBITS_${IDIVBITS}" echo $title -} \ No newline at end of file +} + +# writes area delay of runs to csv +writeCSV () { + # iterate over all files in runs/ + for FILE in $WALLY/synthDC/runs/*; + do + design="${FILE##*/}" + # grab area + areaString=($(grep "Total cell area" $FILE/reports/area.rep)) + area=${areaString[3]} + echo $area + # grab timing + timingString=($(grep "data arrival time" $FILE/reports/timing.rep)) + timing=${timingString[3]} + echo $timing + + done; +} + +setKeq1 +setRADIXeq4 +synthAll +setKeq2 +setRADIXeq2 +synthAll \ No newline at end of file From cb4ca72b33cfffff2a7f8bffbf7b90b396a50b89 Mon Sep 17 00:00:00 2001 From: Kevin Kim Date: Fri, 20 Oct 2023 20:24:08 -0700 Subject: [PATCH 11/20] writes to synth csv --- synthDC/scripts/fp-synth.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/synthDC/scripts/fp-synth.sh b/synthDC/scripts/fp-synth.sh index 35fa54ac8..1dd3c443a 100755 --- a/synthDC/scripts/fp-synth.sh +++ b/synthDC/scripts/fp-synth.sh @@ -112,6 +112,7 @@ echo $title # writes area delay of runs to csv writeCSV () { + echo "design,area,timing" > $WALLY/synthDC/fp-synth.csv # iterate over all files in runs/ for FILE in $WALLY/synthDC/runs/*; do @@ -119,11 +120,10 @@ writeCSV () { # grab area areaString=($(grep "Total cell area" $FILE/reports/area.rep)) area=${areaString[3]} - echo $area # grab timing timingString=($(grep "data arrival time" $FILE/reports/timing.rep)) timing=${timingString[3]} - echo $timing + echo $design,$area,$timing >> $WALLY/synthDC/fp-synth.csv done; } From f4d0f1bad25117c1d6ead143b8a6e02d56b3da99 Mon Sep 17 00:00:00 2001 From: Kevin Kim Date: Fri, 20 Oct 2023 20:24:56 -0700 Subject: [PATCH 12/20] comments --- synthDC/scripts/fp-synth.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/synthDC/scripts/fp-synth.sh b/synthDC/scripts/fp-synth.sh index 1dd3c443a..181eeebd5 100755 --- a/synthDC/scripts/fp-synth.sh +++ b/synthDC/scripts/fp-synth.sh @@ -117,12 +117,16 @@ writeCSV () { for FILE in $WALLY/synthDC/runs/*; do design="${FILE##*/}" + # grab area areaString=($(grep "Total cell area" $FILE/reports/area.rep)) area=${areaString[3]} + # grab timing timingString=($(grep "data arrival time" $FILE/reports/timing.rep)) timing=${timingString[3]} + + # write to csv echo $design,$area,$timing >> $WALLY/synthDC/fp-synth.csv done; From 2dd58dd8b81b89c5d306d2ca87132af403c4dda3 Mon Sep 17 00:00:00 2001 From: Kevin Kim Date: Fri, 20 Oct 2023 20:28:19 -0700 Subject: [PATCH 13/20] parallelize synth jobs --- synthDC/scripts/fp-synth.sh | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/synthDC/scripts/fp-synth.sh b/synthDC/scripts/fp-synth.sh index 181eeebd5..2ddba09e4 100755 --- a/synthDC/scripts/fp-synth.sh +++ b/synthDC/scripts/fp-synth.sh @@ -62,24 +62,24 @@ sed -i "81s/IDIV_ON_FPU.*/IDIV_ON_FPU = 0;/" $WALLY/config/rv32gc/config.vh # Synthesize Integer Divider synthIntDiv () { -make -C $WALLY/synthDC synth DESIGN=div TECH=tsmc28 CONFIG=rv32gc FREQ=3000 WRAPPER=1 TITLE=$(getTitle) -make -C $WALLY/synthDC synth DESIGN=div TECH=tsmc28 CONFIG=rv64gc FREQ=3000 WRAPPER=1 TITLE=$(getTitle) -make -C $WALLY/synthDC synth DESIGN=div TECH=tsmc28 CONFIG=rv32gc FREQ=100 WRAPPER=1 TITLE=$(getTitle) -make -C $WALLY/synthDC synth DESIGN=div TECH=tsmc28 CONFIG=rv64gc FREQ=100 WRAPPER=1 TITLE=$(getTitle) +make -C $WALLY/synthDC synth DESIGN=div TECH=tsmc28 CONFIG=rv32gc FREQ=3000 WRAPPER=1 TITLE=$(getTitle) & +make -C $WALLY/synthDC synth DESIGN=div TECH=tsmc28 CONFIG=rv64gc FREQ=3000 WRAPPER=1 TITLE=$(getTitle) & +make -C $WALLY/synthDC synth DESIGN=div TECH=tsmc28 CONFIG=rv32gc FREQ=100 WRAPPER=1 TITLE=$(getTitle) & +make -C $WALLY/synthDC synth DESIGN=div TECH=tsmc28 CONFIG=rv64gc FREQ=100 WRAPPER=1 TITLE=$(getTitle) & } # Synthesize FP Divider Unit synthFPDiv () { -make -C $WALLY/synthDC synth DESIGN=drsu TECH=tsmc28 CONFIG=rv32gc FREQ=3000 WRAPPER=1 TITLE=$(getTitle) -make -C $WALLY/synthDC synth DESIGN=drsu TECH=tsmc28 CONFIG=rv64gc FREQ=3000 WRAPPER=1 TITLE=$(getTitle) -make -C $WALLY/synthDC synth DESIGN=drsu TECH=tsmc28 CONFIG=rv32gc FREQ=100 WRAPPER=1 TITLE=$(getTitle) -make -C $WALLY/synthDC synth DESIGN=drsu TECH=tsmc28 CONFIG=rv64gc FREQ=100 WRAPPER=1 TITLE=$(getTitle) +make -C $WALLY/synthDC synth DESIGN=drsu TECH=tsmc28 CONFIG=rv32gc FREQ=3000 WRAPPER=1 TITLE=$(getTitle) & +make -C $WALLY/synthDC synth DESIGN=drsu TECH=tsmc28 CONFIG=rv64gc FREQ=3000 WRAPPER=1 TITLE=$(getTitle) & +make -C $WALLY/synthDC synth DESIGN=drsu TECH=tsmc28 CONFIG=rv32gc FREQ=100 WRAPPER=1 TITLE=$(getTitle) & +make -C $WALLY/synthDC synth DESIGN=drsu TECH=tsmc28 CONFIG=rv64gc FREQ=100 WRAPPER=1 TITLE=$(getTitle) & } synthAll () { - synthIntDiv - synthFPDiv + synthIntDiv & + synthFPDiv & } @@ -132,9 +132,13 @@ writeCSV () { done; } +go() { + setKeq1 setRADIXeq4 synthAll setKeq2 setRADIXeq2 -synthAll \ No newline at end of file +synthAll + +} From dad199753ab26468bdf474667c2a05fdad4415fb Mon Sep 17 00:00:00 2001 From: Kevin Kim Date: Fri, 20 Oct 2023 20:38:35 -0700 Subject: [PATCH 14/20] fixed synth parallelize bug --- synthDC/scripts/fp-synth.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/synthDC/scripts/fp-synth.sh b/synthDC/scripts/fp-synth.sh index 2ddba09e4..e874aa16f 100755 --- a/synthDC/scripts/fp-synth.sh +++ b/synthDC/scripts/fp-synth.sh @@ -66,6 +66,7 @@ make -C $WALLY/synthDC synth DESIGN=div TECH=tsmc28 CONFIG=rv32gc FREQ=3000 WRAP make -C $WALLY/synthDC synth DESIGN=div TECH=tsmc28 CONFIG=rv64gc FREQ=3000 WRAPPER=1 TITLE=$(getTitle) & make -C $WALLY/synthDC synth DESIGN=div TECH=tsmc28 CONFIG=rv32gc FREQ=100 WRAPPER=1 TITLE=$(getTitle) & make -C $WALLY/synthDC synth DESIGN=div TECH=tsmc28 CONFIG=rv64gc FREQ=100 WRAPPER=1 TITLE=$(getTitle) & +wait } # Synthesize FP Divider Unit @@ -75,11 +76,14 @@ make -C $WALLY/synthDC synth DESIGN=drsu TECH=tsmc28 CONFIG=rv32gc FREQ=3000 WRA make -C $WALLY/synthDC synth DESIGN=drsu TECH=tsmc28 CONFIG=rv64gc FREQ=3000 WRAPPER=1 TITLE=$(getTitle) & make -C $WALLY/synthDC synth DESIGN=drsu TECH=tsmc28 CONFIG=rv32gc FREQ=100 WRAPPER=1 TITLE=$(getTitle) & make -C $WALLY/synthDC synth DESIGN=drsu TECH=tsmc28 CONFIG=rv64gc FREQ=100 WRAPPER=1 TITLE=$(getTitle) & +wait } synthAll () { synthIntDiv & synthFPDiv & + wait + } From 87e9dbe1fd8e90369064762f0a34d90af50e9291 Mon Sep 17 00:00:00 2001 From: Kevin Kim Date: Sat, 21 Oct 2023 09:50:04 -0700 Subject: [PATCH 15/20] more bug fixes on fp-synth --- synthDC/scripts/fp-synth.sh | 61 +++++++++++++++++++++++++------------ 1 file changed, 41 insertions(+), 20 deletions(-) diff --git a/synthDC/scripts/fp-synth.sh b/synthDC/scripts/fp-synth.sh index e874aa16f..c22315942 100755 --- a/synthDC/scripts/fp-synth.sh +++ b/synthDC/scripts/fp-synth.sh @@ -2,62 +2,82 @@ # RADIX 2 setRADIXeq2 () { -sed -i "157s/RADIX.*/RADIX = 32\'h2;/" $WALLY/config/rv64gc/config.vh -sed -i "157s/RADIX.*/RADIX = 32\'h2;/" $WALLY/config/rv32gc/config.vh +n64=$(grep -n "RADIX" $WALLY/config/rv64gc/config.vh | cut -d: -f1) +n32=$(grep -n "RADIX" $WALLY/config/rv32gc/config.vh | cut -d: -f1) +sed -i "${n64}s/RADIX.*/RADIX = 32\'h2;/" $WALLY/config/rv64gc/config.vh +sed -i "${n32}s/RADIX.*/RADIX = 32\'h2;/" $WALLY/config/rv32gc/config.vh } # RADIX 4 setRADIXeq4 () { -sed -i "157s/RADIX.*/RADIX = 32\'h4;/" $WALLY/config/rv64gc/config.vh -sed -i "157s/RADIX.*/RADIX = 32\'h4;/" $WALLY/config/rv32gc/config.vh +n64=$(grep -n "RADIX" $WALLY/config/rv64gc/config.vh | cut -d: -f1) +n32=$(grep -n "RADIX" $WALLY/config/rv32gc/config.vh | cut -d: -f1) +sed -i "${n64}s/RADIX.*/RADIX = 32\'h4;/" $WALLY/config/rv64gc/config.vh +sed -i "${n32}s/RADIX.*/RADIX = 32\'h4;/" $WALLY/config/rv32gc/config.vh } # K = 1 setKeq1 () { -sed -i "158s/DIVCOPIES.*/DIVCOPIES = 32\'h1;/" $WALLY/config/rv64gc/config.vh -sed -i "158s/DIVCOPIES.*/DIVCOPIES = 32\'h1;/" $WALLY/config/rv32gc/config.vh +n64=$(grep -n "DIVCOPIES" $WALLY/config/rv64gc/config.vh | cut -d: -f1) +n32=$(grep -n "DIVCOPIES" $WALLY/config/rv32gc/config.vh | cut -d: -f1) +sed -i "${n64}s/DIVCOPIES.*/DIVCOPIES = 32\'h1;/" $WALLY/config/rv64gc/config.vh +sed -i "${n32}s/DIVCOPIES.*/DIVCOPIES = 32\'h1;/" $WALLY/config/rv32gc/config.vh } # K = 2 setKeq2 () { -sed -i "158s/DIVCOPIES.*/DIVCOPIES = 32\'h2;/" $WALLY/config/rv64gc/config.vh -sed -i "158s/DIVCOPIES.*/DIVCOPIES = 32\'h2;/" $WALLY/config/rv32gc/config.vh +n64=$(grep -n "DIVCOPIES" $WALLY/config/rv64gc/config.vh | cut -d: -f1) +n32=$(grep -n "DIVCOPIES" $WALLY/config/rv32gc/config.vh | cut -d: -f1) +sed -i "${n64}s/DIVCOPIES.*/DIVCOPIES = 32\'h2;/" $WALLY/config/rv64gc/config.vh +sed -i "${n32}s/DIVCOPIES.*/DIVCOPIES = 32\'h2;/" $WALLY/config/rv32gc/config.vh } # K = 4 setKeq4 () { -sed -i "158s/DIVCOPIES.*/DIVCOPIES = 32\'h4;/" $WALLY/config/rv64gc/config.vh -sed -i "158s/DIVCOPIES.*/DIVCOPIES = 32\'h4;/" $WALLY/config/rv32gc/config.vh +n64=$(grep -n "DIVCOPIES" $WALLY/config/rv64gc/config.vh | cut -d: -f1) +n32=$(grep -n "DIVCOPIES" $WALLY/config/rv32gc/config.vh | cut -d: -f1) +sed -i "${n64}s/DIVCOPIES.*/DIVCOPIES = 32\'h4;/" $WALLY/config/rv64gc/config.vh +sed -i "${n32}s/DIVCOPIES.*/DIVCOPIES = 32\'h4;/" $WALLY/config/rv32gc/config.vh } # IDIVBITS = 1 setIDIVBITSeq1 () { -sed -i "80s/IDIV_BITSPERCYCLE.*/IDIV_BITSPERCYCLE = 32;\'d1/" $WALLY/config/rv64gc/config.vh -sed -i "80s/IDIV_BITSPERCYCLE.*/IDIV_BITSPERCYCLE = 32;\'d1/" $WALLY/config/rv32gc/config.vh +n64=$(grep -n "IDIV_BITSPERCYCLE" $WALLY/config/rv64gc/config.vh | cut -d: -f1) +n32=$(grep -n "IDIV_BITSPERCYCLE" $WALLY/config/rv32gc/config.vh | cut -d: -f1) +sed -i "${n64}s/IDIV_BITSPERCYCLE.*/IDIV_BITSPERCYCLE = 32;\'d1/" $WALLY/config/rv64gc/config.vh +sed -i "${n32}s/IDIV_BITSPERCYCLE.*/IDIV_BITSPERCYCLE = 32;\'d1/" $WALLY/config/rv32gc/config.vh } # IDIVBITS = 2 setIDIVBITSeq2 () { -sed -i "80s/IDIV_BITSPERCYCLE.*/IDIV_BITSPERCYCLE = 32;\'d2/" $WALLY/config/rv64gc/config.vh -sed -i "80s/IDIV_BITSPERCYCLE.*/IDIV_BITSPERCYCLE = 32;\'d2/" $WALLY/config/rv32gc/config.vh +n64=$(grep -n "IDIV_BITSPERCYCLE" $WALLY/config/rv64gc/config.vh | cut -d: -f1) +n32=$(grep -n "IDIV_BITSPERCYCLE" $WALLY/config/rv32gc/config.vh | cut -d: -f1) +sed -i "${n64}s/IDIV_BITSPERCYCLE.*/IDIV_BITSPERCYCLE = 32;\'d2/" $WALLY/config/rv64gc/config.vh +sed -i "${n32}s/IDIV_BITSPERCYCLE.*/IDIV_BITSPERCYCLE = 32;\'d2/" $WALLY/config/rv32gc/config.vh } # IDIVBITS = 4 setIDIVBITSeq4 () { -sed -i "80s/IDIV_BITSPERCYCLE.*/IDIV_BITSPERCYCLE = 32;\'d4/" $WALLY/config/rv64gc/config.vh -sed -i "80s/IDIV_BITSPERCYCLE.*/IDIV_BITSPERCYCLE = 32;\'d4/" $WALLY/config/rv32gc/config.vh +n64=$(grep -n "IDIV_BITSPERCYCLE" $WALLY/config/rv64gc/config.vh | cut -d: -f1) +n32=$(grep -n "IDIV_BITSPERCYCLE" $WALLY/config/rv32gc/config.vh | cut -d: -f1) +sed -i "${n64}s/IDIV_BITSPERCYCLE.*/IDIV_BITSPERCYCLE = 32;\'d4/" $WALLY/config/rv64gc/config.vh +sed -i "${n32}s/IDIV_BITSPERCYCLE.*/IDIV_BITSPERCYCLE = 32;\'d4/" $WALLY/config/rv32gc/config.vh } # IDIV ON FPU setIDIVeq1 () { -sed -i "81s/IDIV_ON_FPU.*/IDIV_ON_FPU = 1;/" $WALLY/config/rv64gc/config.vh -sed -i "81s/IDIV_ON_FPU.*/IDIV_ON_FPU = 1;/" $WALLY/config/rv32gc/config.vh +n64=$(grep -n "IDIV_ON_FPU" $WALLY/config/rv64gc/config.vh | cut -d: -f1) +n32=$(grep -n "IDIV_ON_FPU" $WALLY/config/rv32gc/config.vh | cut -d: -f1) +sed -i "${n64}s/IDIV_ON_FPU.*/IDIV_ON_FPU = 1;/" $WALLY/config/rv64gc/config.vh +sed -i "${n32}s/IDIV_ON_FPU.*/IDIV_ON_FPU = 1;/" $WALLY/config/rv32gc/config.vh } # IDIV NOT ON FPU setIDIVeq0 () { -sed -i "81s/IDIV_ON_FPU.*/IDIV_ON_FPU = 0;/" $WALLY/config/rv64gc/config.vh -sed -i "81s/IDIV_ON_FPU.*/IDIV_ON_FPU = 0;/" $WALLY/config/rv32gc/config.vh +n64=$(grep -n "IDIV_ON_FPU" $WALLY/config/rv64gc/config.vh | cut -d: -f1) +n32=$(grep -n "IDIV_ON_FPU" $WALLY/config/rv32gc/config.vh | cut -d: -f1) +sed -i "${n64}s/IDIV_ON_FPU.*/IDIV_ON_FPU = 0;/" $WALLY/config/rv64gc/config.vh +sed -i "${n32}s/IDIV_ON_FPU.*/IDIV_ON_FPU = 0;/" $WALLY/config/rv32gc/config.vh } # Synthesize Integer Divider @@ -141,6 +161,7 @@ go() { setKeq1 setRADIXeq4 synthAll +wait setKeq2 setRADIXeq2 synthAll From bfca11d475a06d4d1f716841192349695cca60dd Mon Sep 17 00:00:00 2001 From: Kevin Kim Date: Sat, 21 Oct 2023 10:04:17 -0700 Subject: [PATCH 16/20] more bug fixes --- synthDC/scripts/fp-synth.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/synthDC/scripts/fp-synth.sh b/synthDC/scripts/fp-synth.sh index c22315942..374d5e5d2 100755 --- a/synthDC/scripts/fp-synth.sh +++ b/synthDC/scripts/fp-synth.sh @@ -101,6 +101,7 @@ wait synthAll () { synthIntDiv & + wait synthFPDiv & wait From a70f106b5d899fd12fe839818d69d70a4e526d10 Mon Sep 17 00:00:00 2001 From: Kevin Kim Date: Sat, 21 Oct 2023 11:37:29 -0700 Subject: [PATCH 17/20] fixed testbench to work with cvw parameterization --- testbench/testbench-fp.sv | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testbench/testbench-fp.sv b/testbench/testbench-fp.sv index 057ab9eab..95e41e106 100644 --- a/testbench/testbench-fp.sv +++ b/testbench/testbench-fp.sv @@ -1128,7 +1128,7 @@ module testbenchfp; endmodule -module readvectors ( +module readvectors import cvw::*; #(parameter cvw_t P) ( input logic clk, input logic [P.FLEN*4+7:0] TestVector, input logic [P.FMTBITS-1:0] ModFmt, @@ -1159,7 +1159,7 @@ module readvectors ( ); localparam Q_LEN = 32'd128; - `include "parameter-defs.vh" + //`include "parameter-defs.vh" logic XEn; logic YEn; From 7fdb419688cac8f7f3ec362ffb78690a430f6ae7 Mon Sep 17 00:00:00 2001 From: Kevin Kim Date: Mon, 23 Oct 2023 11:26:32 -0700 Subject: [PATCH 18/20] bug fixes on synth script --- synthDC/scripts/fp-synth.sh | 49 ++++++++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 14 deletions(-) diff --git a/synthDC/scripts/fp-synth.sh b/synthDC/scripts/fp-synth.sh index 374d5e5d2..0344acb65 100755 --- a/synthDC/scripts/fp-synth.sh +++ b/synthDC/scripts/fp-synth.sh @@ -42,26 +42,26 @@ sed -i "${n32}s/DIVCOPIES.*/DIVCOPIES = 32\'h4;/" $WALLY/config/rv32gc/config.vh # IDIVBITS = 1 setIDIVBITSeq1 () { -n64=$(grep -n "IDIV_BITSPERCYCLE" $WALLY/config/rv64gc/config.vh | cut -d: -f1) -n32=$(grep -n "IDIV_BITSPERCYCLE" $WALLY/config/rv32gc/config.vh | cut -d: -f1) -sed -i "${n64}s/IDIV_BITSPERCYCLE.*/IDIV_BITSPERCYCLE = 32;\'d1/" $WALLY/config/rv64gc/config.vh -sed -i "${n32}s/IDIV_BITSPERCYCLE.*/IDIV_BITSPERCYCLE = 32;\'d1/" $WALLY/config/rv32gc/config.vh +n64=$(grep -n "IDIV_BITSPERCYCLE =" $WALLY/config/rv64gc/config.vh | cut -d: -f1) +n32=$(grep -n "IDIV_BITSPERCYCLE =" $WALLY/config/rv32gc/config.vh | cut -d: -f1) +sed -i "${n64}s/IDIV_BITSPERCYCLE.*/IDIV_BITSPERCYCLE = 32\'d1;/" $WALLY/config/rv64gc/config.vh +sed -i "${n32}s/IDIV_BITSPERCYCLE.*/IDIV_BITSPERCYCLE = 32\'d1;/" $WALLY/config/rv32gc/config.vh } # IDIVBITS = 2 setIDIVBITSeq2 () { -n64=$(grep -n "IDIV_BITSPERCYCLE" $WALLY/config/rv64gc/config.vh | cut -d: -f1) -n32=$(grep -n "IDIV_BITSPERCYCLE" $WALLY/config/rv32gc/config.vh | cut -d: -f1) -sed -i "${n64}s/IDIV_BITSPERCYCLE.*/IDIV_BITSPERCYCLE = 32;\'d2/" $WALLY/config/rv64gc/config.vh -sed -i "${n32}s/IDIV_BITSPERCYCLE.*/IDIV_BITSPERCYCLE = 32;\'d2/" $WALLY/config/rv32gc/config.vh +n64=$(grep -n "IDIV_BITSPERCYCLE =" $WALLY/config/rv64gc/config.vh | cut -d: -f1) +n32=$(grep -n "IDIV_BITSPERCYCLE =" $WALLY/config/rv32gc/config.vh | cut -d: -f1) +sed -i "${n64}s/IDIV_BITSPERCYCLE.*/IDIV_BITSPERCYCLE = 32\'d2;/" $WALLY/config/rv64gc/config.vh +sed -i "${n32}s/IDIV_BITSPERCYCLE.*/IDIV_BITSPERCYCLE = 32\'d2;/" $WALLY/config/rv32gc/config.vh } # IDIVBITS = 4 setIDIVBITSeq4 () { -n64=$(grep -n "IDIV_BITSPERCYCLE" $WALLY/config/rv64gc/config.vh | cut -d: -f1) -n32=$(grep -n "IDIV_BITSPERCYCLE" $WALLY/config/rv32gc/config.vh | cut -d: -f1) -sed -i "${n64}s/IDIV_BITSPERCYCLE.*/IDIV_BITSPERCYCLE = 32;\'d4/" $WALLY/config/rv64gc/config.vh -sed -i "${n32}s/IDIV_BITSPERCYCLE.*/IDIV_BITSPERCYCLE = 32;\'d4/" $WALLY/config/rv32gc/config.vh +n64=$(grep -n "IDIV_BITSPERCYCLE =" $WALLY/config/rv64gc/config.vh | cut -d: -f1) +n32=$(grep -n "IDIV_BITSPERCYCLE =" $WALLY/config/rv32gc/config.vh | cut -d: -f1) +sed -i "${n64}s/IDIV_BITSPERCYCLE.*/IDIV_BITSPERCYCLE = 32\'d4;/" $WALLY/config/rv64gc/config.vh +sed -i "${n32}s/IDIV_BITSPERCYCLE.*/IDIV_BITSPERCYCLE = 32\'d4;/" $WALLY/config/rv32gc/config.vh } # IDIV ON FPU @@ -159,12 +159,33 @@ writeCSV () { go() { +<< comment +setIDIVeq1 setKeq1 setRADIXeq4 -synthAll +synthFPDiv wait setKeq2 setRADIXeq2 -synthAll +synthFPDiv +wait +comment +setIDIVBITSeq1 +synthIntDiv +setIDIVBITSeq2 +synthIntDiv +setIDIVBITSeq4 +synthIntDiv +<< comment +setIDIVeq0 +setKeq1 +setRADIXeq4 +synthFPDiv +wait +setKeq2 +setRADIXeq2 +synthFPDiv +comment + } From 815af68298b666652b39cb64f57f2581405d2ba2 Mon Sep 17 00:00:00 2001 From: Kevin Kim Date: Thu, 26 Oct 2023 11:11:33 -0700 Subject: [PATCH 19/20] remove redundant logic --- src/fpu/divremsqrt/divremsqrtshiftcorrection.sv | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/fpu/divremsqrt/divremsqrtshiftcorrection.sv b/src/fpu/divremsqrt/divremsqrtshiftcorrection.sv index c03f1b5df..92b96fc3e 100644 --- a/src/fpu/divremsqrt/divremsqrtshiftcorrection.sv +++ b/src/fpu/divremsqrt/divremsqrtshiftcorrection.sv @@ -58,7 +58,7 @@ module divremsqrtshiftcorrection import cvw::*; #(parameter cvw_t P) ( // correct the shifting error caused by the LZA // - the only possible mantissa for a plus two is all zeroes // - a one has to propigate all the way through a sum. so we can leave the bottom statement alone - mux2 #(P.NORMSHIFTSZ-2) lzacorrmux(Shifted[P.NORMSHIFTSZ-3:0], Shifted[P.NORMSHIFTSZ-2:1], LZAPlus1, CorrSumShifted); + //mux2 #(P.NORMSHIFTSZ-2) lzacorrmux(Shifted[P.NORMSHIFTSZ-3:0], Shifted[P.NORMSHIFTSZ-2:1], LZAPlus1, CorrSumShifted); // correct the shifting of the divsqrt caused by producing a result in (2, .5] range // condition: if the msb is 1 or the exponent was one, but the shifted quotent was < 1 (Subnorm) @@ -70,7 +70,8 @@ module divremsqrtshiftcorrection import cvw::*; #(parameter cvw_t P) ( // if the result of the divider was calculated to be subnormal, then the result was correctly normalized, so select the top shifted bits always_comb //if(FmaOp) Mf = {CorrSumShifted, {P.CORRSHIFTSZ-(3*P.NF+4){1'b0}}}; - if (DivOp&~DivResSubnorm) Mf = CorrQmShifted; + //if (DivOp&~DivResSubnorm) Mf = CorrQmShifted; + if (~DivResSubnorm) Mf = CorrQmShifted; else Mf = Shifted[P.NORMSHIFTSZ-1:P.NORMSHIFTSZ-P.CORRSHIFTSZ]; // Determine sum's exponent From 26a29134ae4d472da44dd67540597a372cfcbe95 Mon Sep 17 00:00:00 2001 From: Kevin Kim Date: Thu, 26 Oct 2023 11:12:31 -0700 Subject: [PATCH 20/20] fp synth update --- synthDC/scripts/fp-synth.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/synthDC/scripts/fp-synth.sh b/synthDC/scripts/fp-synth.sh index 0344acb65..db7a6dc8d 100755 --- a/synthDC/scripts/fp-synth.sh +++ b/synthDC/scripts/fp-synth.sh @@ -188,4 +188,20 @@ synthFPDiv comment + + +} + +go2() { + +setIDIVeq1 +setRADIXeq4 +setKeq2 +synthFPDiv +wait +setRADIXeq2 +setKeq4 +synthFPDiv +wait + }