This commit separate IO, clock and reset out of XSNoCTop class.
Specifically, IO and basic clock/reset are moved to BaseXSSocImp base class.
The sync clock/reset (a.k.a. noc_, soc_) are moved to HasAsyncClockImp.
Signed-off-by: Jiuyue Ma <majiuyue@bosc.ac.cn>
* When there are multiple errors,`Mux1H` is equivalent to using `|`, for
example
* error 0, valid = 1, addr0 = 0x1000
* error 1, valid = 1, addr1 = 0x0ffff
* the result is `io.error.valid == 1`, but `io.error.bits.addr == (addr0
| addr1)`, cause `ParallelMux` will generate circuit like this:
```
addr = (valid0 ? addr0 : 'h0) |
(valid1 ? addr1 : 'h0)
```
* This problem can be avoided by using `ParallelPrioirtyMux`
* adjust `MainPipe` error priority to highest
EMU Test / Changes Detection (push) Waiting to runDetails
EMU Test / Generate Verilog (push) Blocked by required conditionsDetails
EMU Test / EMU - Basics (push) Blocked by required conditionsDetails
EMU Test / EMU - CHI (push) Blocked by required conditionsDetails
EMU Test / Docker Build (push) Blocked by required conditionsDetails
EMU Test / EMU - Performance (push) Blocked by required conditionsDetails
EMU Test / EMU - MC (push) Blocked by required conditionsDetails
EMU Test / SIMV - Basics (push) Blocked by required conditionsDetails
EMU Test / Upload Artifacts (push) Blocked by required conditionsDetails
EMU Test / Check Submodules (push) Blocked by required conditionsDetails
EMU Test / Check Format (push) Blocked by required conditionsDetails
Release Jobs / build-xsdev-image (push) Waiting to runDetails
The cmo (mainly zero) instructions require the mask to be set to 0xFFFF
(fully valid) in storeunit for forwarding and checking.
This has to do with the storequeue's forwarding mechanism, where the
storequeue passes through the mask to pre-pass data after an address
match.
For cmo instructions, the address will be matched by cacheline, so you
need to set mask all to 1.
Triggers include debug mode and breakpoint exceptions.
The breakpoint exception will be in the exceptionVec, so no additional
processing is required.
Whereas debug mode is encoded in the signal trigger, when the trigger is
set to debug mode, the processor should respond as if it were an
exception, except that it will go into debug mode instead of an
exception.
EMU Test / Changes Detection (push) Waiting to runDetails
EMU Test / Generate Verilog (push) Blocked by required conditionsDetails
EMU Test / EMU - Basics (push) Blocked by required conditionsDetails
EMU Test / EMU - CHI (push) Blocked by required conditionsDetails
EMU Test / Docker Build (push) Blocked by required conditionsDetails
EMU Test / EMU - Performance (push) Blocked by required conditionsDetails
EMU Test / EMU - MC (push) Blocked by required conditionsDetails
EMU Test / SIMV - Basics (push) Blocked by required conditionsDetails
EMU Test / Upload Artifacts (push) Blocked by required conditionsDetails
EMU Test / Check Submodules (push) Blocked by required conditionsDetails
EMU Test / Check Format (push) Blocked by required conditionsDetails
Release Jobs / build-xsdev-image (push) Waiting to runDetails
* Refactor `DFT` option passing method by `DFTOptionsKey`
* `DFX` and `DFTOptionsKey.EnableMbist` are related. e.g. `DFX=1` equal
to `DFTOptionsKey.EnableMbist=true`
* `SRAM_WITH_CTL` and `DFTOptionsKey.EnableSramCtl` are related. e.g.
`SRAM_WITH_CTL=1` equal to `DFTOptionsKey.EnableSramCtl=1`
* `DFTOptionsKey.EnableMbist=true` by default
**!!!Attention!!!**
* `EnableMbist=true` and `EnableSramCtl=true`: support
* `EnableMbist=true` and `EnableSramCtl=false`: support
* `EnableMbist=false` and `EnableSramCtl=true`: it needs bump latest
`Utility` for submodules, which references `Utility`
* `EnableMbist=false` and `EnableSramCtl=false`: support
The final result of both approaches is read-only 0, but in the former
case, ssstateen[1|2|3] will be optimized away during Verilog generation,
while in the latter case, it is preserved in the form shown in the
diagram below. This has no impact on the actual circuit.

EMU Test / Changes Detection (push) Waiting to runDetails
EMU Test / Generate Verilog (push) Blocked by required conditionsDetails
EMU Test / EMU - Basics (push) Blocked by required conditionsDetails
EMU Test / EMU - CHI (push) Blocked by required conditionsDetails
EMU Test / Docker Build (push) Blocked by required conditionsDetails
EMU Test / EMU - Performance (push) Blocked by required conditionsDetails
EMU Test / EMU - MC (push) Blocked by required conditionsDetails
EMU Test / SIMV - Basics (push) Blocked by required conditionsDetails
EMU Test / Upload Artifacts (push) Blocked by required conditionsDetails
EMU Test / Check Submodules (push) Blocked by required conditionsDetails
EMU Test / Check Format (push) Blocked by required conditionsDetails
Release Jobs / build-xsdev-image (push) Waiting to runDetails
Bug descritpions:
* When there is a cacheline with `B` permission in DCache, and the
`LoadPipe` execute `prefetch_w` requires BtoT, if there are 3 `BtoT`s in
`MissQueue` at this time, this miss will still enter `MissQueue`.
How to fix:
* When a `BtoT` request appears in `LoadPipe`, it is necessary to
confirm with `MissQueue` that the number of `BtoT` requests in the same
set is less than `nWays - 1(3)`.
EMU Test / Changes Detection (push) Has been cancelledDetails
Release Jobs / build-xsdev-image (push) Has been cancelledDetails
EMU Test / Generate Verilog (push) Has been cancelledDetails
EMU Test / EMU - Basics (push) Has been cancelledDetails
EMU Test / EMU - CHI (push) Has been cancelledDetails
EMU Test / Docker Build (push) Has been cancelledDetails
EMU Test / EMU - Performance (push) Has been cancelledDetails
EMU Test / EMU - MC (push) Has been cancelledDetails
EMU Test / SIMV - Basics (push) Has been cancelledDetails
EMU Test / Upload Artifacts (push) Has been cancelledDetails
EMU Test / Check Submodules (push) Has been cancelledDetails
EMU Test / Check Format (push) Has been cancelledDetails
Bug desciptions:
* when the request from `MissQueue` occur `BtoT` fail (in fact, the
request sent from `MissQueue` does not need to be check), `MainPipe`
will response a replay to sbuffer, at the same time, hit response will
sent to sbuffer too.
How to fix:
* In the case of `BtoT` fail, only requests from sbuffer are allowed to
return replay response.
This PR change stream prefetcher L2 distance from 128 to 256 blocks.
Since the latency from L2 to DDR is much higher in NoC scenarios, it is
necessary to increase the L2 prefetch distance of stream prefetcher to
ensure timeliness.
Use inherit instead of composite to reduce redundant IO port definitions
and connections. At the same time, we are able to keep the original
module name `XSTop` unchanged.
Signed-off-by: Jiuyue Ma <majiuyue@bosc.ac.cn>
- leave the source dependency tracking work to mill
- separate assembly and dest copy cmds to fix `make test-jar` output
Signed-off-by: Jiuyue Ma <majiuyue@bosc.ac.cn>
Bug descriptions:
When `MissQueue` refills data, ECC error injection occurs. The way where
the tag hits before the ECC error is injected (if any) should be
selected for replacement. However, `s1_need_replacement` does not take
this into account, resulting in the error tag reported to `BEU` being
the one selected by the replacer, rather than the tag corresponding to
the ECC error injection.
How to fix:
* In the `s1` stage of `MainPipe`, add a check to determine whether it
is in the ECC injection state. If so, it is necessary to determine
whether to compare with the non-injected tag, determine whether there is
a hit way, and select the hit way as the path corresponding to accessing
`BankedDataArray`.
* In the `s2` stage of `MainPipe`, by determining whether it is in the
ECC injection state and whether there is a hit way with a tag error, add
additional logic to indicate whether `replacement` or `eviction` really
needs to be processed.
EMU Test / Changes Detection (push) Waiting to runDetails
EMU Test / Generate Verilog (push) Blocked by required conditionsDetails
EMU Test / EMU - Basics (push) Blocked by required conditionsDetails
EMU Test / EMU - CHI (push) Blocked by required conditionsDetails
EMU Test / Docker Build (push) Blocked by required conditionsDetails
EMU Test / EMU - Performance (push) Blocked by required conditionsDetails
EMU Test / EMU - MC (push) Blocked by required conditionsDetails
EMU Test / SIMV - Basics (push) Blocked by required conditionsDetails
EMU Test / Upload Artifacts (push) Blocked by required conditionsDetails
EMU Test / Check Submodules (push) Blocked by required conditionsDetails
EMU Test / Check Format (push) Blocked by required conditionsDetails
Release Jobs / build-xsdev-image (push) Waiting to runDetails
fix: add safe protection according to the original semantics of WFI
* This fix tries to solve the unsafe scenario where the Core is in the
'WFI' state, but there
are still unfinished L2 transactions coming from IFU/MMU/LSU, which
violates the original
semantics of WFI. So, this protection was designed to guarantee that
there are no pending
requests to L2 before the Core enters the 'WFI' state.
* The BE (Backend) actively initiates the reqWfi=1 signal to notify the
IFU/MMU/LSU that the
Core wants to enter WFI.
* For IFU/MMU/LSU, when reqWfi=1, they stop sending all requests to L2.
After all pending
requests are completed, they send a safe=1 signal back to BE.
* If an interrupt occurs while BE is waiting for the safe signal, it
directly pulls reqWfi=0
to notify IFU/MMU/LSU that they do not need to enter the safe state, and
BE automatically ends.
At the same time, if IFU/MMU/LSU discover reqWfi=0 while waiting for
pending requests, they
remove the restriction on sending requests to L2 and pull the safe
signal low.
* The writeBack request from LSU to L2 is NOT included in this safe
handshake protocol, because
in the multi-core non-low-power WFI scenario, there may be a snoop from
another Core to the
'WFI' Core. In this case, this writeback channel should be ACTIVE to
respond to this snoop.
However, in the low-power 'WFI' state, the 'WFI' Core will exit
coherency before power down,
so there will be no this kind of snoop.
* To avoid timing iteration, each wfiSafe from ifu/mmu/lsu is registered
before send to BE
* Currently, this feature is fixed and verified by all regression tests
on PLDM
---------
Co-authored-by: chengguanghui <wissycgh@gmail.com>
Co-authored-by: ngc7331 <ngc7331@outlook.com>
Co-authored-by: sfencevma <15155930562@163.com>
Co-authored-by: good-circle <fenghaoyuan19@mails.ucas.ac.cn>
EMU Test / Changes Detection (push) Waiting to runDetails
EMU Test / Generate Verilog (push) Blocked by required conditionsDetails
EMU Test / EMU - Basics (push) Blocked by required conditionsDetails
EMU Test / EMU - CHI (push) Blocked by required conditionsDetails
EMU Test / Docker Build (push) Blocked by required conditionsDetails
EMU Test / EMU - Performance (push) Blocked by required conditionsDetails
EMU Test / EMU - MC (push) Blocked by required conditionsDetails
EMU Test / SIMV - Basics (push) Blocked by required conditionsDetails
EMU Test / Upload Artifacts (push) Blocked by required conditionsDetails
EMU Test / Check Submodules (push) Blocked by required conditionsDetails
EMU Test / Check Format (push) Blocked by required conditionsDetails
Release Jobs / build-xsdev-image (push) Waiting to runDetails
In this pr(https://github.com/OpenXiangShan/XiangShan/pull/4660), we
introduce additional logic for redirect on vector exceptions.
Previously, it was because, when `vecExceptionFlag` was high, we would
need to wait for `lastflow` deq, in order to clear `vecExceptionFlag`,
so we might need to prevent this one instruction from being flushed.
---
However, with the previous modification, when a vector store has not yet
deq, but needs to redirect itself, it will fail to cancel due to the use
of `isAfter`.
This leads to ptr exceptions in the storequeue, which can lead to
stuckness.
---
The solution, which has always been simple, is to prevent canceling
itself only when the exception's directive deqs, i.e., when
`vecExceptionFlag` is set.
According to the manual description, cbo instr (inval clean flush)
requires read permission but throws store exception.
Considering that NEMU has multiple commits for other content
modifications, I'll mention a separate bump NEMU pr
There are two independent SoC designs in XiangShan (a.k.a. `XSTop` and `XSNoCTop`),
each containing its own DTS generation logic. This PR merges them into common
base class `BaseXSSoc` and a specialized `HasDTSImp` trait, to prevent modifications
to this part from being missed in different designs.
---------
Signed-off-by: Jiuyue Ma <majiuyue@bosc.ac.cn>
EMU Test / Changes Detection (push) Waiting to runDetails
EMU Test / Generate Verilog (push) Blocked by required conditionsDetails
EMU Test / EMU - Basics (push) Blocked by required conditionsDetails
EMU Test / EMU - CHI (push) Blocked by required conditionsDetails
EMU Test / Docker Build (push) Blocked by required conditionsDetails
EMU Test / EMU - Performance (push) Blocked by required conditionsDetails
EMU Test / EMU - MC (push) Blocked by required conditionsDetails
EMU Test / SIMV - Basics (push) Blocked by required conditionsDetails
EMU Test / Upload Artifacts (push) Blocked by required conditionsDetails
EMU Test / Check Submodules (push) Blocked by required conditionsDetails
EMU Test / Check Format (push) Blocked by required conditionsDetails
Release Jobs / build-xsdev-image (push) Waiting to runDetails
Bump nemu ref in ready-to-run
* NEMU commit:afd738be8ddcbe0c772a3a0658e48a735d54690b
* NEMU configs:
* riscv64-xs-ref_defconfig
* riscv64-dual-xs-ref_defconfig
* riscv64-xs-ref-debug_defconfig
* riscv64-dual-xs-ref-debug_defconfig
* riscv64-xs-ref_bitmap_defconfig
Including:
* fix(cbo): cbo requires read permission but throws store exception
* fix(xtopi): when csrr xtopi, the old value of xtopi is read in some
case
* fix(xtopei): when csrrw xtopei, the old value of xtopei is read
* fix(xtopi,difftest): update m/stopi when sync aia
* fix(csr): mask the 0, 4 and 8 interrupt number of m/siprios
**Bug Trigger:** In a self-modifying program, the program modifies its
own instructions in a region where PBMT=NC and PMA=MM. If difftest is
skipped in this case, NEMU will not execute the corresponding memory
access instruction. This causes NEMU and DUT to execute different
instructions later on, ultimately leading to an error.
**Solution:** For regions where PBMT=NC and PMA=MM, difftest should not
be skipped, since PMA=MM indicates that NEMU can perform normal
synchronization. However, for regions with PMA=IO, difftest should still
be skipped because NEMU might not be able to access the corresponding
devices. Instruction self-modification in PMA=IO regions is generally
not a concern, as such regions are typically non-writable. Therefore,
synchronization of self-modifying IO instructions is not handled here
(as doing so would be overly complex).
EMU Test / Changes Detection (push) Waiting to runDetails
EMU Test / Generate Verilog (push) Blocked by required conditionsDetails
EMU Test / EMU - Basics (push) Blocked by required conditionsDetails
EMU Test / EMU - CHI (push) Blocked by required conditionsDetails
EMU Test / Docker Build (push) Blocked by required conditionsDetails
EMU Test / EMU - Performance (push) Blocked by required conditionsDetails
EMU Test / EMU - MC (push) Blocked by required conditionsDetails
EMU Test / SIMV - Basics (push) Blocked by required conditionsDetails
EMU Test / Upload Artifacts (push) Blocked by required conditionsDetails
EMU Test / Check Submodules (push) Blocked by required conditionsDetails
EMU Test / Check Format (push) Blocked by required conditionsDetails
Release Jobs / build-xsdev-image (push) Waiting to runDetails
### Bug Description
The NC store does not handle exceptions properly. When an exception
occurs during its execution, the store queue (SQ) continues to process
it as if it were a normal nc store—this includes committing it and
sending it to the uncache—resulting in an invalid memory access.
### Bug Analysis
In the current SQ design, for regular stores, both `rdataPtr` and
`deqPtr` advance based on handshakes with `dataBuffer` and `SBuffer`,
respectively. Thus, even if an exception occurs, the store is marked as
`committed = true` and passed into both buffers. If an exception is
detected at the `SBuffer`, the actual write is skipped.
For NC stores, the `committed` logic is reused from regular stores.
However, there is no dedicated handling for exceptional cases in the
later pipeline stages—such as preventing handshake with the `UBuffer`,
or allowing the handshake but skipping the write. This fix adopts the
former approach: **NC stores will not perform a handshake with the
`UBuffer` when an exception is detected**, in order to preserve a clean
and consistent `UBuffer` interface.
### Solution
* NC stores continue to be marked as `committed = true`.
* Only when `!completed(rptr0) && allvalid(rptr0) &&
!hasException(rptr0)` is satisfied, the NC store is allowed to enter the
`UBuffer`.
* If the instruction causes an exception, the backend will flush it and
all subsequent instructions.
* When the flushed instruction reaches the NC store entry in the store
queue, `completed` is set to `true`.
* For `deqPtr`, since `deqPtr` advances based on the `completed` signal,
no additional changes are needed.
* For `rdataPtr`, behavior remains unchanged for regular stores, but for
NC stores, advancement is now triggered by `completed` instead of
`ncReadNextTrigger`.
EMU Test / Changes Detection (push) Waiting to runDetails
EMU Test / Generate Verilog (push) Blocked by required conditionsDetails
EMU Test / EMU - Basics (push) Blocked by required conditionsDetails
EMU Test / EMU - CHI (push) Blocked by required conditionsDetails
EMU Test / Docker Build (push) Blocked by required conditionsDetails
EMU Test / EMU - Performance (push) Blocked by required conditionsDetails
EMU Test / EMU - MC (push) Blocked by required conditionsDetails
EMU Test / SIMV - Basics (push) Blocked by required conditionsDetails
EMU Test / Upload Artifacts (push) Blocked by required conditionsDetails
EMU Test / Check Submodules (push) Blocked by required conditionsDetails
EMU Test / Check Format (push) Blocked by required conditionsDetails
Release Jobs / build-xsdev-image (push) Waiting to runDetails
In this pr #4673, we set `fullva` incorrectly. `fullva` will be
overridden by `tlb.resp.bits.fullva` again in a later stage.
So we should set `fullva` in `s1_out` instead of `s0_out`.
**Bug Trigger:** When the data responsed by `Uncache` is 0x0013 xxxx
xxxx xxxx, the selected data handled by `LoadQueueUncache` is `0x0000
0000 0000 0013` in which case that `raddr(2, 0)` is 0b110 and
`LSUOpType` is `lhu`. And this data is what we want. However it is then
processed by the LoadUnit again with the same process and a new data
`0x0000 0000 0000 0013` is obtained, which is error.
So here needs to return origin data which will be selected in LoadUnit.
When the L2 TLB returns a PTW result to L1 TLB, if virtualization is
enabled (including onlyS1, onlyS2, and allStage modes), then even when a
huge page is accessed, only one entry in valididx(i) is marked as true.
During the refill of the L1 TLB into TLBStorage, in the case of large
pages, all valididx(i) entries should be manually set to true to ensure
proper hit matching during subsequent lookups.
However, in the previous design, this handling was only applied to
address translations in onlyS2 mode. In fact, regardless of which
virtualization translation mode is active, if a large page is accessed,
all valididx(i) entries should be set to true. This commit fixes the
bug.
* add [m|h|s]stateen[1|2|3] CSRs.
* only reset mstateen[0|1|2|3] when init.
* Bits in any stateen CSR that are defined to control state that a hart doesn’t implement are read-only zeros
for that hart.
Only if there are no exceptions, cbozero is allowed to set the status
bits inside the storequeue and write back through the storequeue.
When there is an exception, write back directly through storeunit.
This commit makes the following changes:
1. Resets the CSRs introduced by the Smstateen extension, mstateen0, hstateen0, and sstateen0 to 0, and sets the CSRIND bit as writable.
2. Adds xireg2 to xireg6 introduced by the Smcsrind extension.
3. Implements the permission checks required when the Smaia, Smstateen, and Smcsrind extensions are all present.
EMU Test / Changes Detection (push) Has been cancelledDetails
Release Jobs / build-xsdev-image (push) Has been cancelledDetails
EMU Test / Generate Verilog (push) Has been cancelledDetails
EMU Test / EMU - Basics (push) Has been cancelledDetails
EMU Test / EMU - CHI (push) Has been cancelledDetails
EMU Test / Docker Build (push) Has been cancelledDetails
EMU Test / EMU - Performance (push) Has been cancelledDetails
EMU Test / EMU - MC (push) Has been cancelledDetails
EMU Test / SIMV - Basics (push) Has been cancelledDetails
EMU Test / Upload Artifacts (push) Has been cancelledDetails
EMU Test / Check Submodules (push) Has been cancelledDetails
EMU Test / Check Format (push) Has been cancelledDetails
Many variables in XiangShan Makefile can be overridden from command
line. Without forwarding these to docker, commands executed in the
container may produce unexpected results due to variable mismatches.
Signed-off-by: Jiuyue Ma <majiuyue@bosc.ac.cn>
EMU Test / Changes Detection (push) Waiting to runDetails
EMU Test / Generate Verilog (push) Blocked by required conditionsDetails
EMU Test / EMU - Basics (push) Blocked by required conditionsDetails
EMU Test / EMU - CHI (push) Blocked by required conditionsDetails
EMU Test / Docker Build (push) Blocked by required conditionsDetails
EMU Test / EMU - Performance (push) Blocked by required conditionsDetails
EMU Test / EMU - MC (push) Blocked by required conditionsDetails
EMU Test / SIMV - Basics (push) Blocked by required conditionsDetails
EMU Test / Upload Artifacts (push) Blocked by required conditionsDetails
EMU Test / Check Submodules (push) Blocked by required conditionsDetails
EMU Test / Check Format (push) Blocked by required conditionsDetails
Release Jobs / build-xsdev-image (push) Waiting to runDetails
When the vector store that raised the exception is written back to the
backend, the StoreQueue is too late to set the corresponding entries to
`committed`, resulting in the `redirect` flush them, which results in
the `vecExceptionFlag` being asserted due to the timeout not being
cleared.