mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-11 06:05:49 +00:00
Merge branch 'openhwgroup:main' into main
This commit is contained in:
commit
5afe634da5
@ -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.
|
# 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
|
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
|
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--;"
|
./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 ]
|
make -j "${NUM_THREADS}" 2>&1 | logger $STATUS; [ "${PIPESTATUS[0]}" == 0 ]
|
||||||
if [ "$clean" ]; then
|
if [ "$clean" ]; then
|
||||||
@ -324,8 +324,7 @@ STATUS="qemu"
|
|||||||
cd "$RISCV"
|
cd "$RISCV"
|
||||||
if git_check "qemu" "https://github.com/qemu/qemu" "$RISCV/include/qemu-plugin.h"; then
|
if git_check "qemu" "https://github.com/qemu/qemu" "$RISCV/include/qemu-plugin.h"; then
|
||||||
cd "$RISCV"/qemu
|
cd "$RISCV"/qemu
|
||||||
git reset --hard && git clean -f && git checkout master && git pull --recurse-submodules -j "${NUM_THREADS}"
|
git reset --hard && git clean -f && git checkout master && git pull
|
||||||
git submodule update --init --recursive
|
|
||||||
./configure --target-list=riscv64-softmmu --prefix="$RISCV"
|
./configure --target-list=riscv64-softmmu --prefix="$RISCV"
|
||||||
make -j "${NUM_THREADS}" 2>&1 | logger $STATUS; [ "${PIPESTATUS[0]}" == 0 ]
|
make -j "${NUM_THREADS}" 2>&1 | logger $STATUS; [ "${PIPESTATUS[0]}" == 0 ]
|
||||||
make install 2>&1 | logger $STATUS; [ "${PIPESTATUS[0]}" == 0 ]
|
make install 2>&1 | logger $STATUS; [ "${PIPESTATUS[0]}" == 0 ]
|
||||||
|
@ -10,13 +10,6 @@
|
|||||||
`include "RV32M_coverage.svh"
|
`include "RV32M_coverage.svh"
|
||||||
`include "RV32F_coverage.svh"
|
`include "RV32F_coverage.svh"
|
||||||
`include "RV32D_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 "RV32ZfaF_coverage.svh"
|
||||||
`include "RV32ZfaD_coverage.svh"
|
`include "RV32ZfaD_coverage.svh"
|
||||||
`include "RV32ZfaZfh_coverage.svh"
|
`include "RV32ZfaZfh_coverage.svh"
|
||||||
@ -29,11 +22,6 @@
|
|||||||
`include "RV32ZcbZbb_coverage.svh"
|
`include "RV32ZcbZbb_coverage.svh"
|
||||||
`include "RV32Zcf_coverage.svh"
|
`include "RV32Zcf_coverage.svh"
|
||||||
`include "RV32Zcd_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
|
// Privileged extensions
|
||||||
`include "ZicsrM_coverage.svh"
|
`include "ZicsrM_coverage.svh"
|
||||||
|
@ -71,6 +71,7 @@
|
|||||||
|
|
||||||
--override no_pseudo_inst=T # For code coverage, don't produce pseudoinstructions
|
--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
|
# mcause and scause only have 4 lsbs of code and 1 msb of interrupt flag
|
||||||
#--override cpu/ecode_mask=0x8000000F # for RV32
|
#--override cpu/ecode_mask=0x8000000F # for RV32
|
||||||
|
@ -10,16 +10,9 @@
|
|||||||
`include "RV64M_coverage.svh"
|
`include "RV64M_coverage.svh"
|
||||||
`include "RV64F_coverage.svh"
|
`include "RV64F_coverage.svh"
|
||||||
`include "RV64D_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 "RV64ZfaF_coverage.svh"
|
||||||
`include "RV32ZfaD_coverage.svh"
|
`include "RV64ZfaD_coverage.svh"
|
||||||
`include "RV32ZfaZfh_coverage.svh"
|
`include "RV64ZfaZfh_coverage.svh"
|
||||||
`include "RV64ZfhD_coverage.svh"
|
`include "RV64ZfhD_coverage.svh"
|
||||||
`include "RV64Zfh_coverage.svh"
|
`include "RV64Zfh_coverage.svh"
|
||||||
`include "RV64Zicond_coverage.svh"
|
`include "RV64Zicond_coverage.svh"
|
||||||
@ -29,18 +22,6 @@
|
|||||||
`include "RV64ZcbZbb_coverage.svh"
|
`include "RV64ZcbZbb_coverage.svh"
|
||||||
`include "RV64ZcbZba_coverage.svh"
|
`include "RV64ZcbZba_coverage.svh"
|
||||||
`include "RV64Zcd_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
|
// Privileged extensions
|
||||||
`include "RV64VM_coverage.svh"
|
`include "RV64VM_coverage.svh"
|
||||||
|
@ -70,6 +70,9 @@
|
|||||||
# For code coverage, don't produce pseudoinstructions
|
# For code coverage, don't produce pseudoinstructions
|
||||||
--override no_pseudo_inst=T
|
--override no_pseudo_inst=T
|
||||||
|
|
||||||
|
# Show "c." with compressed instructions
|
||||||
|
--override show_c_prefix=T
|
||||||
|
|
||||||
# nonratified mnosie register not implemented
|
# nonratified mnosie register not implemented
|
||||||
--override cpu/mnoise_undefined=T
|
--override cpu/mnoise_undefined=T
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ install: check_write_permissions check_environment
|
|||||||
|
|
||||||
dumptvs: check_write_permissions check_environment
|
dumptvs: check_write_permissions check_environment
|
||||||
$(SUDO) mkdir -p $(RISCV)/linux-testvectors
|
$(SUDO) mkdir -p $(RISCV)/linux-testvectors
|
||||||
cd testvector-generation; ./genInitMem.sh
|
./genInitMem.sh
|
||||||
@echo "Testvectors successfully generated."
|
@echo "Testvectors successfully generated."
|
||||||
|
|
||||||
generate: $(DTB) $(IMAGES)
|
generate: $(DTB) $(IMAGES)
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
00001000: 00000297 auipc t0, 0 # t0 = 0x00001000
|
|
||||||
00001004: 02828613 addi a2, t0,0x28 # a2 = 0x00001028
|
|
||||||
00001008: f1402573 csrr a0, mhartid # a0 = mhartid
|
|
||||||
0000100c: 0202b583 ld a1, 32(t0) # a1 = 87000000 - device tree address
|
|
||||||
00001010: 0182b283 ld t0, 24(t0) # t0 = 80000000 - start of firmware
|
|
||||||
00001014: 00028067 jr t0 # jump to firmware
|
|
||||||
00001018: 0000000080000000 # firmware start address
|
|
||||||
00001020: 000000008fe00000 # flattened device tree load address
|
|
||||||
00001028: 000000004942534f # a2 points to this 8 dword data structure
|
|
||||||
00001030: 0000000000000002
|
|
||||||
00001038: 0000000080200000
|
|
||||||
00001040: 0000000000000001
|
|
@ -46,9 +46,12 @@ echo "Launching QEMU in replay mode!"
|
|||||||
-ex "q"
|
-ex "q"
|
||||||
|
|
||||||
echo "Changing Endianness"
|
echo "Changing Endianness"
|
||||||
make fixBinMem
|
# Extend files to 8 byte multiple
|
||||||
./fixBinMem "$rawRamFile" "$ramFile"
|
truncate -s %8 "$rawRamFile"
|
||||||
./fixBinMem "$rawBootmemFile" "$bootmemFile"
|
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"
|
rm -f "$rawRamFile" "$rawBootmemFile" "$rawUntrimmedBootmemFile"
|
||||||
|
|
||||||
echo "genInitMem.sh completed!"
|
echo "genInitMem.sh completed!"
|
@ -1,13 +0,0 @@
|
|||||||
SHELL = /bin/sh
|
|
||||||
|
|
||||||
CFLAG = -Wall -g
|
|
||||||
CC = gcc
|
|
||||||
|
|
||||||
all: fixBinMem
|
|
||||||
|
|
||||||
fixBinMem: fixBinMem.c
|
|
||||||
${CC} ${CFLAGS} fixBinMem.c -o fixBinMem
|
|
||||||
chmod +x fixBinMem
|
|
||||||
|
|
||||||
clean:
|
|
||||||
-rm -f fixBinMem
|
|
@ -1,33 +0,0 @@
|
|||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
int main(int argc, char *argv[]) {
|
|
||||||
if (argc < 3){
|
|
||||||
fprintf(stderr, "Expected 2 arguments: <raw GDB dump> <output binary>\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
char* rawGDBfilePath = argv[1];
|
|
||||||
FILE* rawGDBfile;
|
|
||||||
if ((rawGDBfile = fopen(rawGDBfilePath,"rb"))==NULL) {
|
|
||||||
fprintf(stderr, "File not found: %s\n",rawGDBfilePath);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
char* outFilePath = argv[2];
|
|
||||||
FILE* outFile = fopen(outFilePath,"w");
|
|
||||||
uint64_t qemuWord;
|
|
||||||
uint64_t verilogWord;
|
|
||||||
int bytesReturned=0;
|
|
||||||
do {
|
|
||||||
bytesReturned=fread(&qemuWord, 8, 1, rawGDBfile);
|
|
||||||
verilogWord = (((qemuWord>>0 )&0xff)<<56 |
|
|
||||||
((qemuWord>>8 )&0xff)<<48 |
|
|
||||||
((qemuWord>>16)&0xff)<<40 |
|
|
||||||
((qemuWord>>24)&0xff)<<32 |
|
|
||||||
((qemuWord>>32)&0xff)<<24 |
|
|
||||||
((qemuWord>>40)&0xff)<<16 |
|
|
||||||
((qemuWord>>48)&0xff)<<8 |
|
|
||||||
((qemuWord>>56)&0xff)<<0);
|
|
||||||
fwrite(&verilogWord, 8, 1, outFile);
|
|
||||||
} while(bytesReturned!=0);
|
|
||||||
return 0;
|
|
||||||
}
|
|
@ -6,7 +6,7 @@ SHELL := /bin/bash
|
|||||||
.PHONY: profile run questa clean
|
.PHONY: profile run questa clean
|
||||||
|
|
||||||
# verilator configurations
|
# verilator configurations
|
||||||
OPT=
|
OPT=--assert
|
||||||
PARAMS?=--no-trace-top
|
PARAMS?=--no-trace-top
|
||||||
NONPROF?=--stats
|
NONPROF?=--stats
|
||||||
VERILATOR_DIR=${WALLY}/sim/verilator
|
VERILATOR_DIR=${WALLY}/sim/verilator
|
||||||
|
@ -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.NE+1:0] FmaSe, // the sum's exponent
|
||||||
input logic [P.FMALEN-1:0] FmaSm, // the positive sum
|
input logic [P.FMALEN-1:0] FmaSm, // the positive sum
|
||||||
input logic FmaASticky, // sticky bit that is calculated during alignment
|
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
|
//divide signals
|
||||||
input logic DivSticky, // divider sticky bit
|
input logic DivSticky, // divider sticky bit
|
||||||
input logic [P.NE+1:0] DivUe, // divsqrt exponent
|
input logic [P.NE+1:0] DivUe, // divsqrt exponent
|
||||||
input logic [P.DIVb:0] DivUm, // divsqrt significand
|
input logic [P.DIVb:0] DivUm, // divsqrt significand
|
||||||
// conversion signals
|
// conversion signals
|
||||||
input logic CvtCs, // the result's sign
|
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 CvtResSubnormUf, // the convert result is subnormal or underflows
|
||||||
input logic [P.LOGCVTLEN-1:0] CvtShiftAmt, // how much to shift by
|
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)
|
input logic ToInt, // is fp->int (since it's writting to the integer register)
|
||||||
|
@ -75,7 +75,6 @@ module spi_controller (
|
|||||||
logic ShiftEdgePulse;
|
logic ShiftEdgePulse;
|
||||||
logic SampleEdgePulse;
|
logic SampleEdgePulse;
|
||||||
logic EndOfFramePulse;
|
logic EndOfFramePulse;
|
||||||
logic PhaseOneOffset;
|
|
||||||
|
|
||||||
// Frame stuff
|
// Frame stuff
|
||||||
logic [3:0] BitNum;
|
logic [3:0] BitNum;
|
||||||
@ -93,6 +92,7 @@ module spi_controller (
|
|||||||
logic [7:0] sckcs;
|
logic [7:0] sckcs;
|
||||||
logic [7:0] intercs;
|
logic [7:0] intercs;
|
||||||
logic [7:0] interxfr;
|
logic [7:0] interxfr;
|
||||||
|
logic Phase;
|
||||||
|
|
||||||
logic HasCSSCK;
|
logic HasCSSCK;
|
||||||
logic HasSCKCS;
|
logic HasSCKCS;
|
||||||
@ -109,7 +109,6 @@ module spi_controller (
|
|||||||
|
|
||||||
logic DelayIsNext;
|
logic DelayIsNext;
|
||||||
logic DelayState;
|
logic DelayState;
|
||||||
|
|
||||||
// Convenient Delay Reg Names
|
// Convenient Delay Reg Names
|
||||||
assign cssck = Delay0[7:0];
|
assign cssck = Delay0[7:0];
|
||||||
assign sckcs = Delay0[15:8];
|
assign sckcs = Delay0[15:8];
|
||||||
@ -142,6 +141,7 @@ module spi_controller (
|
|||||||
|
|
||||||
assign ContinueTransmit = ~TransmitFIFOEmpty & EndOfFrame;
|
assign ContinueTransmit = ~TransmitFIFOEmpty & EndOfFrame;
|
||||||
assign EndTransmission = TransmitFIFOEmpty & EndOfFrame;
|
assign EndTransmission = TransmitFIFOEmpty & EndOfFrame;
|
||||||
|
assign Phase = SckMode[0];
|
||||||
|
|
||||||
always_ff @(posedge PCLK) begin
|
always_ff @(posedge PCLK) begin
|
||||||
if (~PRESETn) begin
|
if (~PRESETn) begin
|
||||||
@ -152,7 +152,7 @@ module spi_controller (
|
|||||||
DelayCounter <= 0;
|
DelayCounter <= 0;
|
||||||
end else begin
|
end else begin
|
||||||
// SCK logic for delay times
|
// SCK logic for delay times
|
||||||
if (TransmitStart) begin
|
if (TransmitStart & ~DelayState) begin
|
||||||
SCK <= 0;
|
SCK <= 0;
|
||||||
end else if (SCLKenable) begin
|
end else if (SCLKenable) begin
|
||||||
SCK <= ~SCK;
|
SCK <= ~SCK;
|
||||||
@ -161,19 +161,21 @@ module spi_controller (
|
|||||||
// Counter for all four delay types
|
// Counter for all four delay types
|
||||||
if (DelayState & SCK & SCLKenable) begin
|
if (DelayState & SCK & SCLKenable) begin
|
||||||
DelayCounter <= DelayCounter + 8'd1;
|
DelayCounter <= DelayCounter + 8'd1;
|
||||||
end else if (SCLKenable & EndOfDelay) begin
|
end else if ((SCLKenable & EndOfDelay) | Transmitting) begin
|
||||||
DelayCounter <= 8'd0;
|
DelayCounter <= 8'd0;
|
||||||
end
|
end
|
||||||
|
|
||||||
// SPICLK Logic
|
// SPICLK Logic
|
||||||
if (TransmitStart) begin
|
|
||||||
|
if (TransmitStart & ~DelayState) begin
|
||||||
SPICLK <= SckMode[1];
|
SPICLK <= SckMode[1];
|
||||||
end else if (SCLKenable & Transmitting) begin
|
end else if (SCLKenable) begin
|
||||||
SPICLK <= (~EndTransmission & ~DelayIsNext) ? ~SPICLK : SckMode[1];
|
if (Phase & (NextState == TRANSMIT)) SPICLK <= (~EndTransmission & ~DelayIsNext) ? ~SPICLK : SckMode[1];
|
||||||
|
else if (Transmitting) SPICLK <= (~EndTransmission & ~DelayIsNext) ? ~SPICLK : SckMode[1];
|
||||||
end
|
end
|
||||||
|
|
||||||
// Reset divider
|
// Reset divider
|
||||||
if (SCLKenable | TransmitStart | ResetSCLKenable) begin
|
if (SCLKenable | (TransmitStart & ~DelayState) | ResetSCLKenable) begin
|
||||||
DivCounter <= 12'b0;
|
DivCounter <= 12'b0;
|
||||||
end else begin
|
end else begin
|
||||||
DivCounter <= DivCounter + 12'd1;
|
DivCounter <= DivCounter + 12'd1;
|
||||||
@ -208,35 +210,18 @@ module spi_controller (
|
|||||||
always_ff @(posedge ~PCLK) begin
|
always_ff @(posedge ~PCLK) begin
|
||||||
if (~PRESETn | TransmitStart) begin
|
if (~PRESETn | TransmitStart) begin
|
||||||
ShiftEdge <= 0;
|
ShiftEdge <= 0;
|
||||||
PhaseOneOffset <= 0;
|
|
||||||
SampleEdge <= 0;
|
SampleEdge <= 0;
|
||||||
EndOfFrame <= 0;
|
EndOfFrame <= 0;
|
||||||
end else begin
|
end else if (^SckMode) 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
|
|
||||||
ShiftEdge <= ~SPICLK & ShiftEdgePulse;
|
ShiftEdge <= ~SPICLK & ShiftEdgePulse;
|
||||||
SampleEdge <= SPICLK & SampleEdgePulse;
|
SampleEdge <= SPICLK & SampleEdgePulse;
|
||||||
EndOfFrame <= ~SPICLK & EndOfFramePulse;
|
EndOfFrame <= ~SPICLK & EndOfFramePulse;
|
||||||
end
|
end else begin
|
||||||
2'b11: begin
|
ShiftEdge <= SPICLK & ShiftEdgePulse;
|
||||||
ShiftEdge <= SPICLK & ShiftEdgePulse & PhaseOneOffset;
|
|
||||||
SampleEdge <= ~SPICLK & SampleEdgePulse;
|
SampleEdge <= ~SPICLK & SampleEdgePulse;
|
||||||
EndOfFrame <= SPICLK & EndOfFramePulse;
|
EndOfFrame <= SPICLK & EndOfFramePulse;
|
||||||
end
|
end
|
||||||
endcase
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
// Logic for continuing to transmit through Delay states after end of frame
|
// Logic for continuing to transmit through Delay states after end of frame
|
||||||
assign NextEndDelay = NextState == SCKCS | NextState == INTERCS | NextState == INTERXFR;
|
assign NextEndDelay = NextState == SCKCS | NextState == INTERCS | NextState == INTERXFR;
|
||||||
@ -263,18 +248,19 @@ module spi_controller (
|
|||||||
TRANSMIT: begin // TRANSMIT case --------------------------------
|
TRANSMIT: begin // TRANSMIT case --------------------------------
|
||||||
case(CSMode)
|
case(CSMode)
|
||||||
AUTOMODE: begin
|
AUTOMODE: begin
|
||||||
if (EndTransmission) NextState = INACTIVE;
|
if (EndTransmission & ~HasSCKCS) NextState = INACTIVE;
|
||||||
else if (EndOfFrame) NextState = SCKCS;
|
else if (EndOfFrame & HasSCKCS) NextState = SCKCS;
|
||||||
|
else if (EndOfFrame & ~HasSCKCS) NextState = INTERCS;
|
||||||
else NextState = TRANSMIT;
|
else NextState = TRANSMIT;
|
||||||
end
|
end
|
||||||
HOLDMODE: begin
|
HOLDMODE: begin
|
||||||
if (EndTransmission) NextState = HOLD;
|
if (EndOfFrame & HasINTERXFR) NextState = INTERXFR;
|
||||||
else if (ContinueTransmit & HasINTERXFR) NextState = INTERXFR;
|
else if (EndTransmission) NextState = HOLD;
|
||||||
else NextState = TRANSMIT;
|
else NextState = TRANSMIT;
|
||||||
end
|
end
|
||||||
OFFMODE: begin
|
OFFMODE: begin
|
||||||
if (EndTransmission) NextState = INACTIVE;
|
if (EndOfFrame & HasINTERXFR) NextState = INTERXFR;
|
||||||
else if (ContinueTransmit & HasINTERXFR) NextState = INTERXFR;
|
else if (EndTransmission) NextState = HOLD;
|
||||||
else NextState = TRANSMIT;
|
else NextState = TRANSMIT;
|
||||||
end
|
end
|
||||||
default: NextState = TRANSMIT;
|
default: NextState = TRANSMIT;
|
||||||
@ -282,14 +268,7 @@ module spi_controller (
|
|||||||
end
|
end
|
||||||
SCKCS: begin // SCKCS case --------------------------------------
|
SCKCS: begin // SCKCS case --------------------------------------
|
||||||
if (EndOfSCKCS) begin
|
if (EndOfSCKCS) begin
|
||||||
if (~TransmitRegLoaded) begin
|
NextState = INTERCS;
|
||||||
// if (CSMode == AUTOMODE) NextState = INACTIVE;
|
|
||||||
if (CSMode == HOLDMODE) NextState = HOLD;
|
|
||||||
else NextState = INACTIVE;
|
|
||||||
end else begin
|
|
||||||
if (HasINTERCS) NextState = INTERCS;
|
|
||||||
else NextState = TRANSMIT;
|
|
||||||
end
|
|
||||||
end else begin
|
end else begin
|
||||||
NextState = SCKCS;
|
NextState = SCKCS;
|
||||||
end
|
end
|
||||||
@ -303,15 +282,18 @@ module spi_controller (
|
|||||||
end
|
end
|
||||||
INTERCS: begin // INTERCS case ----------------------------------
|
INTERCS: begin // INTERCS case ----------------------------------
|
||||||
if (EndOfINTERCS) begin
|
if (EndOfINTERCS) begin
|
||||||
if (HasCSSCK) NextState = CSSCK;
|
if (TransmitRegLoaded) begin
|
||||||
else NextState = TRANSMIT;
|
if (HasCSSCK) NextState = CSSCK;
|
||||||
|
else NextState = TRANSMIT;
|
||||||
|
end else NextState = INACTIVE;
|
||||||
end else begin
|
end else begin
|
||||||
NextState = INTERCS;
|
NextState = INTERCS;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
INTERXFR: begin // INTERXFR case --------------------------------
|
INTERXFR: begin // INTERXFR case --------------------------------
|
||||||
if (EndOfINTERXFR) begin
|
if (EndOfINTERXFR) begin
|
||||||
NextState = TRANSMIT;
|
if (TransmitRegLoaded) NextState = TRANSMIT;
|
||||||
|
else NextState = HOLD;
|
||||||
end else begin
|
end else begin
|
||||||
NextState = INTERXFR;
|
NextState = INTERXFR;
|
||||||
end
|
end
|
||||||
|
@ -28,7 +28,7 @@ all: $(OBJDUMPS) $(MEMFILES)
|
|||||||
|
|
||||||
# Assemble into object files
|
# Assemble into object files
|
||||||
%.$(OBJEXT): %.$(AEXT)
|
%.$(OBJEXT): %.$(AEXT)
|
||||||
riscv64-unknown-elf-as -g -o $@ -march=rv64gqc_zfa_zba_zbb_zbc_zbs_zfh_zicboz_zicbop_zicbom_zbkb_zbkx_zknd_zkne_zknh -mabi=lp64 $<
|
riscv64-unknown-elf-as -g -o $@ -march=rv64gqc_zcb_zfa_zba_zbb_zbc_zbs_zfh_zicboz_zicbop_zicbom_zbkb_zbkx_zknd_zkne_zknh_svinval -mabi=lp64 $<
|
||||||
|
|
||||||
# Preprocess assembly files
|
# Preprocess assembly files
|
||||||
%.$(AEXT): %.$(SRCEXT) WALLY-init-lib.h
|
%.$(AEXT): %.$(SRCEXT) WALLY-init-lib.h
|
||||||
|
@ -38,6 +38,9 @@ main:
|
|||||||
csrrw t1, menvcfg, t0
|
csrrw t1, menvcfg, t0
|
||||||
csrrw t2, senvcfg, t0
|
csrrw t2, senvcfg, t0
|
||||||
|
|
||||||
|
# Test writing to TIME CSR
|
||||||
|
csrw time, zero
|
||||||
|
|
||||||
# testing FIOM with different privilege modes
|
# testing FIOM with different privilege modes
|
||||||
# setting environment config (to both 1 and 0) in each privilege mode
|
# setting environment config (to both 1 and 0) in each privilege mode
|
||||||
csrsi menvcfg, 1
|
csrsi menvcfg, 1
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
// fround.s
|
|
||||||
|
|
||||||
#include "WALLY-init-lib.h"
|
|
||||||
|
|
||||||
# run-elf.bash find this in project description
|
|
||||||
main:
|
|
||||||
|
|
||||||
bseti t0, zero, 14 # turn on FPU
|
|
||||||
csrs mstatus, t0
|
|
||||||
|
|
||||||
# test fround behavior on NaN
|
|
||||||
li t0, 0x7FC00001
|
|
||||||
fmv.w.x ft0, t0
|
|
||||||
fround.s ft1, ft0
|
|
||||||
j done
|
|
||||||
|
|
||||||
.align 10
|
|
||||||
data_start:
|
|
@ -81,6 +81,7 @@ main:
|
|||||||
.word 0xFF00302F // illegal Atomic instruction
|
.word 0xFF00302F // illegal Atomic instruction
|
||||||
.word 0xFF00402F // illegal Atomic instruction
|
.word 0xFF00402F // illegal Atomic instruction
|
||||||
.word 0x00000873 // illegal CSR instruction
|
.word 0x00000873 // illegal CSR instruction
|
||||||
|
.word 0x31bf1f93 // illegal aes64ksli1 instruction
|
||||||
|
|
||||||
# Illegal CMO instructions because envcfg is 0 and system is in user Mode
|
# Illegal CMO instructions because envcfg is 0 and system is in user Mode
|
||||||
li a0, 0
|
li a0, 0
|
||||||
|
@ -43,35 +43,23 @@ main:
|
|||||||
.hword 0x9C41 // line 134 Illegal compressed instruction
|
.hword 0x9C41 // line 134 Illegal compressed instruction
|
||||||
|
|
||||||
# Zcb coverage tests
|
# Zcb coverage tests
|
||||||
# could restore assembly language versions when GCC supports Zcb
|
|
||||||
mv s0, sp
|
mv s0, sp
|
||||||
#c.lbu s1, 0(s0) // exercise c.lbu
|
c.lbu s1, 0(s0) // exercise c.lbu
|
||||||
.hword 0x8004 // c.lbu s1, 0(s0)
|
c.lh s1, 0(s0) // exercise c.lh
|
||||||
#c.lh s1, 0(s0) // exercise c.lh
|
c.lhu s1, 0(s0) // exercise c.lhu
|
||||||
.hword 0x8444 // c.lh s1, 0(s0)
|
c.sb s1, 0(s0) // exercise c.sb
|
||||||
#c.lhu s1, 0(s0) // exercise c.lhu
|
c.sh s1, 0(s0) // exercise c.sh
|
||||||
.hword 0x8404 // c.lhu s1, 0(s0)
|
|
||||||
#c.sb s1, 0(s0) // exercise c.sb
|
|
||||||
.hword 0x8804 // c.sb s1, 0(s0)
|
|
||||||
#c.sh s1, 0(s0) // exercise c.sh
|
|
||||||
.hword 0x8C04 // c.sh s1, 0(s0)
|
|
||||||
|
|
||||||
.hword 0x8C44 // Illegal compressed instruction with op = 00, Instr[15:10] = 100011, Instr[6] = 1 and 0's everywhere else. Line 119 illegal instruction
|
.hword 0x8C44 // Illegal compressed instruction with op = 00, Instr[15:10] = 100011, Instr[6] = 1 and 0's everywhere else. Line 119 illegal instruction
|
||||||
.hword 0x9C00 // Illegal compressed instruction with op = 00, Instr[15:10] = 100111, and 0's everywhere else. Line 119 illegal instruction
|
.hword 0x9C00 // Illegal compressed instruction with op = 00, Instr[15:10] = 100111, and 0's everywhere else. Line 119 illegal instruction
|
||||||
|
|
||||||
li s0, 0xFF
|
li s0, 0xFF
|
||||||
# c.zext.b s0 // exercise c.zext.b
|
c.zext.b s0 // exercise c.zext.b
|
||||||
.hword 0x9C61 // c.zext.b s0
|
c.sext.b s0 // exercise c.sext.b
|
||||||
# c.sext.b s0 // exercise c.sext.b
|
c.zext.h s0 // exercise c.zext.h
|
||||||
.hword 0x9C65 // c.sext.b s0
|
c.sext.h s0 // exercise c.sext.h
|
||||||
# c.zext.h s0 // exercise c.zext.h
|
c.zext.w s0 // exercise c.zext.w
|
||||||
.hword 0x9C69 // c.zext.h s0
|
c.not s0 // exercise c.not
|
||||||
# c.sext.h s0 // exercise c.sext.h
|
|
||||||
.hword 0x9C6D // c.sext.h s0
|
|
||||||
# c.zext.w s0 // exercise c.zext.w
|
|
||||||
.hword 0x9C71 // c.zext.w s0
|
|
||||||
# c.not s0 // exercise c.not
|
|
||||||
.hword 0x9C75 // c.not s0
|
|
||||||
|
|
||||||
.hword 0x9C7D // Reserved instruction from line 187 with op = 01, Instr[15:10] = 100111, Instr[6:5] = 11, and 0's everywhere else
|
.hword 0x9C7D // Reserved instruction from line 187 with op = 01, Instr[15:10] = 100111, Instr[6:5] = 11, and 0's everywhere else
|
||||||
|
|
||||||
|
@ -304,7 +304,7 @@ sretdone:
|
|||||||
li a0, 3
|
li a0, 3
|
||||||
ecall
|
ecall
|
||||||
# exercise sfence.inval.ir instruction
|
# exercise sfence.inval.ir instruction
|
||||||
.word 0x18100073
|
sfence.inval.ir
|
||||||
|
|
||||||
# exercise sret with rs1 not 0
|
# exercise sret with rs1 not 0
|
||||||
.word 0x102F8073
|
.word 0x102F8073
|
||||||
|
Loading…
Reference in New Issue
Block a user