Skip to content

Commit d02e8e6

Browse files
authored
Merge pull request #458 from paulusmack/fixes
Fixes for bugs found in dcache, loadstore1 and execute1.
2 parents a1624a5 + 84eebf5 commit d02e8e6

File tree

3 files changed

+24
-15
lines changed

3 files changed

+24
-15
lines changed

dcache.vhdl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,9 +1121,9 @@ begin
11211121
if r0.req.sync = '1' then
11221122
req_op_sync <= '1';
11231123
elsif r0.req.touch = '1' then
1124-
if access_ok = '1' and is_hit = '0' and nc = '0' then
1124+
if access_ok = '1' and (is_hit or hit_reload) = '0' and nc = '0' then
11251125
req_op_load_miss <= '1';
1126-
elsif access_ok = '1' and is_hit = '1' and nc = '0' then
1126+
elsif access_ok = '1' and (is_hit or hit_reload) = '1' and nc = '0' then
11271127
-- Make this OP_LOAD_HIT so the PLRU gets updated
11281128
req_op_load_hit <= '1';
11291129
else
@@ -1632,13 +1632,6 @@ begin
16321632
r1.reloading <= '1';
16331633
r1.write_tag <= '1';
16341634
ev.load_miss <= '1';
1635-
1636-
-- If this is a touch, complete the instruction
1637-
if req.touch = '1' then
1638-
r1.full <= '0';
1639-
r1.slow_valid <= '1';
1640-
r1.ls_valid <= '1';
1641-
end if;
16421635
else
16431636
r1.state <= NC_LOAD_WAIT_ACK;
16441637
end if;
@@ -1710,6 +1703,13 @@ begin
17101703
r1.wb.adr <= next_row_wb_addr(r1.wb.adr);
17111704
end if;
17121705

1706+
-- If this is a touch, complete the instruction
1707+
if r1.full = '1' and r1.req.touch = '1' then
1708+
r1.full <= '0';
1709+
r1.slow_valid <= '1';
1710+
r1.ls_valid <= '1';
1711+
end if;
1712+
17131713
-- Incoming acks processing
17141714
if wishbone_in.ack = '1' then
17151715
r1.rows_valid(to_integer(r1.store_row(ROW_LINEBITS-1 downto 0))) <= '1';

execute1.vhdl

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1442,8 +1442,8 @@ begin
14421442
if e_in.spr_select.ispmu = '0' then
14431443
case e_in.spr_select.sel is
14441444
when SPRSEL_LOGR =>
1445-
if e_in.insn(16) = '0' then
1446-
v.se.inc_loga := '1';
1445+
if e_in.insn(16) = '1' then
1446+
v.se.inc_loga := '1'; -- reading LOG_DATA
14471447
end if;
14481448
when others =>
14491449
end case;
@@ -1525,6 +1525,7 @@ begin
15251525
when SPRSEL_DEC =>
15261526
v.se.write_dec := '1';
15271527
when SPRSEL_LOGR =>
1528+
-- must be writing LOG_ADDR; LOG_DATA is readonly
15281529
v.se.write_loga := '1';
15291530
when SPRSEL_CFAR =>
15301531
v.se.write_cfar := '1';
@@ -1624,7 +1625,7 @@ begin
16241625
-- misaligned prefixed instructions, which has higher priority than
16251626
-- other facility unavailable interrupts.
16261627
v.exception := '1';
1627-
v.ic := x"b";
1628+
v.ic := std_ulogic_vector(to_unsigned(FSCR_PREFIX, 4));
16281629
v.e.intr_vec := 16#f60#;
16291630
v.se.write_ic := '1';
16301631

@@ -1666,23 +1667,23 @@ begin
16661667
ctrl.fscr_scv = '0' then
16671668
-- Facility unavailable for scv instruction
16681669
v.exception := '1';
1669-
v.ic := x"c";
1670+
v.ic := std_ulogic_vector(to_unsigned(FSCR_SCV, 4));
16701671
v.e.intr_vec := 16#f60#;
16711672
v.se.write_ic := '1';
16721673

16731674
elsif ex1.msr(MSR_PR) = '1' and e_in.uses_tar = '1' and
16741675
ctrl.fscr_tar = '0' then
16751676
-- Facility unavailable for TAR access
16761677
v.exception := '1';
1677-
v.ic := x"8";
1678+
v.ic := std_ulogic_vector(to_unsigned(FSCR_TAR, 4));
16781679
v.e.intr_vec := 16#f60#;
16791680
v.se.write_ic := '1';
16801681

16811682
elsif ex1.msr(MSR_PR) = '1' and e_in.uses_dscr = '1' and
16821683
ctrl.fscr_dscr = '0' then
16831684
-- Facility unavailable for DSCR access
16841685
v.exception := '1';
1685-
v.ic := x"2";
1686+
v.ic := std_ulogic_vector(to_unsigned(FSCR_DSCR, 4));
16861687
v.e.intr_vec := 16#f60#;
16871688
v.se.write_ic := '1';
16881689

@@ -1733,6 +1734,7 @@ begin
17331734
v.prefixed := e_in.prefixed;
17341735
v.insn := e_in.insn;
17351736
v.prefix := e_in.prefix;
1737+
v.advance_nia := '0';
17361738
end if;
17371739

17381740
lv := Execute1ToLoadstore1Init;

loadstore1.vhdl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -951,6 +951,13 @@ begin
951951
if r1.req.read_spr = '1' then
952952
v.addr0 := sprval;
953953
end if;
954+
-- tlbie has req.dc_req set in order to send the TLB probe to
955+
-- the dcache, but since there is no acknowledgement to wait for,
956+
-- clear req.dc_req so that loadstore1_3 completes when the MMU
957+
-- is finished.
958+
if r1.req.mmu_op = '1' then
959+
v.req.dc_req := '0';
960+
end if;
954961

955962
-- Work out load formatter controls for next cycle
956963
for i in 0 to 7 loop

0 commit comments

Comments
 (0)