Better solution to the integer divider interrupt interaction.

This commit is contained in:
Ross Thompson 2022-01-12 14:22:18 -06:00
parent e5262b80a6
commit e06fb923a1
4 changed files with 6 additions and 5 deletions

View File

@ -36,6 +36,7 @@ module intdivrestoring (
input logic clk, input logic clk,
input logic reset, input logic reset,
input logic StallM, input logic StallM,
input logic TrapM,
input logic DivSignedE, W64E, input logic DivSignedE, W64E,
input logic DivE, input logic DivE,
//input logic [`XLEN-1:0] SrcAE, SrcBE, //input logic [`XLEN-1:0] SrcAE, SrcBE,
@ -116,7 +117,7 @@ module intdivrestoring (
////////////////////////////// //////////////////////////////
always_ff @(posedge clk) always_ff @(posedge clk)
if (reset) begin if (reset | TrapM) begin
state <= IDLE; state <= IDLE;
end else if (DivStartE) begin end else if (DivStartE) begin
step <= 1; step <= 1;

View File

@ -43,7 +43,7 @@ module muldiv (
output logic DivBusyE, output logic DivBusyE,
output logic DivE, output logic DivE,
// hazards // hazards
input logic StallM, StallW, FlushM, FlushW input logic StallM, StallW, FlushM, FlushW, TrapM
); );
logic [`XLEN-1:0] MDUResultM; logic [`XLEN-1:0] MDUResultM;
@ -61,7 +61,7 @@ module muldiv (
// Start a divide when a new division instruction is received and the divider isn't already busy or finishing // Start a divide when a new division instruction is received and the divider isn't already busy or finishing
assign DivE = MDUE & Funct3E[2]; assign DivE = MDUE & Funct3E[2];
assign DivSignedE = ~Funct3E[0]; assign DivSignedE = ~Funct3E[0];
intdivrestoring div(.clk, .reset, .StallM, .DivSignedE, .W64E, .DivE, intdivrestoring div(.clk, .reset, .StallM, .TrapM, .DivSignedE, .W64E, .DivE,
.ForwardedSrcAE, .ForwardedSrcBE, .DivBusyE, .QuotM, .RemM); .ForwardedSrcAE, .ForwardedSrcBE, .DivBusyE, .QuotM, .RemM);
// Result multiplexer // Result multiplexer

View File

@ -71,7 +71,7 @@ module trap (
assign SIntGlobalEnM = (PrivilegeModeW == `U_MODE) | ((PrivilegeModeW == `S_MODE) & STATUS_SIE); // if in lower priv mode, or if S ints enabled and not in higher priv mode 3.1.9 assign SIntGlobalEnM = (PrivilegeModeW == `U_MODE) | ((PrivilegeModeW == `S_MODE) & STATUS_SIE); // if in lower priv mode, or if S ints enabled and not in higher priv mode 3.1.9
assign PendingIntsM = ((MIP_REGW & MIE_REGW) & ({12{MIntGlobalEnM}} & 12'h888)) | ((SIP_REGW & SIE_REGW) & ({12{SIntGlobalEnM}} & 12'h222)); assign PendingIntsM = ((MIP_REGW & MIE_REGW) & ({12{MIntGlobalEnM}} & 12'h888)) | ((SIP_REGW & SIE_REGW) & ({12{SIntGlobalEnM}} & 12'h222));
assign PendingInterruptM = (|PendingIntsM) & InstrValidM; assign PendingInterruptM = (|PendingIntsM) & InstrValidM;
assign InterruptM = PendingInterruptM & ~(CommittedM | DivE); // *** RT. temporary hack to prevent integer division from having an interrupt during divide. assign InterruptM = PendingInterruptM & ~(CommittedM); // *** RT. temporary hack to prevent integer division from having an interrupt during divide.
// ideally this should be disabled for all but the first cycle. However I'm not familar with the internals of the integer divider. This should (could) be an issue for // ideally this should be disabled for all but the first cycle. However I'm not familar with the internals of the integer divider. This should (could) be an issue for
// floating point and integer multiply. // floating point and integer multiply.
//assign ExceptionM = TrapM; //assign ExceptionM = TrapM;

View File

@ -358,7 +358,7 @@ module wallypipelinedhart (
.ForwardedSrcAE, .ForwardedSrcBE, .ForwardedSrcAE, .ForwardedSrcBE,
.Funct3E, .Funct3M, .MDUE, .W64E, .Funct3E, .Funct3M, .MDUE, .W64E,
.MDUResultW, .DivBusyE, .DivE, .MDUResultW, .DivBusyE, .DivE,
.StallM, .StallW, .FlushM, .FlushW .StallM, .StallW, .FlushM, .FlushW, .TrapM
); );
end else begin // no M instructions supported end else begin // no M instructions supported
assign MDUResultW = 0; assign MDUResultW = 0;