Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update fetch buffer branch from main #1087

Merged
merged 28 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
927398a
Fix SPI state skipping sck-cs delay when at end of transmission
naichewa Nov 7, 2024
7637f3e
Fix erroneous implicit sckcs and cssck phase delays
naichewa Nov 7, 2024
7964358
Fix erroneous implicit sckcs and cssck phase delays
naichewa Nov 7, 2024
24509ad
Merge branch 'openhwgroup:main' into main
naichewa Nov 7, 2024
987015a
Fix SPI Delay1 behavior
naichewa Nov 7, 2024
e59ca12
Merge branch 'main' of https://github.com/naichewa/cvw
naichewa Nov 7, 2024
e57473e
Fix minor typos in `src/fpu/postproc`
unaimillan Nov 7, 2024
18ddf1f
Revert "Enabling ZB and Zk extensions in coverage.svh of congif/rv32g…
davidharrishmc Nov 8, 2024
3943d07
Merge pull request #1076 from openhwgroup/revert-1065-Z_enable
jordancarlin Nov 8, 2024
83b07a0
enable show_c_prefix
Zain2050 Nov 8, 2024
5e217ce
Merge pull request #1077 from Zain2050/main
davidharrishmc Nov 8, 2024
adc9123
Merge pull request #1074 from unaimillan/fix/minor_typos
davidharrishmc Nov 8, 2024
2fe8c48
Don't clone QEMU submodules
jordancarlin Nov 8, 2024
78fbb06
Fixed Typo
coreyqh Nov 8, 2024
78bfa44
Merge pull request #1079 from coreyqh/dev
jordancarlin Nov 8, 2024
396a176
Fixed TransmitStart resetting SCK and delay counter while already cou…
naichewa Nov 8, 2024
515e05e
Merge branch 'openhwgroup:main' into main
naichewa Nov 8, 2024
3146f73
Merge pull request #1073 from naichewa/main
rosethompson Nov 8, 2024
425da11
Merge pull request #1078 from jordancarlin/qemu_install
rosethompson Nov 8, 2024
e4e266f
Fix GCC not updated when install script rerun
jordancarlin Nov 9, 2024
e829c80
Merge pull request #1080 from jordancarlin/fix_gcc_update
davidharrishmc Nov 9, 2024
80f3b94
Replace fixBinMem.c with objcopy
jordancarlin Nov 10, 2024
5bbaf2d
Remove bootmem.txt
jordancarlin Nov 10, 2024
43d0510
Pad linux raw testvectors before reversing
jordancarlin Nov 10, 2024
24af6bb
Merge branch 'main' of https://github.com/openhwgroup/cvw into linux_…
jordancarlin Nov 10, 2024
f597eb8
Merge pull request #1081 from jordancarlin/linux_tv_gen_cleanup
davidharrishmc Nov 10, 2024
c776ef3
enable assertions in Verilator
jordancarlin Nov 11, 2024
848c5fe
Merge pull request #1083 from jordancarlin/verilator_assertions
davidharrishmc Nov 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions bin/wally-tool-chain-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ cd "$RISCV"
# Temporarily pin riscv-gnu-toolchain to use GCC 13.2.0. GCC 14 does not work with the Q extension.
if git_check "riscv-gnu-toolchain" "https://github.com/riscv/riscv-gnu-toolchain" "$RISCV/riscv-gnu-toolchain/stamps/build-gcc-newlib-stage2"; then
cd "$RISCV"/riscv-gnu-toolchain
git reset --hard && git clean -f && git checkout master && git pull
git reset --hard && git clean -f && git checkout master && git pull && git submodule update
./configure --prefix="${RISCV}" --with-multilib-generator="rv32e-ilp32e--;rv32i-ilp32--;rv32im-ilp32--;rv32iac-ilp32--;rv32imac-ilp32--;rv32imafc-ilp32f--;rv32imafdc-ilp32d--;rv64i-lp64--;rv64ic-lp64--;rv64iac-lp64--;rv64imac-lp64--;rv64imafdc-lp64d--;rv64im-lp64--;"
make -j "${NUM_THREADS}" 2>&1 | logger $STATUS; [ "${PIPESTATUS[0]}" == 0 ]
if [ "$clean" ]; then
Expand Down Expand Up @@ -324,8 +324,7 @@ STATUS="qemu"
cd "$RISCV"
if git_check "qemu" "https://github.com/qemu/qemu" "$RISCV/include/qemu-plugin.h"; then
cd "$RISCV"/qemu
git reset --hard && git clean -f && git checkout master && git pull --recurse-submodules -j "${NUM_THREADS}"
git submodule update --init --recursive
git reset --hard && git clean -f && git checkout master && git pull
./configure --target-list=riscv64-softmmu --prefix="$RISCV"
make -j "${NUM_THREADS}" 2>&1 | logger $STATUS; [ "${PIPESTATUS[0]}" == 0 ]
make install 2>&1 | logger $STATUS; [ "${PIPESTATUS[0]}" == 0 ]
Expand Down
12 changes: 0 additions & 12 deletions config/rv32gc/coverage.svh
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@
`include "RV32M_coverage.svh"
`include "RV32F_coverage.svh"
`include "RV32D_coverage.svh"
`include "RV32Zba_coverage.svh"
`include "RV32Zbb_coverage.svh"
`include "RV32Zbc_coverage.svh"
`include "RV32Zbs_coverage.svh"
`include "RV32Zbkb_coverage.svh"
`include "RV32Zbkc_coverage.svh"
`include "RV32Zbkx_coverage.svh"
`include "RV32ZfaF_coverage.svh"
`include "RV32ZfaD_coverage.svh"
`include "RV32ZfaZfh_coverage.svh"
Expand All @@ -29,11 +22,6 @@
`include "RV32ZcbZbb_coverage.svh"
`include "RV32Zcf_coverage.svh"
`include "RV32Zcd_coverage.svh"
`include "RV32Zaamo_coverage.svh"
`include "RV32Zalrsc_coverage.svh"
`include "RV32Zknd_coverage.svh"
`include "RV32Zkne_coverage.svh"
`include "RV32Zknh_coverage.svh"

// Privileged extensions
`include "ZicsrM_coverage.svh"
Expand Down
1 change: 1 addition & 0 deletions config/rv32gc/imperas.ic
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@

--override no_pseudo_inst=T # For code coverage, don't produce pseudoinstructions

--override show_c_prefix=T # Show "c." with compressed instructions

# mcause and scause only have 4 lsbs of code and 1 msb of interrupt flag
#--override cpu/ecode_mask=0x8000000F # for RV32
Expand Down
23 changes: 2 additions & 21 deletions config/rv64gc/coverage.svh
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,9 @@
`include "RV64M_coverage.svh"
`include "RV64F_coverage.svh"
`include "RV64D_coverage.svh"
`include "RV64Zba_coverage.svh"
`include "RV64Zbb_coverage.svh"
`include "RV64Zbc_coverage.svh"
`include "RV64Zbs_coverage.svh"
`include "RV64Zbkb_coverage.svh"
`include "RV64Zbkc_coverage.svh"
`include "RV64Zbkx_coverage.svh"
`include "RV64ZfaF_coverage.svh"
`include "RV32ZfaD_coverage.svh"
`include "RV32ZfaZfh_coverage.svh"
`include "RV64ZfaD_coverage.svh"
`include "RV64ZfaZfh_coverage.svh"
`include "RV64ZfhD_coverage.svh"
`include "RV64Zfh_coverage.svh"
`include "RV64Zicond_coverage.svh"
Expand All @@ -29,18 +22,6 @@
`include "RV64ZcbZbb_coverage.svh"
`include "RV64ZcbZba_coverage.svh"
`include "RV64Zcd_coverage.svh"
`include "RV64Zaamo_coverage.svh"
`include "RV64Zalrsc_coverage.svh"
`include "RV64Zknd_coverage.svh"
`include "RV64Zkne_coverage.svh"
`include "RV64Zknh_coverage.svh"








// Privileged extensions
`include "RV64VM_coverage.svh"
Expand Down
3 changes: 3 additions & 0 deletions config/rv64gc/imperas.ic
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@
# For code coverage, don't produce pseudoinstructions
--override no_pseudo_inst=T

# Show "c." with compressed instructions
--override show_c_prefix=T

# nonratified mnosie register not implemented
--override cpu/mnoise_undefined=T

Expand Down
2 changes: 1 addition & 1 deletion linux/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ install: check_write_permissions check_environment

dumptvs: check_write_permissions check_environment
$(SUDO) mkdir -p $(RISCV)/linux-testvectors
cd testvector-generation; ./genInitMem.sh
./genInitMem.sh
@echo "Testvectors successfully generated."

generate: $(DTB) $(IMAGES)
Expand Down
12 changes: 0 additions & 12 deletions linux/bootmem.txt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,12 @@ echo "Launching QEMU in replay mode!"
-ex "q"

echo "Changing Endianness"
make fixBinMem
./fixBinMem "$rawRamFile" "$ramFile"
./fixBinMem "$rawBootmemFile" "$bootmemFile"
# Extend files to 8 byte multiple
truncate -s %8 "$rawRamFile"
truncate -s %8 "$rawBootmemFile"
# Reverse bytes
objcopy --reverse-bytes=8 -F binary "$rawRamFile" "$ramFile"
objcopy --reverse-bytes=8 -F binary "$rawBootmemFile" "$bootmemFile"
rm -f "$rawRamFile" "$rawBootmemFile" "$rawUntrimmedBootmemFile"

echo "genInitMem.sh completed!"
Expand Down
13 changes: 0 additions & 13 deletions linux/testvector-generation/Makefile

This file was deleted.

33 changes: 0 additions & 33 deletions linux/testvector-generation/fixBinMem.c

This file was deleted.

2 changes: 1 addition & 1 deletion sim/verilator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ SHELL := /bin/bash
.PHONY: profile run questa clean

# verilator configurations
OPT=
OPT=--assert
PARAMS?=--no-trace-top
NONPROF?=--stats
VERILATOR_DIR=${WALLY}/sim/verilator
Expand Down
4 changes: 2 additions & 2 deletions src/fpu/postproc/postprocess.sv
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ module postprocess import cvw::*; #(parameter cvw_t P) (
input logic [P.NE+1:0] FmaSe, // the sum's exponent
input logic [P.FMALEN-1:0] FmaSm, // the positive sum
input logic FmaASticky, // sticky bit that is calculated during alignment
input logic [$clog2(P.FMALEN+1)-1:0] FmaSCnt, // the normalization shift count
input logic [$clog2(P.FMALEN+1)-1:0] FmaSCnt, // the normalization shift count
//divide signals
input logic DivSticky, // divider sticky bit
input logic [P.NE+1:0] DivUe, // divsqrt exponent
input logic [P.DIVb:0] DivUm, // divsqrt significand
// conversion signals
input logic CvtCs, // the result's sign
input logic [P.NE:0] CvtCe, // the calculated expoent
input logic [P.NE:0] CvtCe, // the calculated exponent
input logic CvtResSubnormUf, // the convert result is subnormal or underflows
input logic [P.LOGCVTLEN-1:0] CvtShiftAmt, // how much to shift by
input logic ToInt, // is fp->int (since it's writting to the integer register)
Expand Down
76 changes: 29 additions & 47 deletions src/uncore/spi_controller.sv
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ module spi_controller (
logic ShiftEdgePulse;
logic SampleEdgePulse;
logic EndOfFramePulse;
logic PhaseOneOffset;

// Frame stuff
logic [3:0] BitNum;
Expand All @@ -93,6 +92,7 @@ module spi_controller (
logic [7:0] sckcs;
logic [7:0] intercs;
logic [7:0] interxfr;
logic Phase;

logic HasCSSCK;
logic HasSCKCS;
Expand All @@ -109,7 +109,6 @@ module spi_controller (

logic DelayIsNext;
logic DelayState;

// Convenient Delay Reg Names
assign cssck = Delay0[7:0];
assign sckcs = Delay0[15:8];
Expand Down Expand Up @@ -142,6 +141,7 @@ module spi_controller (

assign ContinueTransmit = ~TransmitFIFOEmpty & EndOfFrame;
assign EndTransmission = TransmitFIFOEmpty & EndOfFrame;
assign Phase = SckMode[0];

always_ff @(posedge PCLK) begin
if (~PRESETn) begin
Expand All @@ -152,7 +152,7 @@ module spi_controller (
DelayCounter <= 0;
end else begin
// SCK logic for delay times
if (TransmitStart) begin
if (TransmitStart & ~DelayState) begin
SCK <= 0;
end else if (SCLKenable) begin
SCK <= ~SCK;
Expand All @@ -161,19 +161,21 @@ module spi_controller (
// Counter for all four delay types
if (DelayState & SCK & SCLKenable) begin
DelayCounter <= DelayCounter + 8'd1;
end else if (SCLKenable & EndOfDelay) begin
end else if ((SCLKenable & EndOfDelay) | Transmitting) begin
DelayCounter <= 8'd0;
end

// SPICLK Logic
if (TransmitStart) begin

if (TransmitStart & ~DelayState) begin
SPICLK <= SckMode[1];
end else if (SCLKenable & Transmitting) begin
SPICLK <= (~EndTransmission & ~DelayIsNext) ? ~SPICLK : SckMode[1];
end else if (SCLKenable) begin
if (Phase & (NextState == TRANSMIT)) SPICLK <= (~EndTransmission & ~DelayIsNext) ? ~SPICLK : SckMode[1];
else if (Transmitting) SPICLK <= (~EndTransmission & ~DelayIsNext) ? ~SPICLK : SckMode[1];
end

// Reset divider
if (SCLKenable | TransmitStart | ResetSCLKenable) begin
if (SCLKenable | (TransmitStart & ~DelayState) | ResetSCLKenable) begin
DivCounter <= 12'b0;
end else begin
DivCounter <= DivCounter + 12'd1;
Expand Down Expand Up @@ -208,35 +210,18 @@ module spi_controller (
always_ff @(posedge ~PCLK) begin
if (~PRESETn | TransmitStart) begin
ShiftEdge <= 0;
PhaseOneOffset <= 0;
SampleEdge <= 0;
EndOfFrame <= 0;
end else begin
PhaseOneOffset <= (PhaseOneOffset == 0) ? Transmitting & SCLKenable : ~EndOfFrame;
case(SckMode)
2'b00: begin
ShiftEdge <= SPICLK & ShiftEdgePulse;
SampleEdge <= ~SPICLK & SampleEdgePulse;
EndOfFrame <= SPICLK & EndOfFramePulse;
end
2'b01: begin
ShiftEdge <= ~SPICLK & ShiftEdgePulse & PhaseOneOffset;
SampleEdge <= SPICLK & SampleEdgePulse;
EndOfFrame <= ~SPICLK & EndOfFramePulse;
end
2'b10: begin
end else if (^SckMode) begin
ShiftEdge <= ~SPICLK & ShiftEdgePulse;
SampleEdge <= SPICLK & SampleEdgePulse;
EndOfFrame <= ~SPICLK & EndOfFramePulse;
end
2'b11: begin
ShiftEdge <= SPICLK & ShiftEdgePulse & PhaseOneOffset;
end else begin
ShiftEdge <= SPICLK & ShiftEdgePulse;
SampleEdge <= ~SPICLK & SampleEdgePulse;
EndOfFrame <= SPICLK & EndOfFramePulse;
end
endcase
end
end
end
end

// Logic for continuing to transmit through Delay states after end of frame
assign NextEndDelay = NextState == SCKCS | NextState == INTERCS | NextState == INTERXFR;
Expand All @@ -263,33 +248,27 @@ module spi_controller (
TRANSMIT: begin // TRANSMIT case --------------------------------
case(CSMode)
AUTOMODE: begin
if (EndTransmission) NextState = INACTIVE;
else if (EndOfFrame) NextState = SCKCS;
if (EndTransmission & ~HasSCKCS) NextState = INACTIVE;
else if (EndOfFrame & HasSCKCS) NextState = SCKCS;
else if (EndOfFrame & ~HasSCKCS) NextState = INTERCS;
else NextState = TRANSMIT;
end
HOLDMODE: begin
if (EndTransmission) NextState = HOLD;
else if (ContinueTransmit & HasINTERXFR) NextState = INTERXFR;
if (EndOfFrame & HasINTERXFR) NextState = INTERXFR;
else if (EndTransmission) NextState = HOLD;
else NextState = TRANSMIT;
end
OFFMODE: begin
if (EndTransmission) NextState = INACTIVE;
else if (ContinueTransmit & HasINTERXFR) NextState = INTERXFR;
if (EndOfFrame & HasINTERXFR) NextState = INTERXFR;
else if (EndTransmission) NextState = HOLD;
else NextState = TRANSMIT;
end
default: NextState = TRANSMIT;
endcase
end
SCKCS: begin // SCKCS case --------------------------------------
if (EndOfSCKCS) begin
if (~TransmitRegLoaded) begin
// if (CSMode == AUTOMODE) NextState = INACTIVE;
if (CSMode == HOLDMODE) NextState = HOLD;
else NextState = INACTIVE;
end else begin
if (HasINTERCS) NextState = INTERCS;
else NextState = TRANSMIT;
end
NextState = INTERCS;
end else begin
NextState = SCKCS;
end
Expand All @@ -303,15 +282,18 @@ module spi_controller (
end
INTERCS: begin // INTERCS case ----------------------------------
if (EndOfINTERCS) begin
if (HasCSSCK) NextState = CSSCK;
else NextState = TRANSMIT;
if (TransmitRegLoaded) begin
if (HasCSSCK) NextState = CSSCK;
else NextState = TRANSMIT;
end else NextState = INACTIVE;
end else begin
NextState = INTERCS;
end
end
INTERXFR: begin // INTERXFR case --------------------------------
if (EndOfINTERXFR) begin
NextState = TRANSMIT;
if (TransmitRegLoaded) NextState = TRANSMIT;
else NextState = HOLD;
end else begin
NextState = INTERXFR;
end
Expand Down