Skip to content

Commit

Permalink
SH7604: implemented undocumented registers in Division unit (Assault …
Browse files Browse the repository at this point in the history
…Suit Leynos 2 graphical glitches)
  • Loading branch information
srg320 committed Feb 12, 2024
1 parent b964cfc commit 2ddd2cd
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions rtl/SH/SH7604/DIVU.sv
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ module SH7604_DIVU (
DVDNT_t DVDNTL;
DVDNT_t DVDNTH;
DVCR_t DVCR;
DVDNT_t DVDNTL2;
DVDNT_t DVDNTH2;
VCRDIV_t VCRDIV;
bit BUSY;

Expand Down Expand Up @@ -157,6 +159,8 @@ module SH7604_DIVU (
end
5'h10: DVDNTH <= IBUS_DI & DVDNT_WMASK;
5'h14: DVDNTL <= IBUS_DI & DVDNT_WMASK;
5'h18: DVDNTH2 <= IBUS_DI & DVDNT_WMASK;
5'h1C: DVDNTL2 <= IBUS_DI & DVDNT_WMASK;
default:;
endcase
end
Expand All @@ -165,6 +169,8 @@ module SH7604_DIVU (
DVCR.OVF = OVF;
DVDNTL <= !OVF || DVCR.OVFIE ? Q : {DVDNTH[31]^DVSR[31],{31{~(DVDNTH[31]^DVSR[31])}}};
DVDNTH <= R[31:0];
DVDNTL2 <= !OVF || DVCR.OVFIE ? Q : {DVDNTH[31]^DVSR[31],{31{~(DVDNTH[31]^DVSR[31])}}};
DVDNTH2 <= R[31:0];
end
end
end
Expand All @@ -187,8 +193,8 @@ module SH7604_DIVU (
5'h0C: REG_DO <= {16'h0000,VCRDIV} & VCRDIV_RMASK;
5'h10: REG_DO <= DVDNTH & DVDNT_RMASK;
5'h14: REG_DO <= DVDNTL & DVDNT_RMASK;
5'h18: REG_DO <= DVDNTH & DVDNT_RMASK;
5'h1C: REG_DO <= DVDNTL & DVDNT_RMASK;
5'h18: REG_DO <= DVDNTH2 & DVDNT_RMASK;
5'h1C: REG_DO <= DVDNTL2 & DVDNT_RMASK;
default:REG_DO <= '0;
endcase
end
Expand Down

0 comments on commit 2ddd2cd

Please sign in to comment.