mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-11 06:05:49 +00:00
Merging new changes into the old one's I've made in the OKstate servers
This commit is contained in:
commit
8e35701103
@ -34,10 +34,8 @@ module pmpadrdec (
|
|||||||
input logic [7:0] PMPCfg,
|
input logic [7:0] PMPCfg,
|
||||||
input logic [`XLEN-1:0] PMPAdr,
|
input logic [`XLEN-1:0] PMPAdr,
|
||||||
input logic PAgePMPAdrIn,
|
input logic PAgePMPAdrIn,
|
||||||
// input logic NoLowerMatchIn,
|
|
||||||
input logic FirstMatch,
|
input logic FirstMatch,
|
||||||
output logic PAgePMPAdrOut,
|
output logic PAgePMPAdrOut,
|
||||||
// output logic NoLowerMatchOut,
|
|
||||||
output logic Match, Active,
|
output logic Match, Active,
|
||||||
output logic L, X, W, R
|
output logic L, X, W, R
|
||||||
);
|
);
|
||||||
@ -48,7 +46,6 @@ module pmpadrdec (
|
|||||||
|
|
||||||
logic TORMatch, NAMatch;
|
logic TORMatch, NAMatch;
|
||||||
logic PAltPMPAdr;
|
logic PAltPMPAdr;
|
||||||
// logic FirstMatch;
|
|
||||||
logic [`PA_BITS-1:0] CurrentAdrFull;
|
logic [`PA_BITS-1:0] CurrentAdrFull;
|
||||||
logic [1:0] AdrMode;
|
logic [1:0] AdrMode;
|
||||||
|
|
||||||
@ -67,33 +64,15 @@ module pmpadrdec (
|
|||||||
assign TORMatch = PAgePMPAdrIn && PAltPMPAdr;
|
assign TORMatch = PAgePMPAdrIn && PAltPMPAdr;
|
||||||
|
|
||||||
// Naturally aligned regions
|
// Naturally aligned regions
|
||||||
logic [`PA_BITS-1:0] NAMask;
|
logic [`PA_BITS-1:0] NAMask, NABase;
|
||||||
//genvar i;
|
|
||||||
|
|
||||||
// create a mask of which bits to ignore
|
|
||||||
// generate
|
|
||||||
// assign Mask[1:0] = 2'b11;
|
|
||||||
// assign Mask[2] = (AdrMode == NAPOT); // mask has 0s in upper bis for NA4 region
|
|
||||||
// for (i=3; i < `PA_BITS; i=i+1) begin:mask
|
|
||||||
// assign Mask[i] = Mask[i-1] & PMPAdr[i-3]; // NAPOT mask: 1's indicate bits to ignore
|
|
||||||
// end
|
|
||||||
// endgenerate
|
|
||||||
|
|
||||||
assign NAMask[1:0] = {2'b11};
|
assign NAMask[1:0] = {2'b11};
|
||||||
|
assign NAMask[`PA_BITS-1:2] = (PMPAdr[`PA_BITS-3:0] + {{(`PA_BITS-3){1'b0}}, (AdrMode == NAPOT)}) ^ PMPAdr[`PA_BITS-3:0];
|
||||||
// *** BAD DELETE LATER ADDED for hopefully fixing synth
|
// generates a mask where the bottom k bits are 1, corresponding to a size of 2^k bytes for this memory region.
|
||||||
logic [`PA_BITS-3:0] maskInput;
|
// This assumes we're using at least an NA4 region, but works for any size NAPOT region.
|
||||||
|
assign NABase = {(PMPAdr[`PA_BITS-3:0] & ~NAMask[`PA_BITS-1:2]), 2'b00}; // base physical address of the pmp.
|
||||||
assign maskInput = 'd39; // *** added to really just try anything with the inputs of the thermometer.
|
|
||||||
|
assign NAMatch = &((NABase ~^ PhysicalAddress) | NAMask); // check if upper bits of base address match, ignore lower bits correspoonding to inside the memory range
|
||||||
// *** maskinput used to be {~PMPAdr[`PA_BITS-4:0], (AdrMode == NAPOT)}
|
|
||||||
// ****
|
|
||||||
|
|
||||||
prioritythemometer #(`PA_BITS-2) namaskgen(
|
|
||||||
.a(maskInput), // *** confusing bit bussing to match the logic for the inside of the thermometer.
|
|
||||||
.y(NAMask[`PA_BITS-1:2]));
|
|
||||||
|
|
||||||
assign NAMatch = &((PhysicalAddress ~^ CurrentAdrFull) | NAMask);
|
|
||||||
|
|
||||||
assign Match = (AdrMode == TOR) ? TORMatch :
|
assign Match = (AdrMode == TOR) ? TORMatch :
|
||||||
(AdrMode == NA4 || AdrMode == NAPOT) ? NAMatch :
|
(AdrMode == NA4 || AdrMode == NAPOT) ? NAMatch :
|
||||||
|
@ -54,8 +54,9 @@ module pmpchecker (
|
|||||||
|
|
||||||
// Bit i is high when the address falls in PMP region i
|
// Bit i is high when the address falls in PMP region i
|
||||||
logic EnforcePMP;
|
logic EnforcePMP;
|
||||||
logic [7:0] PMPCfg[`PMP_ENTRIES-1:0];
|
// logic [7:0] PMPCfg[`PMP_ENTRIES-1:0];
|
||||||
logic [`PMP_ENTRIES-1:0] Match, FirstMatch; // PMP Entry matches
|
logic [`PMP_ENTRIES-1:0] Match; // physical address matches one of the pmp ranges
|
||||||
|
logic [`PMP_ENTRIES-1:0] FirstMatch; // onehot encoding for the first pmpaddr to match the current address.
|
||||||
logic [`PMP_ENTRIES-1:0] Active; // PMP register i is non-null
|
logic [`PMP_ENTRIES-1:0] Active; // PMP register i is non-null
|
||||||
logic [`PMP_ENTRIES-1:0] L, X, W, R; // PMP matches and has flag set
|
logic [`PMP_ENTRIES-1:0] L, X, W, R; // PMP matches and has flag set
|
||||||
logic [`PMP_ENTRIES-1:0] PAgePMPAdr; // for TOR PMP matching, PhysicalAddress > PMPAdr[i]
|
logic [`PMP_ENTRIES-1:0] PAgePMPAdr; // for TOR PMP matching, PhysicalAddress > PMPAdr[i]
|
||||||
@ -69,7 +70,7 @@ module pmpchecker (
|
|||||||
.PAgePMPAdrOut(PAgePMPAdr),
|
.PAgePMPAdrOut(PAgePMPAdr),
|
||||||
.FirstMatch, .Match, .Active, .L, .X, .W, .R);
|
.FirstMatch, .Match, .Active, .L, .X, .W, .R);
|
||||||
|
|
||||||
priorityonehot #(`PMP_ENTRIES) pmppriority(.a(Match), .y(FirstMatch)); // Take the ripple gates/signals out of the pmpadrdec and into another unit.
|
priorityonehot #(`PMP_ENTRIES) pmppriority(.a(Match), .y(FirstMatch)); // combine the match signal from all the adress decoders to find the first one that matches.
|
||||||
|
|
||||||
// Only enforce PMP checking for S and U modes when at least one PMP is active or in Machine mode when L bit is set in selected region
|
// Only enforce PMP checking for S and U modes when at least one PMP is active or in Machine mode when L bit is set in selected region
|
||||||
assign EnforcePMP = (PrivilegeModeW == `M_MODE) ? |L : |Active;
|
assign EnforcePMP = (PrivilegeModeW == `M_MODE) ? |L : |Active;
|
||||||
|
@ -46,14 +46,14 @@ module testbench();
|
|||||||
|
|
||||||
string tests32mmu[] = '{
|
string tests32mmu[] = '{
|
||||||
"rv32mmu/WALLY-MMU-SV32", "3000"
|
"rv32mmu/WALLY-MMU-SV32", "3000"
|
||||||
//"rv32mmu/WALLY-PMA", "3000",
|
//"rv32mmu/WALLY-PMP", "3000",
|
||||||
//"rv32mmu/WALLY-PMA", "3000"
|
//"rv32mmu/WALLY-PMA", "3000"
|
||||||
};
|
};
|
||||||
|
|
||||||
string tests64mmu[] = '{
|
string tests64mmu[] = '{
|
||||||
"rv64mmu/WALLY-MMU-SV48", "3000",
|
"rv64mmu/WALLY-MMU-SV48", "3000",
|
||||||
"rv64mmu/WALLY-MMU-SV39", "3000"
|
"rv64mmu/WALLY-MMU-SV39", "3000",
|
||||||
//"rv64mmu/WALLY-PMA", "3000",
|
"rv64mmu/WALLY-PMP", "3000"
|
||||||
//"rv64mmu/WALLY-PMA", "3000"
|
//"rv64mmu/WALLY-PMA", "3000"
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -539,8 +539,8 @@ string tests32f[] = '{
|
|||||||
if (`F_SUPPORTED) tests = {tests64f, tests};
|
if (`F_SUPPORTED) tests = {tests64f, tests};
|
||||||
if (`D_SUPPORTED) tests = {tests64d, tests};
|
if (`D_SUPPORTED) tests = {tests64d, tests};
|
||||||
if (`MEM_VIRTMEM) tests = {tests64mmu, tests};
|
if (`MEM_VIRTMEM) tests = {tests64mmu, tests};
|
||||||
if (`A_SUPPORTED) tests = {tests64a, tests};
|
//if (`A_SUPPORTED) tests = {tests64a, tests};
|
||||||
if (`M_SUPPORTED) tests = {tests64m, tests};
|
//if (`M_SUPPORTED) tests = {tests64m, tests};
|
||||||
end
|
end
|
||||||
//tests = {tests64a, tests};
|
//tests = {tests64a, tests};
|
||||||
end else begin // RV32
|
end else begin // RV32
|
||||||
@ -676,7 +676,7 @@ string tests32f[] = '{
|
|||||||
errors = errors+1;
|
errors = errors+1;
|
||||||
$display(" Error on test %s result %d: adr = %h sim (D$) %h sim (TIM) = %h, signature = %h",
|
$display(" Error on test %s result %d: adr = %h sim (D$) %h sim (TIM) = %h, signature = %h",
|
||||||
tests[test], i, (testadr+i)*(`XLEN/8), DCacheFlushFSM.ShadowRAM[testadr+i], dut.uncore.dtim.RAM[testadr+i], signature[i]);
|
tests[test], i, (testadr+i)*(`XLEN/8), DCacheFlushFSM.ShadowRAM[testadr+i], dut.uncore.dtim.RAM[testadr+i], signature[i]);
|
||||||
$stop;//***debug
|
//$stop;//***debug
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user