vclean working; started removing unused signals

This commit is contained in:
David Harris 2023-01-07 05:34:58 -08:00
parent cf103f2588
commit cdcee61aac
5 changed files with 37 additions and 9 deletions

36
bin/vclean.pl Normal file → Executable file
View File

@ -5,7 +5,41 @@
# Identifies unused signals in Verilog files # Identifies unused signals in Verilog files
# verilator should do this, but it also reports partially used signals # verilator should do this, but it also reports partially used signals
use strict;
for (my $i=0; $i<=$#ARGV; $i++) { for (my $i=0; $i<=$#ARGV; $i++) {
my $fname = $ARGV[$i]; my $fname = $ARGV[$i];
printf ("$fname\n"); &clean($fname);
}
sub clean {
my $fname = shift;
# printf ("Cleaning $fname\n");
open(FILE, $fname) || die("Can't read $fname");
# my $incomment = 0;
my @allsigs;
while (<FILE>) {
if (/typedef/) { } # skip typedefs
elsif (/logic (.*)/) { # found signal declarations
my $siglist = $1;
$siglist =~ s/\/\/.*//; # trim off everything after //
# print ("Logic: $siglist\n");
$siglist =~ s/\[[^\]]*\]//g; # trim off everything in brackets
$siglist =~ s/\s//g; # trim off white space
# print ("Logic Trimmed: $siglist\n");
my @sigs = split(/[,;)]/, $siglist);
# print ("Logic parsed: @sigs\n");
push(@allsigs, @sigs);
}
}
# print("Signals: @allsigs\n");
foreach my $sig (@allsigs) {
# print("Searching for $sig\n");
my $hits = `grep -c $sig $fname`;
# print(" Signal $sig appears $hits times\n");
if ($hits < 2) {
printf("$sig not used in $fname\n");
}
}
} }

View File

@ -164,7 +164,6 @@ module cache #(parameter LINELEN, NUMLINES, NUMWAYS, LOGBWPL, WORDLEN, MUXINTE
end end
assign FetchBufferByteSel = SetValid & ~SetDirty ? '1 : ~DemuxedByteMask; // If load miss set all muxes to 1. assign FetchBufferByteSel = SetValid & ~SetDirty ? '1 : ~DemuxedByteMask; // If load miss set all muxes to 1.
logic [LINELEN/8-1:0] LineByteMask2;
assign LineByteMask = SetValid ? '1 : SetDirty ? DemuxedByteMask : '0; assign LineByteMask = SetValid ? '1 : SetDirty ? DemuxedByteMask : '0;
for(index = 0; index < LINELEN/8; index++) begin for(index = 0; index < LINELEN/8; index++) begin

View File

@ -90,12 +90,10 @@ module ebu
logic LSUHWRITEOut; logic LSUHWRITEOut;
logic IFUReq, LSUReq; logic IFUReq, LSUReq;
logic IFUActive, LSUActive;
logic BeatCntEn; logic BeatCntEn;
logic [4-1:0] NextBeatCount, BeatCount, BeatCountDelayed; logic [4-1:0] NextBeatCount, BeatCount;
logic FinalBeat, FinalBeatD; logic FinalBeat, FinalBeatD;
logic [2:0] LocalBurstType;
logic CntReset; logic CntReset;
logic [3:0] Threshold; logic [3:0] Threshold;
logic IFUReqD; logic IFUReqD;
@ -164,8 +162,6 @@ module ebu
assign FinalBeat = (BeatCount == Threshold); // Detect when we are waiting on the final access. assign FinalBeat = (BeatCount == Threshold); // Detect when we are waiting on the final access.
assign BeatCntEn = (NextState == ARBITRATE & HREADY); assign BeatCntEn = (NextState == ARBITRATE & HREADY);
logic [2:0] HBURSTD;
// Used to store data from data phase of AHB. // Used to store data from data phase of AHB.
flopenr #(1) flopenr #(1)
FinalBeatReg(.clk(HCLK), FinalBeatReg(.clk(HCLK),

View File

@ -39,7 +39,6 @@ module fcvt (
input logic [2:0] OpCtrl, // choose which opperation (look below for values) input logic [2:0] OpCtrl, // choose which opperation (look below for values)
input logic ToInt, // is fp->int (since it's writting to the integer register) input logic ToInt, // is fp->int (since it's writting to the integer register)
input logic XZero, // is the input zero input logic XZero, // is the input zero
input logic XSubnorm, // is the input Subnormalized
input logic [`FMTBITS-1:0] Fmt, // the input's precision (11=quad 01=double 00=single 10=half) input logic [`FMTBITS-1:0] Fmt, // the input's precision (11=quad 01=double 00=single 10=half)
output logic [`NE:0] Ce, // the calculated expoent output logic [`NE:0] Ce, // the calculated expoent
output logic [`LOGCVTLEN-1:0] ShiftAmt, // how much to shift by output logic [`LOGCVTLEN-1:0] ShiftAmt, // how much to shift by

View File

@ -290,7 +290,7 @@ module fpu (
// convert // convert
// - fcvt.*.* // - fcvt.*.*
fcvt fcvt (.Xs(XsE), .Xe(XeE), .Xm(XmE), .Int(ForwardedSrcAE), .OpCtrl(OpCtrlE), fcvt fcvt (.Xs(XsE), .Xe(XeE), .Xm(XmE), .Int(ForwardedSrcAE), .OpCtrl(OpCtrlE),
.ToInt(FWriteIntE), .XZero(XZeroE), .XSubnorm(XSubnormE), .Fmt(FmtE), .Ce(CeE), .ToInt(FWriteIntE), .XZero(XZeroE), .Fmt(FmtE), .Ce(CeE),
.ShiftAmt(CvtShiftAmtE), .ResSubnormUf(CvtResSubnormUfE), .Cs(CsE), .IntZero(IntZeroE), .ShiftAmt(CvtShiftAmtE), .ResSubnormUf(CvtResSubnormUfE), .Cs(CsE), .IntZero(IntZeroE),
.LzcIn(CvtLzcInE)); .LzcIn(CvtLzcInE));