Merge branch 'main' of github.com:davidharrishmc/riscv-wally into main

This commit is contained in:
Ross Thompson 2022-11-03 17:36:04 -05:00
commit 1d7002e5c5
7 changed files with 44 additions and 13 deletions

View File

@ -123,7 +123,7 @@
`define FPDUR ((`DIVN+2+(`LOGR*`DIVCOPIES)-1)/(`LOGR*`DIVCOPIES)+(`RADIX/4))
`define DURLEN ($clog2(`FPDUR+1))
`define QLEN (`FPDUR*`LOGR*`DIVCOPIES)
`define DIVb (`FPDUR*`LOGR*`DIVCOPIES)-1
`define DIVb (`QLEN-1)
`define USE_SRAM 0

View File

@ -79,5 +79,8 @@ module fdivsqrt(
.X,.Dpreproc, .FirstWS(WS), .FirstWC(WC),
.DivStartE, .Xe(XeE), .Ye(YeE), .XZeroE, .YZeroE,
.DivBusy);
fdivsqrtpostproc fdivsqrtpostproc(.WS, .WC, .D, .FirstU, .FirstUM, .FirstC, .Firstun, .SqrtM, .SpecialCaseM, .QmM, .WZero, .DivSM);
fdivsqrtpostproc fdivsqrtpostproc(
.WS, .WC, .D, .FirstU, .FirstUM, .FirstC, .Firstun,
.SqrtM, .SpecialCaseM, .remOp(Funct3E[1]),
.QmM, .WZero, .DivSM);
endmodule

View File

@ -31,13 +31,14 @@
`include "wally-config.vh"
module fdivsqrtpostproc(
input logic [`DIVb+3:0] WS, WC,
input logic [`DIVN-2:0] D, // U0.N-1
input logic [`DIVb:0] FirstU, FirstUM,
input logic [`DIVb+1:0] FirstC,
input logic Firstun,
input logic SqrtM,
input logic SpecialCaseM,
input logic [`DIVb+3:0] WS, WC,
input logic [`DIVN-2:0] D, // U0.N-1
input logic [`DIVb:0] FirstU, FirstUM,
input logic [`DIVb+1:0] FirstC,
input logic Firstun,
input logic SqrtM,
input logic SpecialCaseM,
input logic remOp,
output logic [`DIVb:0] QmM,
output logic WZero,
output logic DivSM

View File

@ -53,15 +53,15 @@ module fdivsqrtpreproc (
logic [$clog2(`NF+2)-1:0] XZeroCnt, YZeroCnt;
logic [`NE+1:0] Qe;
// Intdiv signals
// logic [`DIVN-1:0] ZeroBufX, ZeroBufY; add after Cedar Commit
logic [`DIVN-1:0] ZeroBufX, ZeroBufY;
logic [`XLEN-1:0] PosA, PosB;
logic Signed, Aneg, Bneg;
// ***can probably merge X LZC with conversion
// cout the number of leading zeros
// Muxes needed for Int; add after Cedar Commit
// assign ZeroBufX = Int ? {ForwardedSrcAE, {`DIVN-`XLEN{1'b0}}} : {Xm, {`DIVN-`NF{1'b0}}};
// assign ZeroBufY = Int ? {ForwardedSrcBE, {`DIVN-`XLEN{1'b0}}} : {Ym, {`DIVN-`NF{1'b0}}};
assign ZeroBufX = MDUE ? {ForwardedSrcAE, {`DIVN-`XLEN{1'b0}}} : {Xm, {`DIVN-`NF-1{1'b0}}};
assign ZeroBufY = MDUE ? {ForwardedSrcBE, {`DIVN-`XLEN{1'b0}}} : {Ym, {`DIVN-`NF-1{1'b0}}};
lzc #(`NF+1) lzcX (Xm, XZeroCnt);
lzc #(`NF+1) lzcY (Ym, YZeroCnt);

View File

@ -71,5 +71,5 @@ module divshiftcalc(
assign DivDenormShiftAmt = DivDenormShiftPos ? DivDenormShift[`LOGNORMSHIFTSZ-1:0] : '0;
assign DivShiftAmt = DivResDenorm ? DivDenormShiftAmt : NormShift;
assign DivShiftIn = {{`NF{1'b0}}, DivQm, {`NORMSHIFTSZ-`DIVb+1-`NF{1'b0}}};
assign DivShiftIn = {{`NF{1'b0}}, DivQm, {`NORMSHIFTSZ-`DIVb-1-`NF{1'b0}}};
endmodule

View File

@ -1073,9 +1073,16 @@ uart_data_wait:
li a4, 0x61
uart_read_LSR_IIR:
lb t4, 0(t3) // save IIR before reading LSR mgith clear it
// check if t4 is the rxfifotime out interrupt if it is then read the fifo then go back and repeat this.
li t7, 6
beq t4, t7, uart_rxfifo_timout
lb t5, 0(t2) // read LSR
andi t6, t5, 0x61 // wait until all transmissions are done and data is ready
bne a4, t6, uart_read_LSR_IIR
uart_rxfifo_timout:
//read the fifo until empty
j uart_read_LSR_IIR
uart_data_ready:
li t2, 0

View File

@ -85,3 +85,23 @@ END_TESTS
TEST_STACK_AND_DATA
// in your isa
// first claim the plic's uart interrupt by reading the claim register corresponding to 10 on context 0.
// then you'll read all entires in the fifo.
// then you'll write the completed plic register to 10 on context 0.
// claim and completed have the same address.
// then you'll return by mret.
trap_handler:
// this will only get uart interrupts
li s0, plicBaseAddr
addi s0, s0, 0x200004 // claim offset
lw s1, 0(s0)
// check that s1 is 10 and not something else
// read uart rx fifo
// completed
sw s1, 0(s0) // tells the plic the isr is done.
mret