-
Notifications
You must be signed in to change notification settings - Fork 972
Instruction Tracing #3071
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
JeanRochCoulon
merged 25 commits into
openhwgroup:master
from
ThalesSiliconSecurity:instruction-tracing
Nov 28, 2025
Merged
Instruction Tracing #3071
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
caa3d31
cva6_iti: fix iret value and itype type
MaxCThales cc2db8d
ITI: refactor, new feature, integration
MaxCThales 5edfd31
Encoder: simplification and integration
MaxCThales 4a88990
Encapsulator: integration
MaxCThales 281e924
DPTI: integration, slicer, dpti_clk
MaxCThales cc3b42f
Receiver & Decapsuler: integration
MaxCThales f6396f0
Add README & CI Test
MaxCThales 111c13a
fix cva6_rvfi csr issue
MaxCThales be405f4
add headers
MaxCThales dc5328c
correction for CI
MaxCThales 021a84d
remove unused files for submodule integration
MaxCThales 652c053
missing header and dpti license
MaxCThales 7fd2aa3
fix g++ version error
MaxCThales 98755ed
add instr tracing in tutorials
MaxCThales 977e51e
Apply 2 suggestion(s) to 1 file(s)
MaxCThales 80e11de
Merge remote-tracking branch 'origin/master' into instruction-tracing
Gchauvon 46cf1ac
Fix typo and not defined signals
Gchauvon 14a65ac
Do not apply verible on cva6_rvfi.sv
JeanRochCoulon 0c81893
Edit verible.yml
JeanRochCoulon 966f116
Edit verible.yml
JeanRochCoulon e6123e7
Edit verible.yml
JeanRochCoulon 7f0ac3f
Merge branch 'master' into instruction-tracing
JeanRochCoulon 523988b
Update verible.yml
JeanRochCoulon 63b70c9
Update cva6_rvfi.sv
JeanRochCoulon 0dc7452
Update verible.yml
JeanRochCoulon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -164,7 +164,7 @@ module cva6_rvfi | |||||||
| assign branch_valid_iti = instr.branch_valid; | ||||||||
| assign is_taken_iti = instr.is_taken; | ||||||||
| assign tval_iti = instr.tval; | ||||||||
| assign time_iti = rvfi_probes_i.csr.cycle_q; | ||||||||
| assign time_iti = csr.cycle_q; | ||||||||
|
|
||||||||
| assign priv_lvl = instr.priv_lvl; | ||||||||
|
|
||||||||
|
|
@@ -369,113 +369,111 @@ module cva6_rvfi | |||||||
| //---------------------------------------------------------------------------------------------------------- | ||||||||
| // CSR | ||||||||
| //---------------------------------------------------------------------------------------------------------- | ||||||||
|
|
||||||||
| `define CONNECT_RVFI_FULL(CSR_ENABLE_COND, CSR_NAME, | ||||||||
| CSR_SOURCE_NAME) \ | ||||||||
| always_ff @(posedge clk_i) begin \ | ||||||||
| if (CSR_ENABLE_COND) begin \ | ||||||||
| rvfi_csr_o.``CSR_NAME``.rdata <= {{CVA6Cfg.XLEN - $bits(CSR_SOURCE_NAME)}, CSR_SOURCE_NAME}; \ | ||||||||
| end \ | ||||||||
| end \ | ||||||||
| assign rvfi_csr_o.``CSR_NAME``.wdata = CSR_ENABLE_COND ? { {{CVA6Cfg.XLEN-$bits(CSR_SOURCE_NAME)}, CSR_SOURCE_NAME} } : 0; \ | ||||||||
| assign rvfi_csr_o.``CSR_NAME``.rmask = CSR_ENABLE_COND ? 1 : 0; \ | ||||||||
| assign rvfi_csr_o.``CSR_NAME``.wmask = (rvfi_csr_o.``CSR_NAME``.rdata != {{CVA6Cfg.XLEN - $bits(CSR_SOURCE_NAME)}, CSR_SOURCE_NAME}) && CSR_ENABLE_COND; | ||||||||
| // Changing verible formating to fix vivado synthesis errors and warnings | ||||||||
| // verilog_format: off | ||||||||
| `define CONNECT_RVFI_FULL(CSR_ENABLE_COND, CSR_NAME, CSR_SOURCE_NAME) \ | ||||||||
| always_ff @(posedge clk_i) begin \ | ||||||||
| if (CSR_ENABLE_COND) begin \ | ||||||||
| rvfi_csr_o.``CSR_NAME``.rdata <= {{CVA6Cfg.XLEN - $bits(CSR_SOURCE_NAME)}, CSR_SOURCE_NAME}; \ | ||||||||
| end \ | ||||||||
| end \ | ||||||||
| assign rvfi_csr_o.``CSR_NAME``.wdata = CSR_ENABLE_COND ? { {{CVA6Cfg.XLEN-$bits(CSR_SOURCE_NAME)}, CSR_SOURCE_NAME} } : 0; \ | ||||||||
| assign rvfi_csr_o.``CSR_NAME``.rmask = CSR_ENABLE_COND ? 1 : 0; \ | ||||||||
| assign rvfi_csr_o.``CSR_NAME``.wmask = (rvfi_csr_o.``CSR_NAME``.rdata != {{CVA6Cfg.XLEN - $bits(CSR_SOURCE_NAME)}, CSR_SOURCE_NAME}) && CSR_ENABLE_COND; | ||||||||
|
|
||||||||
| `define CONNECT_RVFI_SAME(CSR_ENABLE_COND, CSR_NAME) \ | ||||||||
| `CONNECT_RVFI_FULL(CSR_ENABLE_COND, CSR_NAME, csr.``CSR_NAME``_q) | ||||||||
| `CONNECT_RVFI_FULL(CSR_ENABLE_COND, CSR_NAME, csr.``CSR_NAME``_q) | ||||||||
|
|
||||||||
| `CONNECT_RVFI_FULL(CVA6Cfg.FpPresent, fflags, csr.fcsr_q.fflags) | ||||||||
| `CONNECT_RVFI_FULL(CVA6Cfg.FpPresent, frm, csr.fcsr_q.frm) | ||||||||
| `CONNECT_RVFI_FULL(CVA6Cfg.FpPresent, fcsr, {csr.fcsr_q.frm, csr.fcsr_q.fflags}) | ||||||||
| if ($bits(rvfi_csr_o) != 1) begin | ||||||||
| `CONNECT_RVFI_FULL(CVA6Cfg.FpPresent, fflags, csr.fcsr_q.fflags) | ||||||||
| `CONNECT_RVFI_FULL(CVA6Cfg.FpPresent, frm, csr.fcsr_q.frm) | ||||||||
| `CONNECT_RVFI_FULL(CVA6Cfg.FpPresent, fcsr, {csr.fcsr_q.frm, csr.fcsr_q.fflags}) | ||||||||
|
|
||||||||
| `CONNECT_RVFI_FULL(CVA6Cfg.FpPresent, ftran, csr.fcsr_q.fprec) | ||||||||
| `CONNECT_RVFI_SAME(CVA6Cfg.FpPresent, dcsr) | ||||||||
| `CONNECT_RVFI_FULL(CVA6Cfg.FpPresent, ftran, csr.fcsr_q.fprec) | ||||||||
| `CONNECT_RVFI_SAME(CVA6Cfg.FpPresent, dcsr) | ||||||||
|
|
||||||||
| `CONNECT_RVFI_SAME(CVA6Cfg.DebugEn, dpc) | ||||||||
| `CONNECT_RVFI_SAME(CVA6Cfg.DebugEn, dpc) | ||||||||
|
|
||||||||
| `CONNECT_RVFI_SAME(CVA6Cfg.DebugEn, dscratch0) | ||||||||
| `CONNECT_RVFI_SAME(CVA6Cfg.DebugEn, dscratch1) | ||||||||
| `CONNECT_RVFI_SAME(CVA6Cfg.DebugEn, dscratch0) | ||||||||
| `CONNECT_RVFI_SAME(CVA6Cfg.DebugEn, dscratch1) | ||||||||
|
|
||||||||
| `CONNECT_RVFI_FULL(CVA6Cfg.RVS, sstatus, | ||||||||
| csr.mstatus_extended & SMODE_STATUS_READ_MASK[CVA6Cfg.XLEN-1:0]) | ||||||||
| `CONNECT_RVFI_FULL(CVA6Cfg.RVS, sstatus, csr.mstatus_extended & SMODE_STATUS_READ_MASK[CVA6Cfg.XLEN-1:0]) | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [verible-verilog-format] reported by reviewdog 🐶
Suggested change
|
||||||||
|
|
||||||||
| `CONNECT_RVFI_FULL(CVA6Cfg.RVS, sie, csr.mie_q & csr.mideleg_q) | ||||||||
| `CONNECT_RVFI_FULL(CVA6Cfg.RVS, sip, csr.mip_q & csr.mideleg_q) | ||||||||
| `CONNECT_RVFI_FULL(CVA6Cfg.RVS, sie, csr.mie_q & csr.mideleg_q) | ||||||||
| `CONNECT_RVFI_FULL(CVA6Cfg.RVS, sip, csr.mip_q & csr.mideleg_q) | ||||||||
|
|
||||||||
| `CONNECT_RVFI_SAME(CVA6Cfg.RVS, stvec) | ||||||||
| `CONNECT_RVFI_SAME(CVA6Cfg.RVS, stvec) | ||||||||
|
|
||||||||
| `CONNECT_RVFI_SAME(CVA6Cfg.RVS, scounteren) | ||||||||
| `CONNECT_RVFI_SAME(CVA6Cfg.RVS, scounteren) | ||||||||
|
|
||||||||
| `CONNECT_RVFI_SAME(CVA6Cfg.RVS, sscratch) | ||||||||
| `CONNECT_RVFI_SAME(CVA6Cfg.RVS, sepc) | ||||||||
| `CONNECT_RVFI_SAME(CVA6Cfg.RVS, sscratch) | ||||||||
| `CONNECT_RVFI_SAME(CVA6Cfg.RVS, sepc) | ||||||||
|
|
||||||||
| `CONNECT_RVFI_SAME(CVA6Cfg.RVS, scause) | ||||||||
| `CONNECT_RVFI_SAME(CVA6Cfg.RVS, scause) | ||||||||
|
|
||||||||
| `CONNECT_RVFI_SAME(CVA6Cfg.RVS, stval) | ||||||||
| `CONNECT_RVFI_SAME(CVA6Cfg.RVS, satp) | ||||||||
| `CONNECT_RVFI_SAME(CVA6Cfg.RVS, stval) | ||||||||
| `CONNECT_RVFI_SAME(CVA6Cfg.RVS, satp) | ||||||||
|
|
||||||||
| `CONNECT_RVFI_FULL(1'b1, mstatus, csr.mstatus_extended) | ||||||||
| `CONNECT_RVFI_FULL(1'b1, mstatus, csr.mstatus_extended) | ||||||||
|
|
||||||||
| bit [31:0] mstatush_q; | ||||||||
| `CONNECT_RVFI_FULL(1'b1, mstatush, mstatush_q) | ||||||||
| bit [31:0] mstatush_q; | ||||||||
| `CONNECT_RVFI_FULL(1'b1, mstatush, mstatush_q) | ||||||||
|
|
||||||||
| `CONNECT_RVFI_FULL(1'b1, misa, IsaCode) | ||||||||
| `CONNECT_RVFI_FULL(1'b1, misa, IsaCode) | ||||||||
|
|
||||||||
| `CONNECT_RVFI_SAME(CVA6Cfg.RVS, medeleg) | ||||||||
| `CONNECT_RVFI_SAME(CVA6Cfg.RVS, mideleg) | ||||||||
| `CONNECT_RVFI_SAME(CVA6Cfg.RVS, medeleg) | ||||||||
| `CONNECT_RVFI_SAME(CVA6Cfg.RVS, mideleg) | ||||||||
|
|
||||||||
| `CONNECT_RVFI_SAME(1'b1, mie) | ||||||||
| `CONNECT_RVFI_SAME(1'b1, mtvec) | ||||||||
| `CONNECT_RVFI_SAME(1'b1, mcounteren) | ||||||||
| `CONNECT_RVFI_SAME(1'b1, mie) | ||||||||
| `CONNECT_RVFI_SAME(1'b1, mtvec) | ||||||||
| `CONNECT_RVFI_SAME(1'b1, mcounteren) | ||||||||
|
|
||||||||
| `CONNECT_RVFI_SAME(1'b1, mscratch) | ||||||||
| `CONNECT_RVFI_SAME(1'b1, mscratch) | ||||||||
|
|
||||||||
| `CONNECT_RVFI_SAME(1'b1, mepc) | ||||||||
| `CONNECT_RVFI_SAME(1'b1, mcause) | ||||||||
| `CONNECT_RVFI_SAME(1'b1, mtval) | ||||||||
| `CONNECT_RVFI_SAME(1'b1, mip) | ||||||||
| `CONNECT_RVFI_SAME(1'b1, mepc) | ||||||||
| `CONNECT_RVFI_SAME(1'b1, mcause) | ||||||||
| `CONNECT_RVFI_SAME(1'b1, mtval) | ||||||||
| `CONNECT_RVFI_SAME(1'b1, mip) | ||||||||
|
|
||||||||
| `CONNECT_RVFI_FULL(1'b1, menvcfg, csr.fiom_q) | ||||||||
| `CONNECT_RVFI_FULL(1'b1, menvcfg, csr.fiom_q) | ||||||||
|
|
||||||||
| `CONNECT_RVFI_FULL(CVA6Cfg.XLEN == 32, menvcfgh, 32'h0) | ||||||||
| `CONNECT_RVFI_FULL(CVA6Cfg.XLEN == 32, menvcfgh, 32'h0) | ||||||||
|
|
||||||||
| `CONNECT_RVFI_FULL(1'b1, mvendorid, OPENHWGROUP_MVENDORID) | ||||||||
| `CONNECT_RVFI_FULL(1'b1, marchid, ARIANE_MARCHID) | ||||||||
| `CONNECT_RVFI_FULL(1'b1, mhartid, hart_id_i) | ||||||||
| `CONNECT_RVFI_FULL(1'b1, mvendorid, OPENHWGROUP_MVENDORID) | ||||||||
| `CONNECT_RVFI_FULL(1'b1, marchid, ARIANE_MARCHID) | ||||||||
| `CONNECT_RVFI_FULL(1'b1, mhartid, hart_id_i) | ||||||||
|
|
||||||||
| `CONNECT_RVFI_SAME(1'b1, mcountinhibit) | ||||||||
| `CONNECT_RVFI_SAME(1'b1, mcountinhibit) | ||||||||
|
|
||||||||
| `CONNECT_RVFI_FULL(1'b1, mcycle, csr.cycle_q[CVA6Cfg.XLEN-1:0]) | ||||||||
| `CONNECT_RVFI_FULL(CVA6Cfg.XLEN == 32, mcycleh, csr.cycle_q[63:32]) | ||||||||
| `CONNECT_RVFI_FULL(1'b1, mcycle, csr.cycle_q[CVA6Cfg.XLEN-1:0]) | ||||||||
| `CONNECT_RVFI_FULL(CVA6Cfg.XLEN == 32, mcycleh, csr.cycle_q[63:32]) | ||||||||
|
|
||||||||
| `CONNECT_RVFI_FULL(1'b1, minstret, csr.instret_q[CVA6Cfg.XLEN-1:0]) | ||||||||
| `CONNECT_RVFI_FULL(CVA6Cfg.XLEN == 32, minstreth, csr.instret_q[63:32]) | ||||||||
| `CONNECT_RVFI_FULL(1'b1, minstret, csr.instret_q[CVA6Cfg.XLEN-1:0]) | ||||||||
| `CONNECT_RVFI_FULL(CVA6Cfg.XLEN == 32, minstreth, csr.instret_q[63:32]) | ||||||||
|
|
||||||||
| `CONNECT_RVFI_FULL(1'b1, cycle, csr.cycle_q[CVA6Cfg.XLEN-1:0]) | ||||||||
| `CONNECT_RVFI_FULL(CVA6Cfg.XLEN == 32, cycleh, csr.cycle_q[63:32]) | ||||||||
| `CONNECT_RVFI_FULL(1'b1, cycle, csr.cycle_q[CVA6Cfg.XLEN-1:0]) | ||||||||
| `CONNECT_RVFI_FULL(CVA6Cfg.XLEN == 32, cycleh, csr.cycle_q[63:32]) | ||||||||
|
|
||||||||
| `CONNECT_RVFI_FULL(1'b1, instret, csr.instret_q[CVA6Cfg.XLEN-1:0]) | ||||||||
| `CONNECT_RVFI_FULL(CVA6Cfg.XLEN == 32, instreth, csr.instret_q[63:32]) | ||||||||
| `CONNECT_RVFI_FULL(1'b1, instret, csr.instret_q[CVA6Cfg.XLEN-1:0]) | ||||||||
| `CONNECT_RVFI_FULL(CVA6Cfg.XLEN == 32, instreth, csr.instret_q[63:32]) | ||||||||
|
|
||||||||
| `CONNECT_RVFI_SAME(1'b1, dcache) | ||||||||
| `CONNECT_RVFI_SAME(1'b1, icache) | ||||||||
| `CONNECT_RVFI_SAME(1'b1, dcache) | ||||||||
| `CONNECT_RVFI_SAME(1'b1, icache) | ||||||||
|
|
||||||||
| `CONNECT_RVFI_SAME(CVA6Cfg.EnableAccelerator, acc_cons) | ||||||||
| `CONNECT_RVFI_SAME(CVA6Cfg.RVZCMT, jvt) | ||||||||
| `CONNECT_RVFI_FULL(1'b1, pmpcfg0, csr.pmpcfg_q[CVA6Cfg.XLEN/8-1:0]) | ||||||||
| `CONNECT_RVFI_FULL(CVA6Cfg.XLEN == 32, pmpcfg1, csr.pmpcfg_q[7:4]) | ||||||||
| `CONNECT_RVFI_SAME(CVA6Cfg.EnableAccelerator, acc_cons) | ||||||||
| `CONNECT_RVFI_SAME(CVA6Cfg.RVZCMT, jvt) | ||||||||
| `CONNECT_RVFI_FULL(1'b1, pmpcfg0, csr.pmpcfg_q[CVA6Cfg.XLEN/8-1:0]) | ||||||||
| `CONNECT_RVFI_FULL(CVA6Cfg.XLEN == 32, pmpcfg1, csr.pmpcfg_q[7:4]) | ||||||||
|
|
||||||||
| `CONNECT_RVFI_FULL(1'b1, pmpcfg2, csr.pmpcfg_q[8+:CVA6Cfg.XLEN/8]) | ||||||||
| `CONNECT_RVFI_FULL(CVA6Cfg.XLEN == 32, pmpcfg3, csr.pmpcfg_q[15:12]) | ||||||||
| `CONNECT_RVFI_FULL(1'b1, pmpcfg2, csr.pmpcfg_q[8+:CVA6Cfg.XLEN/8]) | ||||||||
| `CONNECT_RVFI_FULL(CVA6Cfg.XLEN == 32, pmpcfg3, csr.pmpcfg_q[15:12]) | ||||||||
|
|
||||||||
| bit [CVA6Cfg.XLEN-1:0] pmpaddr_q; | ||||||||
| genvar i; | ||||||||
| generate | ||||||||
| bit [CVA6Cfg.XLEN-1:0] pmpaddr_q; | ||||||||
| genvar i; | ||||||||
| for (i = 0; i < 16; i++) begin | ||||||||
| `CONNECT_RVFI_FULL(1'b1, pmpaddr[i], { | ||||||||
| csr.pmpaddr_q[i][CVA6Cfg.PLEN-3:1], pmpcfg_q[i].addr_mode[1]}) | ||||||||
| `CONNECT_RVFI_FULL(1'b1, pmpaddr[i], {csr.pmpaddr_q[i][CVA6Cfg.PLEN-3:1], pmpcfg_q[i].addr_mode[1]}) | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [verible-verilog-format] reported by reviewdog 🐶
Suggested change
|
||||||||
| end | ||||||||
| endgenerate | ||||||||
| ; | ||||||||
|
|
||||||||
| ; | ||||||||
| end | ||||||||
| // verilog_format: on | ||||||||
| endmodule | ||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[verible-verilog-format] reported by reviewdog 🐶