Commit Graph

6486 Commits

Author SHA1 Message Date
Yinan Xu 2b8f5380ff
difftest: add a separate FileControl class (#495)
This allows users to create files at the generated-src directory by
default.
2024-11-08 14:36:30 +08:00
Zehao Liu 76f8b089ec
fix(xstrap): expand trapcode to 64bit (#494)
* All trap codes outside the enumeration range will be converted to `bad_trap`
2024-11-08 09:03:19 +08:00
Yinan Xu 81eb08c670
Fix the code style of streamToFile def (#493)
* add the missing `=`
2024-11-07 18:12:06 +08:00
Zehao Liu 4233651b64
fix(dbltrp): critical-error is not treated as diff error (#492)
* When both RTL and NEMU report a critical-error, the hardware behavior is considered correct.
  Upon detecting a critical-error, it should indicate a "good trap."
* If they do not report simultaneously, it results in a diff error and triggers an abort.
2024-11-05 13:56:16 +08:00
Zehao Liu 7c4bd5491a
feat(dbltrp): add support for critical-error (#486) 2024-10-31 15:55:25 +08:00
Kunlin You 85823ebb1c
Validate: update ArchRegState only when commit or event (#488)
When Squash enabled, previous squashed instrCommit may be submitted
with new-coming updated ArchRegState, which results in reg mismatch
with REF.

In difftest software side, we will only use ArchRegState when
instrCommit or event (progress = true in code), so we add
updateDependency for ArchRegState to ensure using corresponding ones
with squashed commits, just like we add for CSR before.
2024-10-30 13:33:25 +08:00
Florian Zaruba c1a64aec62
feat(ram): Add flat ELF loading capabilities (#485)
This adds the ELF format as an additional pre-loadable file format.
2024-10-29 15:49:10 +08:00
Kamimiao 2047043435
difftest: fix instances of generated Svh Interface (#487)
Previous in PR #483 we generate interface according to collected
instances by Gateway. However, these collected instances have
already been processed by Gateway and different from original.

To generated original interface, we use Instances from Jsonprofile
directly to avoid impact of Gateway optimization.

Also fix missing semicolon in instance assignment.

---------

Co-authored-by: klin02 <youkunlin20@mails.ucas.ac.cn>
2024-10-29 10:49:31 +08:00
Kamimiao 0f6d775593
difftest: generate Svh Interface between Cores and Difftest (#483)
Previous we can generate JsonProfile while building single-core DUT, and build multi-core Difftest Endpoint according to JsonProfile, which support replicating single-core ports for CHI.

To simplify connection between cores and difftest, this PR support generate Svh Interface, and then we can use generated interface directly when instantiating cores and difftest.

---------

Co-authored-by: klin02 <youkunlin20@mails.ucas.ac.cn>
2024-10-25 16:16:35 +08:00
Kamimiao ea3400c4ce
difftest: submit buffered data in Squash/Batch when timeout (#482)
When DUT has error and no longer commit instructions, previously
Difftest does not check buffered data in Squash/Batch, but report
Timeout and finish simulation. However, mismatched Diffstate in
buffered data may help Difftest check error reason.

This change support timeout check for Squash/Batch, when DUT does
not commit instructions for a long time, Difftest will flush
buffer, submit and check.

---------

Co-authored-by: klin02 <youkunlin20@mails.ucas.ac.cn>
2024-10-23 11:35:34 +08:00
Kunlin You 13b35e8b44
Batch: support data split to reduce transmission bubble (#477)
Previously, we view data collected from same cycle as a whole, end
batch assembling when step data longer than available space. It
results in bubble in transmission, and cannot handle situation when
step data longer than Max width in a single transmission.

This change support spliting step data according to collector,
appending part of data to output and updating remained to state.
To shorten logic length, we divide complex logic to three stage.

Spliting step data into two output can accept at most 2*MaxByteLen data.
However, when previous state contains data, remained space may 
be not enough for new-coming peak. So we support submit previous 
state ahead to leave space for peak.

Note step data may be splited to different batch func, and should be
read as a whole, so we avoid buffer-zone switch when batch enabled.
2024-10-16 17:21:27 +08:00
Zhaoyang You 150fff31d6
fix(csr): add support for mhpmevent overflow (#480)
* Count overflow only from hardware incrementes of counter registers
2024-10-11 18:30:19 +08:00
Tang Haojin e3cd34c349
fix(difftest): clear `dut->non_reg_interrupt_pending.valid` after event handling (#479) 2024-10-02 15:46:07 +08:00
linzhida fe7003c356 fix(trigger): Donot need implement tcontrol in XiangShan trigger anymore. 2024-09-30 15:03:24 +08:00
happy-lx ca4fce1867
Merge pull request #476 from OpenXiangShan/fix-cmo
When the DUT executes a cbo.inval, a set is used to record its cacheline address.
Later, if there is a data mismatch between DUT and GoldenMem in the address space operated by the cbo.inval instruction, the Pmem of REF and GoldenMem will be directly updated using the data of DUT.
2024-09-26 18:09:38 +08:00
happy-lx 233961e68a
feat(mem): add optional ref func `ref_memcpy_init` (#475)
When initializing REF's memory, call mem_init function.
If REF provides ref_memcpy_init, use it. If not, use ref_memcpy.
2024-09-25 19:18:01 +08:00
lixin 3493b3a405 fix(cmo): add cmo inval event 2024-09-25 16:08:50 +08:00
Kunlin You fbd72a2e71
Batch: pack Batch param to facilitate migration between DPIC/PCIe (#474)
To facilitate Batch migration between DPIC and PCIe, we pack Batch
param to an aligned array, and parse it inside software.

In transmission, we only need to pass single hardware data, as
svBitVecVal[] or uint8_t[], and then view it as generated struct in
software.

Note we put also step inside BatchInfo and call simv_nstep inside,
Step will be also exposed to Top all the time for Verilator and
Timeout Check.

We also add isFPGA to GatewayConfig and generate BYTELEN macro
for FPGA.

Co-authored-by: Kami <fengkehan@bosc.ac.cn>
2024-09-25 14:30:15 +08:00
Jiuyue Ma 4245818be8
Difftest: Use file API compatible with with Java8 (#467)
Signed-off-by: Liu Shan <liushan@bosc.ac.cn>
Co-authored-by: Liu Shan <liushan@bosc.ac.cn>
2024-09-14 16:03:06 +08:00
Jiuyue Ma 428551504a
palladium: Build DPILIB_EMU shared library as separated targets (#468)
To support difftest for projects that use their own palladium flow,
the build of DPILIB_EMU shared library should be moved to separated
target.

Signed-off-by: Liu Shan <liushan@bosc.ac.cn>
Signed-off-by: Jiuyue Ma <majiuyue@bosc.ac.cn>
Co-authored-by: Liu Shan <liushan@bosc.ac.cn>
2024-09-14 11:33:15 +08:00
Zhaoyang You 5ba8b1a8af
fix(csr): fix struct non-reg interrupt pending to order (#469)
Align the order with REF
2024-09-14 10:52:45 +08:00
Zhaoyang You d0c338cb42
fix(csr): add support non register interrupt pending (#465)
This PR adds support for non-register interrupts pending to
copy the interrupt to NEMU. The interrupts come from Count
overflow and Platform-Level Interrupt Controller such as PLIC,
CLINT, IMSIC. Thus, we could diff xip csr registers.
2024-09-14 10:02:15 +08:00
Yinan Xu a1b35f7fda
fix(config): allow 8GB memory as default for unknown CPUs (#466) 2024-09-13 23:35:20 +08:00
Haoyuan Feng ada5ab1bf2
feat(ram): Increase Memory Size to 8TB (#464) 2024-09-12 23:43:35 +08:00
Yinan Xu 3ac4e971bb
Makefile: remove unused DRAMsim3 macros (#463) 2024-09-10 15:58:54 +08:00
Kamimiao d4cf4839c4
difftest: automatically set the overwrite-size of new gpct (#460)
New versions of gcpt allow you to set oversize automatically.
If you don't specify size manually, gcpt will look for a size flag.
2024-09-06 20:42:01 +08:00
Zhaoyang You 8aff29bc32
fix(csr): add support virtual interrupt for hvictl csr injection (#457) 2024-09-05 11:12:52 +09:00
Yinan Xu e70768aedd
Update issue templates (#459) 2024-09-04 21:59:08 +09:00
lewislzh c66788be32
feat(Smrnmi): add support to raise non-maskable interrupt (#454) 2024-09-03 17:03:20 +09:00
Xu, Zefan abfdcdf4df
fix(l1tlb_check): correct the check for only VS stage (#452)
As a legacy issue of supporting Sv48, the default level of do_s2xlate when mode=0 is incorrect. Also, for only VS stage case (onlyS1), it should not do_s2xlate at all. This patch fixes these problems.
2024-08-28 21:42:01 +08:00
Yan Xu 2aa82c8ce5
misc: add argument --dramsim3-ini to set dramsim3 config file (#447) 2024-08-27 18:04:57 +08:00
Yinan Xu ac50550c05
emu: remove the sc_time_stamp function (#449) 2024-08-27 18:03:35 +08:00
Yinan Xu 0e1797920e
difftest: set valid to false when using dontCare (#448) 2024-08-27 16:31:42 +08:00
Yanqin Li 2d1ce405bd
l2tlb: add pbmt attribute checker for Svpbmt (#444) 2024-08-19 20:47:32 +08:00
Haoyuan Feng e7946f87fa
Difftest, mmu: Support Sv48 & Sv48x4 ptw check (#443)
Also refactor page table walker level:
previous (only support Sv39):
level 0 -> 1GB page
level 1 -> 2MB page
level 2 -> 4KB page
current (support Sv39, Sv48, and future extension)
Sv48 -> maxlevel = 3, Sv39 -> maxlevel = 2
level 3 -> 512GB page
level 2 -> 1GB page
level 1 -> 2MB page
level 0 -> 4KB page
2024-08-19 15:55:38 +08:00
Kamimiao b9da243c1e
Trace: support zstd compress/decompress (#439)
Add ZSTD support for streaming compress/decompress Difftest IOTrace. Enable by set IOTRACE_ZSTD=1.
2024-08-19 12:45:42 +08:00
Kunlin You e64c3e1a1d
Validate: recover needUpdate for TrapEvent (#440)
TrapEvent may not raise hasTrap when any other bundle valid, so we
recover needUpdate to mark there is valid TrapEvent at this cycle.

In validate, we use getValid to mark valid for single bundle, and
needUpdate to mark valid for this cycle. We will transmit trapEvent
when hasTrap, or other bundles valid.
2024-08-17 20:53:36 +08:00
Kunlin You 0661baa35e
Difftest: support compiled with Chisel6 and Chisel3 (#441)
To generate seperated sv files according to JsonProfile, we support
compile Difftest with Chisel. Enable by set MFC=1.
2024-08-17 17:05:09 +08:00
Kunlin You bf0640482a
Difftest: check timeout for both commit and step (#438)
Since difftest step function may not be called every cycle, we use
cycleCnt recorded in trapEvent instead of ticks, to check timeout
for Instr commits.

However, commit timeout will only be checked when difftest checks,
which is triggered by difftest_step. We also check if step is 0
for more than stuck_limit for both vcs and emu.
2024-08-13 14:58:47 +08:00
Kunlin You ed4eabb098
Difftest: always pass step to tb_top (#437)
Privious when InternalStep is defined, we pass difftest_step to
Batch DPIC instead of tb_top, thus putting transmission and
comparision together.

This change pass step to tb_top all the time, which can indicate
Difftest check triggered.
2024-08-13 12:32:35 +08:00
zhangyuxin 460164818f
difftest: support sim-jtag for VCS (#433) 2024-08-13 11:18:31 +08:00
Kunlin You 2a1e921c4e
Batch: reorder bundle elements to cluster transmitted Data (#407)
In Batch DPIC function, some signals, such as coreid/index/address,
will serves as buffer locating info, instead of actually transmitted.
So we cluster transmitted data to simplify Parsing logic.

Such problem is introdeced by new Hardware elements instanced by
DifftestBundle Trait, which results in Locate info mixed into
transmitted data.

To make byteAlign funtions compatible for both Hardware and Chisel
type, we use DataMirror to check bindings.
2024-08-12 11:43:53 +08:00
Kunlin You 82d740e720
Trace: support dump and load trace of difftest IOs (#432)
Trace module will dump trace of IOs between DUT and difftest.
With trace file and json profile, we can drive difftest without DUT,
which will speed up repeated simulation without DUT modification,
and support difftest modification and iteration.

Note we padding 100 trace at the end of traceFile when dumping, 
because when enable some features for acceleration, Difftest may 
finish comparision within some cycles after loading trace.

Since Delayer is now put in GatewayEndpoint, trace loaded outside,
we dump and load trace after Delayer to ensure data delayed only
once. Trace delayed can be seen as a whole, we can use some bundle 
with valid to validate others without valid. Dumping after Delayer can
reduce amounts of trace than before.

As VCS disallow use output port as dpic args directly, we add io_dummy
as intermediate val.

---------

Co-authored-by: xiaokamikami <fengkehan@bosc.ac.cn>
2024-08-10 22:14:02 +08:00
NewPaulWalker 790756c401
pc: compare the first instr pc of a commit group. (#434) 2024-08-10 21:28:00 +08:00
Kunlin You 6754de99e8
Makefile: fix typo in clang-format version notification (#435) 2024-08-09 11:59:47 +08:00
Kamimiao df3e227a59
difftest: Add an optional way to append to streamToFile (#431) 2024-07-31 18:16:20 +08:00
linzhida 917b33c0af difftest: support fcsr 2024-07-31 10:24:21 +08:00
Kunlin You 1a9435a75e
Validate: append valid to DifftestBundle(#406)
Previous we transmit all DiffState without hasValid when some
DiffState valid in same cycle. However, when Squash enabled, some
State without hasValid can be validated with special condition.
As Submit times of State with SquashQueue is much greater than
others, validated will greatly reduce submit times of Stata without
hasValid.

Previous we also use do_squash and squashDependency to filter invalid
CSR value. This change rename squashDependency to updateDependency,
and only validate CSR when commit and event. So we remove do_squash.

As Trapevent will also be checked for instrs Exceed, we transmit
it when validated, rather than just hasTrap or hasWFI.
2024-07-29 10:29:36 +08:00
Kunlin You 503f829ea8
difftest: support dump and rebuild by profile (#427)
In acclerated and multi-core verification cases, we need to adjust
or build Difftest's Hardware side seperately.

We use json to record Difftest apply and finish Info of DUT. Then
difftest can rebuild for single or multi cores according to Profile.
2024-07-19 19:26:19 +08:00
Zifei Zhang a45f7ed1b2
lightsss: let parent process kill the youger child (#429)
This commits avoid the execution of exit(0) for younger child
after wakeup, which makes the process hang after exit. Instead,
it lets the parent process kill the younger child before wakeup
the older one.

This fixes the hang case of the simulation process when the
simulation encounters errors with LightSSS enabled.

Co-authored-by: ZhangZifei <zhangzifei16@mails.ucas.ac.cn>
2024-07-19 19:21:20 +08:00