Skip to content

Commit

Permalink
finding pmp error
Browse files Browse the repository at this point in the history
  • Loading branch information
gullahmed1 committed Sep 8, 2023
1 parent eb3c612 commit e7d4a53
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions core/pmp/src/pmp_entry.sv
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ module pmp_entry #(
logic [PLEN-1:0] base;
logic [PLEN-1:0] mask;
int unsigned size;
assign conf_addr_n = {{$bits(conf_addr_n)-$bits(conf_addr_i){1'b0}},~conf_addr_i};
assign conf_addr_n = ~conf_addr_i;
lzc #(.WIDTH(PLEN), .MODE(1'b0)) i_lzc(
.in_i ( conf_addr_n ),
.cnt_o ( trail_ones ),
Expand All @@ -48,15 +48,15 @@ module pmp_entry #(
size = '0;
// check that the requested address is in between the two
// configuration addresses
if (addr_i >= (conf_addr_prev_i << 2) && addr_i < (conf_addr_i << 2)) begin
if (addr_i >= ({{PLEN-PMP_LEN{1'b0}},conf_addr_prev_i} << 2) && addr_i < ({{PLEN-PMP_LEN{1'b0}},conf_addr_i} << 2)) begin
match_o = 1'b1;
end else match_o = 1'b0;

// synthesis translate_off
if (match_o == 0) begin
assert(addr_i >= (conf_addr_i << 2) || addr_i < (conf_addr_prev_i << 2));
assert(addr_i >= ({{PLEN-PMP_LEN{1'b0}},conf_addr_i} << 2) || addr_i < ({{PLEN-PMP_LEN{1'b0}},conf_addr_prev_i} << 2));
end else begin
assert(addr_i < (conf_addr_i << 2) && addr_i >= (conf_addr_prev_i << 2));
assert(addr_i < ({{PLEN-PMP_LEN{1'b0}},conf_addr_i} << 2) && addr_i >= ({{PLEN-PMP_LEN{1'b0}},conf_addr_prev_i} << 2));
end
// synthesis translate_on

Expand All @@ -66,11 +66,11 @@ module pmp_entry #(
if (conf_addr_mode_i == riscv::NA4) size = 2;
else begin
// use the extracted trailing ones
size = trail_ones+3;
size = {{32-$bits(trail_ones){1'b0}},trail_ones}+3;

This comment has been minimized.

Copy link
@fatimasaleem

fatimasaleem Sep 9, 2023

Collaborator

could be simplify

This comment has been minimized.

Copy link
@gullahmed1

gullahmed1 Sep 12, 2023

Author Collaborator

Discussion required

end

mask = '1 << size;
base = (conf_addr_i << 2) & mask;
base = ({{PLEN-PMP_LEN{1'b0}},conf_addr_i} << 2) & mask;
match_o = (addr_i & mask) == base ? 1'b1 : 1'b0;

// synthesis translate_off
Expand Down

0 comments on commit e7d4a53

Please sign in to comment.