billshockley commited on
Commit
d39fee6
·
verified ·
1 Parent(s): 4a4cdf0

Upload folder using huggingface_hub

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +25 -0
  2. LICENSE +202 -0
  3. README.md +283 -0
  4. images/rtl/adc_ctrl-core/Dockerfile +30 -0
  5. images/rtl/adc_ctrl-core/scripts/setup_workspace.sh +250 -0
  6. images/rtl/adc_ctrl-fsm/Dockerfile +33 -0
  7. images/rtl/adc_ctrl-fsm/scripts/setup_workspace.sh +252 -0
  8. images/rtl/adc_ctrl-intr/Dockerfile +30 -0
  9. images/rtl/adc_ctrl-intr/scripts/setup_workspace.sh +250 -0
  10. images/rtl/adc_ctrl/Dockerfile +33 -0
  11. images/rtl/adc_ctrl/scripts/setup_workspace.sh +116 -0
  12. images/rtl/aes/Dockerfile +33 -0
  13. images/rtl/aes/scripts/setup_workspace.sh +343 -0
  14. images/rtl/alert_handler-accu/Dockerfile +29 -0
  15. images/rtl/alert_handler-accu/scripts/setup_workspace.sh +200 -0
  16. images/rtl/alert_handler-class/Dockerfile +29 -0
  17. images/rtl/alert_handler-class/scripts/setup_workspace.sh +200 -0
  18. images/rtl/alert_handler-esc-timer/Dockerfile +29 -0
  19. images/rtl/alert_handler-esc-timer/scripts/setup_workspace.sh +200 -0
  20. images/rtl/alert_handler-lpg-ctrl/Dockerfile +29 -0
  21. images/rtl/alert_handler-lpg-ctrl/scripts/setup_workspace.sh +200 -0
  22. images/rtl/alert_handler-ping-timer/Dockerfile +29 -0
  23. images/rtl/alert_handler-ping-timer/scripts/setup_workspace.sh +200 -0
  24. images/rtl/alert_handler/Dockerfile +37 -0
  25. images/rtl/alert_handler/scripts/setup_workspace.sh +121 -0
  26. images/rtl/aon-timer/Dockerfile +33 -0
  27. images/rtl/aon-timer/scripts/setup_workspace.sh +237 -0
  28. images/rtl/csrng/Dockerfile +33 -0
  29. images/rtl/csrng/scripts/setup_workspace.sh +372 -0
  30. images/rtl/dma/Dockerfile +56 -0
  31. images/rtl/dma/scripts/setup_workspace.sh +311 -0
  32. images/rtl/gpio/Dockerfile +52 -0
  33. images/rtl/gpio/scripts/setup_workspace.sh +250 -0
  34. images/rtl/hmac/Dockerfile +33 -0
  35. images/rtl/hmac/scripts/setup_workspace.sh +260 -0
  36. images/rtl/i2c/Dockerfile +33 -0
  37. images/rtl/i2c/scripts/setup_workspace.sh +265 -0
  38. images/rtl/keymgr-ctrl/Dockerfile +33 -0
  39. images/rtl/keymgr-ctrl/scripts/setup_workspace.sh +95 -0
  40. images/rtl/keymgr-err/Dockerfile +33 -0
  41. images/rtl/keymgr-err/scripts/setup_workspace.sh +63 -0
  42. images/rtl/keymgr-kmac-if/Dockerfile +33 -0
  43. images/rtl/keymgr-kmac-if/scripts/setup_workspace.sh +79 -0
  44. images/rtl/keymgr-sideload-key-ctrl/Dockerfile +33 -0
  45. images/rtl/keymgr-sideload-key-ctrl/scripts/setup_workspace.sh +68 -0
  46. images/rtl/keymgr/Dockerfile +33 -0
  47. images/rtl/keymgr/scripts/setup_workspace.sh +108 -0
  48. images/rtl/rv-timer-core/Dockerfile +33 -0
  49. images/rtl/rv-timer-core/scripts/setup_workspace.sh +229 -0
  50. images/rtl/rv_timer/Dockerfile +33 -0
.gitattributes CHANGED
@@ -58,3 +58,28 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
58
  # Video files - compressed
59
  *.mp4 filter=lfs diff=lfs merge=lfs -text
60
  *.webm filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  # Video files - compressed
59
  *.mp4 filter=lfs diff=lfs merge=lfs -text
60
  *.webm filter=lfs diff=lfs merge=lfs -text
61
+ tasks/rtl/aes-cipher-control-rtl/environment/workspace/code/spec/aes_standard.pdf filter=lfs diff=lfs merge=lfs -text
62
+ tasks/rtl/aes-cipher-core-rtl/environment/workspace/code/spec/aes_standard.pdf filter=lfs diff=lfs merge=lfs -text
63
+ tasks/rtl/aes-control-rtl/environment/workspace/code/spec/aes_standard.pdf filter=lfs diff=lfs merge=lfs -text
64
+ tasks/rtl/aes-core-rtl/environment/workspace/code/spec/aes_standard.pdf filter=lfs diff=lfs merge=lfs -text
65
+ tasks/rtl/aes-ctr-rtl/environment/workspace/code/spec/aes_standard.pdf filter=lfs diff=lfs merge=lfs -text
66
+ tasks/rtl/aes-key-expand-rtl/environment/workspace/code/spec/aes_standard.pdf filter=lfs diff=lfs merge=lfs -text
67
+ tasks/rtl/aes-mix-columns-rtl/environment/workspace/code/spec/aes_standard.pdf filter=lfs diff=lfs merge=lfs -text
68
+ tasks/rtl/aes-prng-clearing-rtl/environment/workspace/code/spec/aes_standard.pdf filter=lfs diff=lfs merge=lfs -text
69
+ tasks/rtl/aes-rtl/environment/workspace/code/spec/aes_standard.pdf filter=lfs diff=lfs merge=lfs -text
70
+ tasks/rtl/aes-sbox-sub-bytes-rtl/environment/workspace/code/spec/aes_standard.pdf filter=lfs diff=lfs merge=lfs -text
71
+ tasks/rtl/aes-shift-rows-sel-buf-rtl/environment/workspace/code/spec/aes_standard.pdf filter=lfs diff=lfs merge=lfs -text
72
+ tasks/rtl/csrng-block-encrypt-rtl/environment/workspace/code/docs/NIST.SP.800-90Ar1.pdf filter=lfs diff=lfs merge=lfs -text
73
+ tasks/rtl/csrng-cmd-stage-rtl/environment/workspace/code/docs/NIST.SP.800-90Ar1.pdf filter=lfs diff=lfs merge=lfs -text
74
+ tasks/rtl/csrng-core-rtl/environment/workspace/code/docs/NIST.SP.800-90Ar1.pdf filter=lfs diff=lfs merge=lfs -text
75
+ tasks/rtl/csrng-ctr-drbg-rtl/environment/workspace/code/docs/NIST.SP.800-90Ar1.pdf filter=lfs diff=lfs merge=lfs -text
76
+ tasks/rtl/csrng-main-sm-rtl/environment/workspace/code/docs/NIST.SP.800-90Ar1.pdf filter=lfs diff=lfs merge=lfs -text
77
+ tasks/rtl/csrng-rtl/environment/workspace/code/docs/NIST.SP.800-90Ar1.pdf filter=lfs diff=lfs merge=lfs -text
78
+ tasks/rtl/csrng-state-db-rtl/environment/workspace/code/docs/NIST.SP.800-90Ar1.pdf filter=lfs diff=lfs merge=lfs -text
79
+ tasks/rtl/i2c-bus-monitor-rtl/environment/workspace/code/spec/UM10204.pdf filter=lfs diff=lfs merge=lfs -text
80
+ tasks/rtl/i2c-controller-fsm-rtl/environment/workspace/code/spec/UM10204.pdf filter=lfs diff=lfs merge=lfs -text
81
+ tasks/rtl/i2c-core-rtl/environment/workspace/code/spec/UM10204.pdf filter=lfs diff=lfs merge=lfs -text
82
+ tasks/rtl/i2c-fifo-adapter-rtl/environment/workspace/code/spec/UM10204.pdf filter=lfs diff=lfs merge=lfs -text
83
+ tasks/rtl/i2c-fifos-rtl/environment/workspace/code/spec/UM10204.pdf filter=lfs diff=lfs merge=lfs -text
84
+ tasks/rtl/i2c-rtl/environment/workspace/code/spec/UM10204.pdf filter=lfs diff=lfs merge=lfs -text
85
+ tasks/rtl/i2c-target-fsm-rtl/environment/workspace/code/spec/UM10204.pdf filter=lfs diff=lfs merge=lfs -text
LICENSE ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
README.md ADDED
@@ -0,0 +1,283 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ pretty_name: TitanBench
3
+ language:
4
+ - en
5
+ license: apache-2.0
6
+ size_categories:
7
+ - n<1K
8
+ task_categories:
9
+ - text-generation
10
+ tags:
11
+ - benchmark
12
+ - agents
13
+ - hardware
14
+ - hardware-design
15
+ - rtl
16
+ - uvm
17
+ - opentitan
18
+ - harbor
19
+ - functional-verification
20
+ - code-generation
21
+ gated: true
22
+ extra_gated_heading: "Acknowledge to access TitanBench"
23
+ extra_gated_description: |
24
+ TitanBench evaluates agentic AI systems on hardware design and
25
+ verification tasks derived from the OpenTitan open-source SoC.
26
+ Please share a few details about your intended use before
27
+ downloading.
28
+ extra_gated_fields:
29
+ Affiliation: text
30
+ Intended use:
31
+ type: select
32
+ options:
33
+ - Academic research
34
+ - Industry research
35
+ - Educational use
36
+ - label: Other
37
+ value: other
38
+ extra_gated_button_content: "Acknowledge and request access"
39
+ citation: |
40
+ @misc{titanbench_2026,
41
+ title={TitanBench: A Benchmark for Agentic RTL Design and Verification},
42
+ author={Anonymous},
43
+ year={2026},
44
+ url={https://huggingface.co/datasets/billshockley/titanbench}}
45
+ ---
46
+
47
+ # TitanBench: A Benchmark for Agentic RTL Design and Verification
48
+
49
+ TitanBench evaluates agentic AI systems on long-horizon chip design and verification (DV) workflows. Where existing hardware benchmarks focus on isolated coding or reasoning, TitanBench grades agents inside a containerised OpenTitan source tree using the project's production UVM verification environment. The agent must locate the relevant RTL, register specifications, testplan descriptions, and testbench infrastructure on its own — like a human engineer joining the project — and submit a solution that survives the upstream regression flow.
50
+
51
+ This dataset is a **read-only mirror** of the harness repository. Source of truth: <<anonymous-repo-url>>. Issues / PRs go there.
52
+
53
+ ## Why this benchmark
54
+
55
+ Verification accounts for **60–70 % of engineering effort in modern chip development**, and a single bug missed before tape-out can require a respin costing millions of dollars. Despite that, no public benchmark grades AI agents against production-grade UVM testbenches, coverage closure targets, and the full repository context that human DV engineers operate in. Existing efforts evaluate single-file RTL generation against author-supplied testbenches (`VerilogEval`, `RTLLM`), or repository-scale completion via edit similarity (`RTL-Repo`), or bug repair from known failures (`HWE-Bench`). TitanBench fills the gap: completion-based RTL and stimulus tasks evaluated directly against OpenTitan's production scoreboards, assertions, and functional coverage.
56
+
57
+ ## Composition
58
+
59
+ The dataset has two top-level directories, each split into stimulus / RTL families:
60
+
61
+ ```
62
+ tasks/ 108 benchmark tasks
63
+ ├── stimulus/<ip>-tp-<testpoint>/ × 50 stimulus tasks
64
+ └── rtl/<ip>-rtl/, <ip>-<module>-rtl/ × 58 RTL tasks
65
+
66
+ images/ docker build recipes for the per-IP / per-task base images
67
+ ├── stimulus/<ip>/ × 14 builds titanbench-<ip>:latest
68
+ └── rtl/<task>/ × 31 builds titanbench-<task>-rtl:latest
69
+ (the other 27 RTL tasks reuse a
70
+ sibling's base via FROM)
71
+ ```
72
+
73
+ | Family | Count | Pattern | What the agent does |
74
+ |---|---:|---|---|
75
+ | **Stimulus generation** | **50** | `tasks/stimulus/<ip>-tp-<testpoint>/` | Writes a UVM `*_vseq.sv` for a redacted testpoint |
76
+ | **RTL module completion** | **58** | `tasks/rtl/<ip>-rtl/`, `tasks/rtl/<ip>-<module>-rtl/` | Reconstructs synthesizable SystemVerilog from a stubbed module + spec |
77
+
78
+ `images/` is build infrastructure — not benchmark tasks. The harness consumes it via `build_images.sh` to produce the per-IP / per-task base images that each task's `environment/Dockerfile` references via `FROM`. The stimulus and RTL families are independent benchmarks; reviewers may evaluate either independently.
79
+
80
+ ### IPs covered
81
+
82
+ 14 OpenTitan IPs: `adc_ctrl`, `aes`, `alert_handler`, `aon_timer`, `csrng`, `dma`, `gpio`, `hmac`, `i2c`, `keymgr`, `rv_timer`, `sram_ctrl`, `uart`, `usbdev`. The subset prioritises industry-standard archetypes — serial protocols, cryptographic datapaths, DMA, memory control, timers, and entropy — whose specifications generalise across SoC designs. We exclude blocks that are OpenTitan-specific (`lc_ctrl`, `rom_ctrl`, `rv_dm`, `keymgr_dpe`) and niche accelerators (`otbn`, `ascon`) that do not transfer cleanly to other SoCs.
83
+
84
+ ### Per-task statistics (summary)
85
+
86
+ Detailed per-task statistics are in the paper. Headline ranges:
87
+
88
+ | | Stimulus (n=50) | RTL (n=58) |
89
+ |---|---|---|
90
+ | Target SLOC | 46 – 597 (mean 228) | 30 – 6 484 (mean 673) |
91
+ | Registers / module ports | 0 – 17 regs | 5 – 713 ports |
92
+ | Visible RTL files | — | 6 – 134 (mean 84) |
93
+ | Visible spec / register files | — | 2 – 14 (mean 7) |
94
+ | Oracle coverage bins | 0 – 3 096 (mean 348) | n/a |
95
+ | Agent runtime budget | 3 600 s | 3 600 s |
96
+
97
+ ## Task layout (harbor convention)
98
+
99
+ ```
100
+ <task-id>/
101
+ ├── instruction.md natural-language prompt for the agent
102
+ ├── task.toml harbor metadata (timeouts, env, tags)
103
+ ├── environment/
104
+ │ ├── Dockerfile per-trial container (FROM the per-IP base image)
105
+ │ └── docker-compose.yaml
106
+ ├── solution/ reference / oracle answer (hidden from agent at runtime)
107
+ │ ├── solve.sh deploys the oracle into the workspace
108
+ │ ├── golden_sequences/ # *.sv (stimulus tasks)
109
+ │ └── *.sv # golden RTL (RTL tasks)
110
+ └── tests/
111
+ ├── test.sh verifier — runs dvsim, scores correctness + coverage
112
+ └── oracle_coverage_bins.json (stimulus tasks only)
113
+ ```
114
+
115
+ ## Task family 1: Stimulus generation
116
+
117
+ For a given IP, a stimulus task targets one testpoint from the OpenTitan testplan. The agent is dropped into a container built from an **ablated** copy of the IP's DV environment: every reference sequence except the base/common ones is deleted, the `vseq_list` and `sim_cfg.hjson` are emptied accordingly, and coverage-exclusion files are removed so the agent cannot infer which bins are unreachable. Crucially the **testbench surface remains visible** — UVM env, scoreboard, RAL model, virtual interfaces — because navigating that surface is part of the task: the sequence must extend the right base class, access the right registers, and drive the DUT in a way the scoreboard can predict.
118
+
119
+ The agent receives an `instruction.md` stating the testpoint's behavioural intent (Stimulus + Checks lists) and a build entry point. It must produce two artefacts: a virtual sequence (`<task>_vseq.sv`) and a per-task simulation config (`agent_sim_cfg.hjson`).
120
+
121
+ **Scoring.** The verifier inserts both files into a clean OpenTitan checkout, registers the sequence in the IP's `vseq_list` and FuseSoC manifest, merges the per-task config into the master `sim_cfg.hjson`, and runs Xcelium under `--build-mode cov --reseed 1`. Reward is the uniform average of correctness and oracle-normalised coverage:
122
+
123
+ ```
124
+ p = 1 iff the test compiles, simulates, and reports zero scoreboard failures, else 0
125
+ c = |B_oracle ∩ B_agent| / |B_oracle| (cover-bin intersection ratio)
126
+ R = 0.5·p + 0.5·c (in [0, 1])
127
+ ```
128
+
129
+ `B_oracle` is the bin set hit by the upstream golden sequence at the same seed (precomputed and shipped per task as `tests/oracle_coverage_bins.json`). Coverage is normalised against oracle bins, not the full testbench universe — a single testpoint is not expected to close every bin.
130
+
131
+ ### Example: `aes-tp-core_fi`
132
+
133
+ ```markdown
134
+ # AES: core_fi
135
+
136
+ > Fault injection targeting the AES core block. Verify that injected faults are
137
+ > detected and trigger appropriate error responses.
138
+
139
+ Write a UVM sequence that extends `aes_base_vseq` to verify the above.
140
+
141
+ **Output:** `/home/dev/workspace/sequences/aes_core_fi_vseq.sv`
142
+ and `/home/dev/workspace/agent_sim_cfg.hjson`
143
+
144
+ **Run:** `/home/dev/scripts/run_test.sh aes_core_fi`
145
+ ```
146
+
147
+ The agent must understand AES fault-injection semantics, locate `aes_base_vseq` and the relevant error-status registers, write a sequence that injects a fault and observes the resulting error response, and produce a `sim_cfg.hjson` selecting the new test name. The verifier scores against 89 oracle coverage bins.
148
+
149
+ ## Task family 2: RTL module completion
150
+
151
+ Each RTL task targets one synthesizable SystemVerilog module (e.g. `aes_cipher_core`) or a full IP block. The agent works in a containerised workspace with `rtl/`, `pkg/`, `prim/`, `tlul/`, `spec/`, and `run/` directories. **All sibling modules within the IP are pre-implemented** with the oracle versions; the target module is shipped as a *stub* — license header, module declaration, port list, body removed. The accompanying `instruction.md` specifies the file path of the stub, lists key behaviours, fixes any hierarchical instance names the testbench refers to, and points to the build entry point (`make compile` in `run/`).
152
+
153
+ The **UVM testbench is hidden from the agent** at generation time to prevent reverse-engineering the spec by inspecting test expectations. To compensate, every external specification linked from the OpenTitan documentation is bundled locally under `spec/`, alongside the relevant typedef files. Internet access is disabled in the container; we observed agents attempting to fetch the upstream OpenTitan repo from GitHub during early experiments.
154
+
155
+ **Scoring.** The verifier copies the candidate RTL into a clean upstream checkout, commits, and runs the IP's unmodified `dvsim` simulation config under Xcelium with `--reseed 1`. The test list is filtered to the subset of upstream tests that score 1.0 against the oracle RTL at `reseed=1` — excluding (i) shared CIP infrastructure tests, (ii) security-countermeasure tests requiring bind files we do not ship, (iii) random-reset stress tests flaky at a single seed, and (iv) any remaining test whose oracle run does not converge to 1.0. Reward is the fraction of the surviving tests that pass:
156
+
157
+ ```
158
+ R = n_passed / n_total ∈ [0, 1]
159
+ ```
160
+
161
+ A perfect score on the oracle is achievable by construction at this filter, so any drop below 1.0 is attributable to the agent's implementation.
162
+
163
+ ### Example: `aes-rtl` (full-IP variant)
164
+
165
+ ```markdown
166
+ # RTL Implementation Task: AES Full IP
167
+
168
+ You are working in `/home/dev/workspace/code/`. The layout is:
169
+
170
+ rtl/ -- AES RTL modules (you must implement 24 core modules here)
171
+ prim/ -- OpenTitan primitive library (provided, read-only)
172
+ tlul/ -- TileLink-UL bus modules (provided, read-only)
173
+ pkg/ -- Package files (provided, read-only)
174
+ spec/ -- AES specification (provided, read-only)
175
+ run/ -- Makefile and filelist for compilation
176
+
177
+ Implement the 24 core AES RTL modules. Stubs with exact port signatures
178
+ are provided in rtl/. Read spec/aes_standard.pdf for the AES algorithm
179
+ specification.
180
+
181
+ (... full instruction lists 24 module names + descriptions across
182
+ cipher datapath, control FSMs, and integration utilities. See the
183
+ task's instruction.md for the complete spec.)
184
+
185
+ Build commands:
186
+ cd /home/dev/workspace/code/run
187
+ make compile
188
+ ```
189
+
190
+ The full instruction.md (in the task dir) walks through 24 modules grouped by datapath / control FSMs / integration, describes the sparse-encoding (sp2v) FSM convention OpenTitan uses for fault tolerance, and lists boilerplate the agent should not re-implement. Per-module `<ip>-<module>-rtl/` variants target a single module each, with the rest of the IP pre-implemented.
191
+
192
+ ## Headline results
193
+
194
+ We evaluated three frontier agentic systems with 5 trials per task at `--reseed 1`:
195
+
196
+ | Model | Harness | Stimulus mean reward | RTL mean reward |
197
+ |---|---|---:|---:|
198
+ | Anthropic Claude Opus 4.6 | claude-code | TBD | TBD |
199
+ | OpenAI GPT-5.3 Codex | codex (no web search) | TBD | TBD |
200
+ | Moonshot Kimi K2.5 | mini-swe-agent (Fireworks) | TBD | TBD |
201
+
202
+ No model approaches saturation on either benchmark. Reward declines monotonically with the static complexity score on both task families (see paper §4), and on stimulus generation the **testbench surface** axis (size + structure of the surrounding UVM environment) has the strongest single-axis correlation with reward — substantially exceeding the SLOC axis. What makes a TitanBench task hard is not the volume of code the agent must emit, but the size of the verification environment it must navigate to emit code that integrates correctly.
203
+
204
+ Numbers are filled in once the model sweep over the 6 task swap-ins finishes.
205
+
206
+ ## Running the benchmark
207
+
208
+ This dataset is the evaluation contract — task definitions, oracles, verifier specs. Actually running it requires the **harness repo**, which provides the OpenTitan submodule, agent runners, and Cadence tool integration:
209
+
210
+ ```bash
211
+ # 1. Download the harness tarball from <anonymous-repo-url>, extract, cd in.
212
+
213
+ # 2. Fetch OpenTitan at the pinned SHA
214
+ bash fetch_opentitan.sh
215
+
216
+ # 3. Pull this dataset — populates tasks/ AND images/ at the harness root
217
+ hf download billshockley/titanbench --repo-type dataset \
218
+ --include "tasks/*" --include "images/*" --local-dir .
219
+
220
+ # 4. Build base images (titanbench-base + 14 stimulus + 31 RTL)
221
+ bash build_images.sh
222
+
223
+ # 5. Run a single task end-to-end
224
+ export XCELIUM_PATH=/opt/cadence/installs/XCELIUM2403
225
+ export VMANAGER_PATH=/opt/cadence/installs/VMANAGER2403
226
+ export LM_LICENSE_FILE=5280@your-license-server
227
+ export PYTHONPATH=runners
228
+
229
+ # Stimulus: -p tasks/stimulus
230
+ harbor run -p tasks/stimulus -a claude-code \
231
+ -m anthropic/claude-opus-4-6 \
232
+ -t aes-tp-core_fi --debug -y
233
+
234
+ # RTL: -p tasks/rtl
235
+ harbor run -p tasks/rtl -a claude-code \
236
+ -m anthropic/claude-opus-4-6 \
237
+ -t aes-rtl --debug -y
238
+ ```
239
+
240
+ **Required commercial tools** (not provided): Cadence Xcelium 2403+ and Cadence vManager / IMC 2403+. The Xcelium dependency is a hard prerequisite — UVM coverage scoring at the fidelity TitanBench requires is not currently available on open-source simulators.
241
+
242
+ ## Source provenance
243
+
244
+ - **Derived from**: [OpenTitan](https://github.com/lowRISC/opentitan) (Apache-2.0). The `opentitan/` submodule is pinned to a specific upstream SHA in the harness repo; that SHA is the reproducibility contract.
245
+ - **Selection**: Stimulus testpoints were drawn from each IP's machine-readable `data/<ip>_testplan.hjson`. The 50-task subset was selected per-IP by ranking on `z(golden_loc) + z(registers_touched)` (independent within each IP) and keeping the top-K to match a pre-allocated budget summing to 50. RTL tasks are one full-IP entry per IP plus per-module sub-tasks for IPs whose top-level module is too large to attempt as a single task. Tasks where the upstream golden artefact does not reach reward = 1.0 at `reseed=1` were excluded; replacement candidates were oracle-validated before inclusion.
246
+ - **No human annotation**: TitanBench is constructed mechanically from upstream artefacts. The `instruction.md` files for stimulus tasks paraphrase the testpoint's existing testplan entry; for RTL tasks they list module names and known interface conventions.
247
+
248
+ ## Limitations & Responsible AI
249
+
250
+ - **Language**: English instructions only; no multilingual variants.
251
+ - **Domain restrictions**: OpenTitan-specific. Findings on TitanBench should not be assumed to generalise to other RTL families (DSPs, ML accelerators, GPUs) without further evaluation.
252
+ - **Closed-source tooling**: Cadence Xcelium is a hard requirement to run the verifier. This is a substantial barrier for academic reviewers and we treat it as a Limitation rather than a Mitigation.
253
+ - **Coverage methodology**: We score normalised functional + line/toggle/FSM coverage as exposed by Xcelium / vManager. Formal verification, equivalence checking, and PPA (power / performance / area) are *not* part of the reward. A perfect TitanBench score does not certify a design for tape-out.
254
+ - **Selection bias**: Tasks skew toward security-critical IPs (AES, KEYMGR, CSRNG, HMAC) because those have the most extensive UVM environments in OpenTitan. Mileage on simple peripherals will not reflect performance on those blocks.
255
+ - **Contamination risk**: OpenTitan source is public. We mitigate by hiding the testbench at RTL-task time, disabling internet in the container, and grading on execution rather than string match — but we cannot fully exclude memorisation effects. Future versions may use unreleased OpenTitan revisions.
256
+ - **No personal or sensitive data**: The dataset is synthetic hardware-engineering content only.
257
+ - **Synthetic data**: `false`. All artefacts derive from OpenTitan's human-engineered RTL and DV environment.
258
+ - **Intended use**: Comparing agent capability on hardware DV / RTL completion under a controlled budget. Not validated for: model training, formal verification, generalisation to non-UVM flows, generalisation outside OpenTitan-style CIP designs.
259
+ - **Social impact**: Positive — standardised public benchmark for LLM-driven HDL/DV. Negative — risk of overstating production-readiness if results are reported without the limitations above.
260
+
261
+ ## Maintenance
262
+
263
+ - **Maintainer**: TitanBench Team (see citation below for current authorship).
264
+ - **Issues / PRs**: <<anonymous-repo-url>>.
265
+ - **Versioning**: Dataset is versioned via git commits on this HF repo. The harness repo's submodule pin (`opentitan/`) and build flags determine which tests run; a fixed pair of (HF SHA, harness SHA) is the reproducibility contract.
266
+ - **Plan**: Frozen at submission time for the NeurIPS review window. Post-acceptance updates batch into tagged releases (e.g. `v1.0`, `v1.1`).
267
+
268
+ ## Citation
269
+
270
+ ```bibtex
271
+ @misc{titanbench_2026,
272
+ title={TitanBench: A Benchmark for Agentic RTL Design and Verification},
273
+ author={Anonymous},
274
+ year={2026},
275
+ url={https://huggingface.co/datasets/billshockley/titanbench}
276
+ }
277
+ ```
278
+
279
+ OpenTitan should be cited separately if you use the dataset in published work — see the [OpenTitan project](https://opentitan.org/) for the canonical bibliographic entry.
280
+
281
+ ## License
282
+
283
+ Apache-2.0. Tasks derive from the upstream OpenTitan project (also Apache-2.0). See `LICENSE` for the full text.
images/rtl/adc_ctrl-core/Dockerfile ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TitanBench ADC_CTRL-CORE-RTL — extends titanbench-base with OpenTitan infrastructure.
2
+ #
3
+ # Uses two build contexts:
4
+ # - default context (.) = OpenTitan repo root
5
+ # - titanbench = titanbench repo root
6
+ #
7
+ # Usage:
8
+ # docker build -f images/rtl/adc_ctrl-core/image/Dockerfile \
9
+ # --build-context titanbench=/path/to/titanbench \
10
+ # -t titanbench-adc-ctrl-core-rtl /path/to/opentitan
11
+
12
+ FROM titanbench-base:latest
13
+
14
+ COPY --chown=dev:dev . /home/dev/src/
15
+
16
+ COPY --from=titanbench images/rtl/adc_ctrl-core/scripts/setup_workspace.sh /home/dev/scripts/setup_workspace.sh
17
+ RUN chmod +x /home/dev/scripts/setup_workspace.sh \
18
+ && bash /home/dev/scripts/setup_workspace.sh
19
+
20
+ RUN git config --global --add safe.directory /home/dev/src \
21
+ && git config --global user.email "titanbench@opentitan.org" \
22
+ && git config --global user.name "TitanBench" \
23
+ && cd /home/dev/src \
24
+ && git init \
25
+ && git add -A \
26
+ && git commit -m "titanbench adc_ctrl-core-rtl base"
27
+
28
+ WORKDIR /home/dev/workspace/code
29
+ ENTRYPOINT []
30
+ CMD ["sh", "-c", "sleep infinity"]
images/rtl/adc_ctrl-core/scripts/setup_workspace.sh ADDED
@@ -0,0 +1,250 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Copyright lowRISC contributors (OpenTitan project).
3
+ # Licensed under the Apache License, Version 2.0, see LICENSE for details.
4
+ # SPDX-License-Identifier: Apache-2.0
5
+ #
6
+ # Populates the ADC_CTRL-CORE-RTL workspace with infrastructure + oracle RTL for
7
+ # every module except adc_ctrl_core.sv (which is overlaid as a stub by the
8
+ # environment Dockerfile).
9
+
10
+ set -euo pipefail
11
+
12
+ REPO_TOP="/home/dev/src"
13
+ WS="/home/dev/workspace/code"
14
+
15
+ echo "=== TitanBench: Populating ADC_CTRL-CORE-RTL workspace from OpenTitan ==="
16
+
17
+ mkdir -p "$WS"/{prim,tlul,pkg,spec,run,rtl}
18
+
19
+ # ── Prim modules ────────────────────────────────────────────────────
20
+ echo "[1/6] Copying prim modules..."
21
+ PRIM_SRC="$REPO_TOP/hw/ip/prim/rtl"
22
+ PRIM_GEN_SRC="$REPO_TOP/hw/ip/prim_generic/rtl"
23
+
24
+ PRIM_FILES=(
25
+ prim_alert_pkg.sv
26
+ prim_mubi_pkg.sv
27
+ prim_secded_pkg.sv
28
+ prim_subreg_pkg.sv
29
+ prim_util_pkg.sv
30
+ prim_assert.sv
31
+ prim_assert_sec_cm.svh
32
+ prim_assert_standard_macros.svh
33
+ prim_flop_macros.sv
34
+ prim_cdc_rand_delay.sv
35
+ prim_onehot_enc.sv
36
+ prim_onehot_check.sv
37
+ prim_subreg.sv
38
+ prim_subreg_arb.sv
39
+ prim_subreg_ext.sv
40
+ prim_reg_we_check.sv
41
+ prim_sec_anchor_buf.sv
42
+ prim_sec_anchor_flop.sv
43
+ prim_alert_sender.sv
44
+ prim_intr_hw.sv
45
+ prim_lc_sync.sv
46
+ prim_edge_detector.sv
47
+ prim_reg_cdc.sv
48
+ prim_reg_cdc_arb.sv
49
+ prim_pulse_sync.sv
50
+ prim_sync_reqack.sv
51
+ prim_secded_inv_22_16_dec.sv
52
+ prim_secded_inv_22_16_enc.sv
53
+ prim_secded_inv_28_22_dec.sv
54
+ prim_secded_inv_28_22_enc.sv
55
+ prim_secded_inv_39_32_dec.sv
56
+ prim_secded_inv_39_32_enc.sv
57
+ prim_secded_inv_64_57_dec.sv
58
+ prim_secded_inv_64_57_enc.sv
59
+ prim_secded_inv_72_64_dec.sv
60
+ prim_secded_inv_72_64_enc.sv
61
+ prim_secded_inv_hamming_22_16_dec.sv
62
+ prim_secded_inv_hamming_22_16_enc.sv
63
+ prim_secded_inv_hamming_39_32_dec.sv
64
+ prim_secded_inv_hamming_39_32_enc.sv
65
+ prim_secded_inv_hamming_72_64_dec.sv
66
+ prim_secded_inv_hamming_72_64_enc.sv
67
+ prim_secded_inv_hamming_76_68_dec.sv
68
+ prim_secded_inv_hamming_76_68_enc.sv
69
+ prim_util_memload.svh
70
+ )
71
+
72
+ PRIM_GENERIC_FILES=(
73
+ prim_buf.sv
74
+ prim_flop.sv
75
+ prim_flop_2sync.sv
76
+ prim_xnor2.sv
77
+ )
78
+
79
+ for f in "${PRIM_FILES[@]}"; do
80
+ cp "$PRIM_SRC/$f" "$WS/prim/"
81
+ done
82
+ for f in "${PRIM_GENERIC_FILES[@]}"; do
83
+ cp "$PRIM_GEN_SRC/$f" "$WS/prim/"
84
+ done
85
+ echo " Copied $((${#PRIM_FILES[@]} + ${#PRIM_GENERIC_FILES[@]})) prim files"
86
+
87
+ # ── TLUL modules ────────────────────────────────────────────────────
88
+ echo "[2/6] Copying TLUL modules..."
89
+ TLUL_SRC="$REPO_TOP/hw/ip/tlul/rtl"
90
+ TLUL_FILES=(
91
+ tlul_pkg.sv
92
+ tlul_adapter_reg.sv
93
+ tlul_cmd_intg_chk.sv
94
+ tlul_data_integ_dec.sv
95
+ tlul_data_integ_enc.sv
96
+ tlul_err.sv
97
+ tlul_rsp_intg_gen.sv
98
+ )
99
+ for f in "${TLUL_FILES[@]}"; do
100
+ cp "$TLUL_SRC/$f" "$WS/tlul/"
101
+ done
102
+ echo " Copied ${#TLUL_FILES[@]} TLUL files"
103
+
104
+ # ── Package files ───────────────────────────────────────────────────
105
+ echo "[3/6] Copying package files..."
106
+ cp "$REPO_TOP/hw/ip/adc_ctrl/rtl/adc_ctrl_reg_pkg.sv" "$WS/pkg/"
107
+ cp "$REPO_TOP/hw/ip/adc_ctrl/rtl/adc_ctrl_pkg.sv" "$WS/pkg/"
108
+ cp "$REPO_TOP/hw/top_earlgrey/rtl/top_pkg.sv" "$WS/pkg/"
109
+ cp "$REPO_TOP/hw/top_earlgrey/rtl/autogen/top_racl_pkg.sv" "$WS/pkg/"
110
+ cp "$REPO_TOP/hw/ip/lc_ctrl/rtl/lc_ctrl_pkg.sv" "$WS/pkg/"
111
+ cp "$REPO_TOP/hw/ip/lc_ctrl/rtl/lc_ctrl_reg_pkg.sv" "$WS/pkg/"
112
+ cp "$REPO_TOP/hw/ip/lc_ctrl/rtl/lc_ctrl_state_pkg.sv" "$WS/pkg/"
113
+
114
+ cat > "$WS/pkg/ast_pkg.sv" << 'ASTPKG'
115
+ // Copyright lowRISC contributors (OpenTitan project).
116
+ // Licensed under the Apache License, Version 2.0, see LICENSE for details.
117
+ // SPDX-License-Identifier: Apache-2.0
118
+ //
119
+ // Minimal ast_pkg stub exposing the ADC interface types used by adc_ctrl.
120
+ package ast_pkg;
121
+ parameter int unsigned AdcChannels = 2;
122
+ parameter int unsigned AdcDataWidth = 10;
123
+
124
+ typedef struct packed {
125
+ logic [AdcChannels-1:0] channel_sel;
126
+ logic pd;
127
+ } adc_ast_req_t;
128
+
129
+ typedef struct packed {
130
+ logic [AdcDataWidth-1:0] data;
131
+ logic data_valid;
132
+ } adc_ast_rsp_t;
133
+ endpackage
134
+ ASTPKG
135
+
136
+ echo " Copied packages"
137
+
138
+ # ── Spec documentation ──────────────────────────────────────────────
139
+ echo "[4/6] Copying spec documentation..."
140
+ cp "$REPO_TOP/hw/ip/adc_ctrl/doc/theory_of_operation.md" "$WS/spec/"
141
+ cp "$REPO_TOP/hw/ip/adc_ctrl/doc/registers.md" "$WS/spec/"
142
+ cp "$REPO_TOP/hw/ip/adc_ctrl/doc/interfaces.md" "$WS/spec/"
143
+ cp "$REPO_TOP/hw/ip/adc_ctrl/doc/programmers_guide.md" "$WS/spec/"
144
+ cp "$REPO_TOP/hw/ip/adc_ctrl/doc/adc_overview.svg" "$WS/spec/"
145
+ cp "$REPO_TOP/hw/ip/adc_ctrl/doc/debug_cable_regions.svg" "$WS/spec/"
146
+ cp "$REPO_TOP/hw/ip/adc_ctrl/data/adc_ctrl_testplan.hjson" "$WS/spec/"
147
+ echo " Copied spec docs"
148
+
149
+ # ── RTL: boilerplate + oracle for every module except adc_ctrl_core.sv ─
150
+ echo "[5/6] Copying RTL (all modules except adc_ctrl_core.sv)..."
151
+ ADC_RTL="$REPO_TOP/hw/ip/adc_ctrl/rtl"
152
+ cp "$ADC_RTL/adc_ctrl.sv" "$WS/rtl/"
153
+ cp "$ADC_RTL/adc_ctrl_reg_top.sv" "$WS/rtl/"
154
+ cp "$ADC_RTL/adc_ctrl_fsm.sv" "$WS/rtl/" # oracle — agent must not modify
155
+ cp "$ADC_RTL/adc_ctrl_intr.sv" "$WS/rtl/" # oracle — agent must not modify
156
+ echo " Copied 4 RTL files (adc_ctrl_core.sv is overlaid as a stub)"
157
+
158
+ # ── Run directory ────────────────────────────────────────────────────
159
+ echo "[6/6] Creating run directory..."
160
+
161
+ cat > "$WS/run/filelist.f" << 'FILELIST'
162
+ // Packages (order matters — dependencies first)
163
+ +incdir+../prim
164
+ ../prim/prim_assert.sv
165
+ ../prim/prim_util_pkg.sv
166
+ ../prim/prim_mubi_pkg.sv
167
+ ../prim/prim_alert_pkg.sv
168
+ ../prim/prim_subreg_pkg.sv
169
+ ../prim/prim_secded_pkg.sv
170
+ ../pkg/top_pkg.sv
171
+ ../tlul/tlul_pkg.sv
172
+ ../pkg/lc_ctrl_state_pkg.sv
173
+ ../pkg/lc_ctrl_reg_pkg.sv
174
+ ../pkg/lc_ctrl_pkg.sv
175
+ ../pkg/top_racl_pkg.sv
176
+ ../pkg/ast_pkg.sv
177
+ ../pkg/adc_ctrl_reg_pkg.sv
178
+ ../pkg/adc_ctrl_pkg.sv
179
+
180
+ // SECDED
181
+ ../prim/prim_secded_inv_64_57_enc.sv
182
+ ../prim/prim_secded_inv_64_57_dec.sv
183
+ ../prim/prim_secded_inv_39_32_enc.sv
184
+ ../prim/prim_secded_inv_39_32_dec.sv
185
+
186
+ // TLUL
187
+ ../tlul/tlul_err.sv
188
+ ../tlul/tlul_cmd_intg_chk.sv
189
+ ../tlul/tlul_rsp_intg_gen.sv
190
+ ../tlul/tlul_data_integ_dec.sv
191
+ ../tlul/tlul_data_integ_enc.sv
192
+ ../tlul/tlul_adapter_reg.sv
193
+
194
+ // Prim leaf modules
195
+ ../prim/prim_buf.sv
196
+ ../prim/prim_xnor2.sv
197
+ ../prim/prim_flop.sv
198
+ ../prim/prim_cdc_rand_delay.sv
199
+ ../prim/prim_flop_2sync.sv
200
+ ../prim/prim_onehot_enc.sv
201
+ ../prim/prim_onehot_check.sv
202
+ ../prim/prim_subreg_arb.sv
203
+ ../prim/prim_subreg.sv
204
+ ../prim/prim_subreg_ext.sv
205
+ ../prim/prim_reg_we_check.sv
206
+ ../prim/prim_sec_anchor_buf.sv
207
+ ../prim/prim_sec_anchor_flop.sv
208
+ ../prim/prim_alert_sender.sv
209
+ ../prim/prim_intr_hw.sv
210
+ ../prim/prim_lc_sync.sv
211
+ ../prim/prim_edge_detector.sv
212
+ ../prim/prim_reg_cdc_arb.sv
213
+ ../prim/prim_reg_cdc.sv
214
+ ../prim/prim_pulse_sync.sv
215
+ ../prim/prim_sync_reqack.sv
216
+
217
+ // ADC_CTRL
218
+ ../rtl/adc_ctrl_reg_top.sv
219
+ ../rtl/adc_ctrl_fsm.sv
220
+ ../rtl/adc_ctrl_intr.sv
221
+ ../rtl/adc_ctrl_core.sv
222
+ ../rtl/adc_ctrl.sv
223
+ FILELIST
224
+
225
+ cat > "$WS/run/Makefile" << 'MAKEFILE'
226
+ .PHONY: compile clean
227
+
228
+ compile:
229
+ @mkdir -p compile_log
230
+ xrun -c -64 -sv -access +rwc -elaborate \
231
+ -f filelist.f \
232
+ -timescale 1ns/1ps \
233
+ -l compile_log/compile.log 2>&1 || true
234
+ @echo "Check compile_log/compile.log"
235
+
236
+ clean:
237
+ rm -rf xcelium.d compile_log
238
+ MAKEFILE
239
+
240
+ echo " Created filelist.f and Makefile"
241
+
242
+ echo ""
243
+ echo "[verify] Workspace contents:"
244
+ for d in prim tlul pkg spec rtl run; do
245
+ count=$(find "$WS/$d" -type f 2>/dev/null | wc -l)
246
+ echo " $d/: $count files"
247
+ done
248
+
249
+ echo ""
250
+ echo "=== Workspace populated. adc_ctrl_core.sv stub added by environment Dockerfile. ==="
images/rtl/adc_ctrl-fsm/Dockerfile ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TitanBench ADC_CTRL-FSM-RTL — extends titanbench-base with OpenTitan infrastructure.
2
+ #
3
+ # Uses two build contexts:
4
+ # - default context (.) = OpenTitan repo root
5
+ # - titanbench = titanbench repo root
6
+ #
7
+ # Usage:
8
+ # docker build -f images/rtl/adc_ctrl-fsm/image/Dockerfile \
9
+ # --build-context titanbench=/path/to/titanbench \
10
+ # -t titanbench-adc-ctrl-fsm-rtl /path/to/opentitan
11
+
12
+ FROM titanbench-base:latest
13
+
14
+ # Copy the OpenTitan repo
15
+ COPY --chown=dev:dev . /home/dev/src/
16
+
17
+ # Copy the setup script from the titanbench repo
18
+ COPY --from=titanbench images/rtl/adc_ctrl-fsm/scripts/setup_workspace.sh /home/dev/scripts/setup_workspace.sh
19
+ RUN chmod +x /home/dev/scripts/setup_workspace.sh \
20
+ && bash /home/dev/scripts/setup_workspace.sh
21
+
22
+ # Git setup — dvsim requires a git repo with at least one commit
23
+ RUN git config --global --add safe.directory /home/dev/src \
24
+ && git config --global user.email "titanbench@opentitan.org" \
25
+ && git config --global user.name "TitanBench" \
26
+ && cd /home/dev/src \
27
+ && git init \
28
+ && git add -A \
29
+ && git commit -m "titanbench adc_ctrl-fsm-rtl base"
30
+
31
+ WORKDIR /home/dev/workspace/code
32
+ ENTRYPOINT []
33
+ CMD ["sh", "-c", "sleep infinity"]
images/rtl/adc_ctrl-fsm/scripts/setup_workspace.sh ADDED
@@ -0,0 +1,252 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Copyright lowRISC contributors (OpenTitan project).
3
+ # Licensed under the Apache License, Version 2.0, see LICENSE for details.
4
+ # SPDX-License-Identifier: Apache-2.0
5
+ #
6
+ # Populates the ADC_CTRL-FSM-RTL workspace with infrastructure + oracle RTL for
7
+ # every module except adc_ctrl_fsm.sv (which is overlaid as a stub by the
8
+ # environment Dockerfile).
9
+
10
+ set -euo pipefail
11
+
12
+ REPO_TOP="/home/dev/src"
13
+ WS="/home/dev/workspace/code"
14
+
15
+ echo "=== TitanBench: Populating ADC_CTRL-FSM-RTL workspace from OpenTitan ==="
16
+
17
+ mkdir -p "$WS"/{prim,tlul,pkg,spec,run,rtl}
18
+
19
+ # ── Prim modules ────────────────────────────────────────────────────
20
+ echo "[1/6] Copying prim modules..."
21
+ PRIM_SRC="$REPO_TOP/hw/ip/prim/rtl"
22
+ PRIM_GEN_SRC="$REPO_TOP/hw/ip/prim_generic/rtl"
23
+
24
+ PRIM_FILES=(
25
+ prim_alert_pkg.sv
26
+ prim_mubi_pkg.sv
27
+ prim_secded_pkg.sv
28
+ prim_subreg_pkg.sv
29
+ prim_util_pkg.sv
30
+ prim_assert.sv
31
+ prim_assert_sec_cm.svh
32
+ prim_assert_standard_macros.svh
33
+ prim_flop_macros.sv
34
+ prim_cdc_rand_delay.sv
35
+ prim_onehot_enc.sv
36
+ prim_onehot_check.sv
37
+ prim_subreg.sv
38
+ prim_subreg_arb.sv
39
+ prim_subreg_ext.sv
40
+ prim_reg_we_check.sv
41
+ prim_sec_anchor_buf.sv
42
+ prim_sec_anchor_flop.sv
43
+ prim_alert_sender.sv
44
+ prim_intr_hw.sv
45
+ prim_lc_sync.sv
46
+ prim_edge_detector.sv
47
+ prim_reg_cdc.sv
48
+ prim_reg_cdc_arb.sv
49
+ prim_pulse_sync.sv
50
+ prim_sync_reqack.sv
51
+ prim_secded_inv_22_16_dec.sv
52
+ prim_secded_inv_22_16_enc.sv
53
+ prim_secded_inv_28_22_dec.sv
54
+ prim_secded_inv_28_22_enc.sv
55
+ prim_secded_inv_39_32_dec.sv
56
+ prim_secded_inv_39_32_enc.sv
57
+ prim_secded_inv_64_57_dec.sv
58
+ prim_secded_inv_64_57_enc.sv
59
+ prim_secded_inv_72_64_dec.sv
60
+ prim_secded_inv_72_64_enc.sv
61
+ prim_secded_inv_hamming_22_16_dec.sv
62
+ prim_secded_inv_hamming_22_16_enc.sv
63
+ prim_secded_inv_hamming_39_32_dec.sv
64
+ prim_secded_inv_hamming_39_32_enc.sv
65
+ prim_secded_inv_hamming_72_64_dec.sv
66
+ prim_secded_inv_hamming_72_64_enc.sv
67
+ prim_secded_inv_hamming_76_68_dec.sv
68
+ prim_secded_inv_hamming_76_68_enc.sv
69
+ prim_util_memload.svh
70
+ )
71
+
72
+ PRIM_GENERIC_FILES=(
73
+ prim_buf.sv
74
+ prim_flop.sv
75
+ prim_flop_2sync.sv
76
+ prim_xnor2.sv
77
+ )
78
+
79
+ for f in "${PRIM_FILES[@]}"; do
80
+ cp "$PRIM_SRC/$f" "$WS/prim/"
81
+ done
82
+ for f in "${PRIM_GENERIC_FILES[@]}"; do
83
+ cp "$PRIM_GEN_SRC/$f" "$WS/prim/"
84
+ done
85
+ echo " Copied $((${#PRIM_FILES[@]} + ${#PRIM_GENERIC_FILES[@]})) prim files"
86
+
87
+ # ── TLUL modules ────────────────────────────────────────────────────
88
+ echo "[2/6] Copying TLUL modules..."
89
+ TLUL_SRC="$REPO_TOP/hw/ip/tlul/rtl"
90
+ TLUL_FILES=(
91
+ tlul_pkg.sv
92
+ tlul_adapter_reg.sv
93
+ tlul_cmd_intg_chk.sv
94
+ tlul_data_integ_dec.sv
95
+ tlul_data_integ_enc.sv
96
+ tlul_err.sv
97
+ tlul_rsp_intg_gen.sv
98
+ )
99
+ for f in "${TLUL_FILES[@]}"; do
100
+ cp "$TLUL_SRC/$f" "$WS/tlul/"
101
+ done
102
+ echo " Copied ${#TLUL_FILES[@]} TLUL files"
103
+
104
+ # ── Package files ───────────────────────────────────────────────────
105
+ echo "[3/6] Copying package files..."
106
+ cp "$REPO_TOP/hw/ip/adc_ctrl/rtl/adc_ctrl_reg_pkg.sv" "$WS/pkg/"
107
+ cp "$REPO_TOP/hw/ip/adc_ctrl/rtl/adc_ctrl_pkg.sv" "$WS/pkg/"
108
+ cp "$REPO_TOP/hw/top_earlgrey/rtl/top_pkg.sv" "$WS/pkg/"
109
+ cp "$REPO_TOP/hw/top_earlgrey/rtl/autogen/top_racl_pkg.sv" "$WS/pkg/"
110
+ cp "$REPO_TOP/hw/ip/lc_ctrl/rtl/lc_ctrl_pkg.sv" "$WS/pkg/"
111
+ cp "$REPO_TOP/hw/ip/lc_ctrl/rtl/lc_ctrl_reg_pkg.sv" "$WS/pkg/"
112
+ cp "$REPO_TOP/hw/ip/lc_ctrl/rtl/lc_ctrl_state_pkg.sv" "$WS/pkg/"
113
+
114
+ # Minimal ast_pkg exposing only the ADC-relevant types adc_ctrl needs.
115
+ cat > "$WS/pkg/ast_pkg.sv" << 'ASTPKG'
116
+ // Copyright lowRISC contributors (OpenTitan project).
117
+ // Licensed under the Apache License, Version 2.0, see LICENSE for details.
118
+ // SPDX-License-Identifier: Apache-2.0
119
+ //
120
+ // Minimal ast_pkg stub exposing the ADC interface types used by adc_ctrl.
121
+ // This replaces the full earlgrey ast_pkg.sv for local elaboration feedback.
122
+ package ast_pkg;
123
+ parameter int unsigned AdcChannels = 2;
124
+ parameter int unsigned AdcDataWidth = 10;
125
+
126
+ typedef struct packed {
127
+ logic [AdcChannels-1:0] channel_sel;
128
+ logic pd;
129
+ } adc_ast_req_t;
130
+
131
+ typedef struct packed {
132
+ logic [AdcDataWidth-1:0] data;
133
+ logic data_valid;
134
+ } adc_ast_rsp_t;
135
+ endpackage
136
+ ASTPKG
137
+
138
+ echo " Copied packages"
139
+
140
+ # ── Spec documentation ──────────────────────────────────────────────
141
+ echo "[4/6] Copying spec documentation..."
142
+ cp "$REPO_TOP/hw/ip/adc_ctrl/doc/theory_of_operation.md" "$WS/spec/"
143
+ cp "$REPO_TOP/hw/ip/adc_ctrl/doc/registers.md" "$WS/spec/"
144
+ cp "$REPO_TOP/hw/ip/adc_ctrl/doc/interfaces.md" "$WS/spec/"
145
+ cp "$REPO_TOP/hw/ip/adc_ctrl/doc/programmers_guide.md" "$WS/spec/"
146
+ cp "$REPO_TOP/hw/ip/adc_ctrl/doc/adc_overview.svg" "$WS/spec/"
147
+ cp "$REPO_TOP/hw/ip/adc_ctrl/doc/debug_cable_regions.svg" "$WS/spec/"
148
+ cp "$REPO_TOP/hw/ip/adc_ctrl/data/adc_ctrl_testplan.hjson" "$WS/spec/"
149
+ echo " Copied spec docs"
150
+
151
+ # ── RTL: boilerplate + oracle for every module except adc_ctrl_fsm.sv ─
152
+ echo "[5/6] Copying RTL (all modules except adc_ctrl_fsm.sv)..."
153
+ ADC_RTL="$REPO_TOP/hw/ip/adc_ctrl/rtl"
154
+ cp "$ADC_RTL/adc_ctrl.sv" "$WS/rtl/"
155
+ cp "$ADC_RTL/adc_ctrl_reg_top.sv" "$WS/rtl/"
156
+ cp "$ADC_RTL/adc_ctrl_core.sv" "$WS/rtl/" # oracle — agent must not modify
157
+ cp "$ADC_RTL/adc_ctrl_intr.sv" "$WS/rtl/" # oracle — agent must not modify
158
+ echo " Copied 4 RTL files (adc_ctrl_fsm.sv is overlaid as a stub)"
159
+
160
+ # ── Run directory ────────────────────────────────────────────────────
161
+ echo "[6/6] Creating run directory..."
162
+
163
+ cat > "$WS/run/filelist.f" << 'FILELIST'
164
+ // Packages (order matters — dependencies first)
165
+ +incdir+../prim
166
+ ../prim/prim_assert.sv
167
+ ../prim/prim_util_pkg.sv
168
+ ../prim/prim_mubi_pkg.sv
169
+ ../prim/prim_alert_pkg.sv
170
+ ../prim/prim_subreg_pkg.sv
171
+ ../prim/prim_secded_pkg.sv
172
+ ../pkg/top_pkg.sv
173
+ ../tlul/tlul_pkg.sv
174
+ ../pkg/lc_ctrl_state_pkg.sv
175
+ ../pkg/lc_ctrl_reg_pkg.sv
176
+ ../pkg/lc_ctrl_pkg.sv
177
+ ../pkg/top_racl_pkg.sv
178
+ ../pkg/ast_pkg.sv
179
+ ../pkg/adc_ctrl_reg_pkg.sv
180
+ ../pkg/adc_ctrl_pkg.sv
181
+
182
+ // SECDED
183
+ ../prim/prim_secded_inv_64_57_enc.sv
184
+ ../prim/prim_secded_inv_64_57_dec.sv
185
+ ../prim/prim_secded_inv_39_32_enc.sv
186
+ ../prim/prim_secded_inv_39_32_dec.sv
187
+
188
+ // TLUL
189
+ ../tlul/tlul_err.sv
190
+ ../tlul/tlul_cmd_intg_chk.sv
191
+ ../tlul/tlul_rsp_intg_gen.sv
192
+ ../tlul/tlul_data_integ_dec.sv
193
+ ../tlul/tlul_data_integ_enc.sv
194
+ ../tlul/tlul_adapter_reg.sv
195
+
196
+ // Prim leaf modules
197
+ ../prim/prim_buf.sv
198
+ ../prim/prim_xnor2.sv
199
+ ../prim/prim_flop.sv
200
+ ../prim/prim_cdc_rand_delay.sv
201
+ ../prim/prim_flop_2sync.sv
202
+ ../prim/prim_onehot_enc.sv
203
+ ../prim/prim_onehot_check.sv
204
+ ../prim/prim_subreg_arb.sv
205
+ ../prim/prim_subreg.sv
206
+ ../prim/prim_subreg_ext.sv
207
+ ../prim/prim_reg_we_check.sv
208
+ ../prim/prim_sec_anchor_buf.sv
209
+ ../prim/prim_sec_anchor_flop.sv
210
+ ../prim/prim_alert_sender.sv
211
+ ../prim/prim_intr_hw.sv
212
+ ../prim/prim_lc_sync.sv
213
+ ../prim/prim_edge_detector.sv
214
+ ../prim/prim_reg_cdc_arb.sv
215
+ ../prim/prim_reg_cdc.sv
216
+ ../prim/prim_pulse_sync.sv
217
+ ../prim/prim_sync_reqack.sv
218
+
219
+ // ADC_CTRL
220
+ ../rtl/adc_ctrl_reg_top.sv
221
+ ../rtl/adc_ctrl_fsm.sv
222
+ ../rtl/adc_ctrl_intr.sv
223
+ ../rtl/adc_ctrl_core.sv
224
+ ../rtl/adc_ctrl.sv
225
+ FILELIST
226
+
227
+ cat > "$WS/run/Makefile" << 'MAKEFILE'
228
+ .PHONY: compile clean
229
+
230
+ compile:
231
+ @mkdir -p compile_log
232
+ xrun -c -64 -sv -access +rwc -elaborate \
233
+ -f filelist.f \
234
+ -timescale 1ns/1ps \
235
+ -l compile_log/compile.log 2>&1 || true
236
+ @echo "Check compile_log/compile.log"
237
+
238
+ clean:
239
+ rm -rf xcelium.d compile_log
240
+ MAKEFILE
241
+
242
+ echo " Created filelist.f and Makefile"
243
+
244
+ echo ""
245
+ echo "[verify] Workspace contents:"
246
+ for d in prim tlul pkg spec rtl run; do
247
+ count=$(find "$WS/$d" -type f 2>/dev/null | wc -l)
248
+ echo " $d/: $count files"
249
+ done
250
+
251
+ echo ""
252
+ echo "=== Workspace populated. adc_ctrl_fsm.sv stub added by environment Dockerfile. ==="
images/rtl/adc_ctrl-intr/Dockerfile ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TitanBench ADC_CTRL-INTR-RTL — extends titanbench-base with OpenTitan infrastructure.
2
+ #
3
+ # Uses two build contexts:
4
+ # - default context (.) = OpenTitan repo root
5
+ # - titanbench = titanbench repo root
6
+ #
7
+ # Usage:
8
+ # docker build -f images/rtl/adc_ctrl-intr/image/Dockerfile \
9
+ # --build-context titanbench=/path/to/titanbench \
10
+ # -t titanbench-adc-ctrl-intr-rtl /path/to/opentitan
11
+
12
+ FROM titanbench-base:latest
13
+
14
+ COPY --chown=dev:dev . /home/dev/src/
15
+
16
+ COPY --from=titanbench images/rtl/adc_ctrl-intr/scripts/setup_workspace.sh /home/dev/scripts/setup_workspace.sh
17
+ RUN chmod +x /home/dev/scripts/setup_workspace.sh \
18
+ && bash /home/dev/scripts/setup_workspace.sh
19
+
20
+ RUN git config --global --add safe.directory /home/dev/src \
21
+ && git config --global user.email "titanbench@opentitan.org" \
22
+ && git config --global user.name "TitanBench" \
23
+ && cd /home/dev/src \
24
+ && git init \
25
+ && git add -A \
26
+ && git commit -m "titanbench adc_ctrl-intr-rtl base"
27
+
28
+ WORKDIR /home/dev/workspace/code
29
+ ENTRYPOINT []
30
+ CMD ["sh", "-c", "sleep infinity"]
images/rtl/adc_ctrl-intr/scripts/setup_workspace.sh ADDED
@@ -0,0 +1,250 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Copyright lowRISC contributors (OpenTitan project).
3
+ # Licensed under the Apache License, Version 2.0, see LICENSE for details.
4
+ # SPDX-License-Identifier: Apache-2.0
5
+ #
6
+ # Populates the ADC_CTRL-INTR-RTL workspace with infrastructure + oracle RTL for
7
+ # every module except adc_ctrl_intr.sv (which is overlaid as a stub by the
8
+ # environment Dockerfile).
9
+
10
+ set -euo pipefail
11
+
12
+ REPO_TOP="/home/dev/src"
13
+ WS="/home/dev/workspace/code"
14
+
15
+ echo "=== TitanBench: Populating ADC_CTRL-INTR-RTL workspace from OpenTitan ==="
16
+
17
+ mkdir -p "$WS"/{prim,tlul,pkg,spec,run,rtl}
18
+
19
+ # ── Prim modules ────────────────────────────────────────────────────
20
+ echo "[1/6] Copying prim modules..."
21
+ PRIM_SRC="$REPO_TOP/hw/ip/prim/rtl"
22
+ PRIM_GEN_SRC="$REPO_TOP/hw/ip/prim_generic/rtl"
23
+
24
+ PRIM_FILES=(
25
+ prim_alert_pkg.sv
26
+ prim_mubi_pkg.sv
27
+ prim_secded_pkg.sv
28
+ prim_subreg_pkg.sv
29
+ prim_util_pkg.sv
30
+ prim_assert.sv
31
+ prim_assert_sec_cm.svh
32
+ prim_assert_standard_macros.svh
33
+ prim_flop_macros.sv
34
+ prim_cdc_rand_delay.sv
35
+ prim_onehot_enc.sv
36
+ prim_onehot_check.sv
37
+ prim_subreg.sv
38
+ prim_subreg_arb.sv
39
+ prim_subreg_ext.sv
40
+ prim_reg_we_check.sv
41
+ prim_sec_anchor_buf.sv
42
+ prim_sec_anchor_flop.sv
43
+ prim_alert_sender.sv
44
+ prim_intr_hw.sv
45
+ prim_lc_sync.sv
46
+ prim_edge_detector.sv
47
+ prim_reg_cdc.sv
48
+ prim_reg_cdc_arb.sv
49
+ prim_pulse_sync.sv
50
+ prim_sync_reqack.sv
51
+ prim_secded_inv_22_16_dec.sv
52
+ prim_secded_inv_22_16_enc.sv
53
+ prim_secded_inv_28_22_dec.sv
54
+ prim_secded_inv_28_22_enc.sv
55
+ prim_secded_inv_39_32_dec.sv
56
+ prim_secded_inv_39_32_enc.sv
57
+ prim_secded_inv_64_57_dec.sv
58
+ prim_secded_inv_64_57_enc.sv
59
+ prim_secded_inv_72_64_dec.sv
60
+ prim_secded_inv_72_64_enc.sv
61
+ prim_secded_inv_hamming_22_16_dec.sv
62
+ prim_secded_inv_hamming_22_16_enc.sv
63
+ prim_secded_inv_hamming_39_32_dec.sv
64
+ prim_secded_inv_hamming_39_32_enc.sv
65
+ prim_secded_inv_hamming_72_64_dec.sv
66
+ prim_secded_inv_hamming_72_64_enc.sv
67
+ prim_secded_inv_hamming_76_68_dec.sv
68
+ prim_secded_inv_hamming_76_68_enc.sv
69
+ prim_util_memload.svh
70
+ )
71
+
72
+ PRIM_GENERIC_FILES=(
73
+ prim_buf.sv
74
+ prim_flop.sv
75
+ prim_flop_2sync.sv
76
+ prim_xnor2.sv
77
+ )
78
+
79
+ for f in "${PRIM_FILES[@]}"; do
80
+ cp "$PRIM_SRC/$f" "$WS/prim/"
81
+ done
82
+ for f in "${PRIM_GENERIC_FILES[@]}"; do
83
+ cp "$PRIM_GEN_SRC/$f" "$WS/prim/"
84
+ done
85
+ echo " Copied $((${#PRIM_FILES[@]} + ${#PRIM_GENERIC_FILES[@]})) prim files"
86
+
87
+ # ── TLUL modules ────────────────────────────────────────────────────
88
+ echo "[2/6] Copying TLUL modules..."
89
+ TLUL_SRC="$REPO_TOP/hw/ip/tlul/rtl"
90
+ TLUL_FILES=(
91
+ tlul_pkg.sv
92
+ tlul_adapter_reg.sv
93
+ tlul_cmd_intg_chk.sv
94
+ tlul_data_integ_dec.sv
95
+ tlul_data_integ_enc.sv
96
+ tlul_err.sv
97
+ tlul_rsp_intg_gen.sv
98
+ )
99
+ for f in "${TLUL_FILES[@]}"; do
100
+ cp "$TLUL_SRC/$f" "$WS/tlul/"
101
+ done
102
+ echo " Copied ${#TLUL_FILES[@]} TLUL files"
103
+
104
+ # ── Package files ───────────────────────────────────────────────────
105
+ echo "[3/6] Copying package files..."
106
+ cp "$REPO_TOP/hw/ip/adc_ctrl/rtl/adc_ctrl_reg_pkg.sv" "$WS/pkg/"
107
+ cp "$REPO_TOP/hw/ip/adc_ctrl/rtl/adc_ctrl_pkg.sv" "$WS/pkg/"
108
+ cp "$REPO_TOP/hw/top_earlgrey/rtl/top_pkg.sv" "$WS/pkg/"
109
+ cp "$REPO_TOP/hw/top_earlgrey/rtl/autogen/top_racl_pkg.sv" "$WS/pkg/"
110
+ cp "$REPO_TOP/hw/ip/lc_ctrl/rtl/lc_ctrl_pkg.sv" "$WS/pkg/"
111
+ cp "$REPO_TOP/hw/ip/lc_ctrl/rtl/lc_ctrl_reg_pkg.sv" "$WS/pkg/"
112
+ cp "$REPO_TOP/hw/ip/lc_ctrl/rtl/lc_ctrl_state_pkg.sv" "$WS/pkg/"
113
+
114
+ cat > "$WS/pkg/ast_pkg.sv" << 'ASTPKG'
115
+ // Copyright lowRISC contributors (OpenTitan project).
116
+ // Licensed under the Apache License, Version 2.0, see LICENSE for details.
117
+ // SPDX-License-Identifier: Apache-2.0
118
+ //
119
+ // Minimal ast_pkg stub exposing the ADC interface types used by adc_ctrl.
120
+ package ast_pkg;
121
+ parameter int unsigned AdcChannels = 2;
122
+ parameter int unsigned AdcDataWidth = 10;
123
+
124
+ typedef struct packed {
125
+ logic [AdcChannels-1:0] channel_sel;
126
+ logic pd;
127
+ } adc_ast_req_t;
128
+
129
+ typedef struct packed {
130
+ logic [AdcDataWidth-1:0] data;
131
+ logic data_valid;
132
+ } adc_ast_rsp_t;
133
+ endpackage
134
+ ASTPKG
135
+
136
+ echo " Copied packages"
137
+
138
+ # ── Spec documentation ──────────────────────────────────────────────
139
+ echo "[4/6] Copying spec documentation..."
140
+ cp "$REPO_TOP/hw/ip/adc_ctrl/doc/theory_of_operation.md" "$WS/spec/"
141
+ cp "$REPO_TOP/hw/ip/adc_ctrl/doc/registers.md" "$WS/spec/"
142
+ cp "$REPO_TOP/hw/ip/adc_ctrl/doc/interfaces.md" "$WS/spec/"
143
+ cp "$REPO_TOP/hw/ip/adc_ctrl/doc/programmers_guide.md" "$WS/spec/"
144
+ cp "$REPO_TOP/hw/ip/adc_ctrl/doc/adc_overview.svg" "$WS/spec/"
145
+ cp "$REPO_TOP/hw/ip/adc_ctrl/doc/debug_cable_regions.svg" "$WS/spec/"
146
+ cp "$REPO_TOP/hw/ip/adc_ctrl/data/adc_ctrl_testplan.hjson" "$WS/spec/"
147
+ echo " Copied spec docs"
148
+
149
+ # ── RTL: boilerplate + oracle for every module except adc_ctrl_intr.sv ─
150
+ echo "[5/6] Copying RTL (all modules except adc_ctrl_intr.sv)..."
151
+ ADC_RTL="$REPO_TOP/hw/ip/adc_ctrl/rtl"
152
+ cp "$ADC_RTL/adc_ctrl.sv" "$WS/rtl/"
153
+ cp "$ADC_RTL/adc_ctrl_reg_top.sv" "$WS/rtl/"
154
+ cp "$ADC_RTL/adc_ctrl_fsm.sv" "$WS/rtl/" # oracle — agent must not modify
155
+ cp "$ADC_RTL/adc_ctrl_core.sv" "$WS/rtl/" # oracle — agent must not modify
156
+ echo " Copied 4 RTL files (adc_ctrl_intr.sv is overlaid as a stub)"
157
+
158
+ # ── Run directory ────────────────────────────────────────────────────
159
+ echo "[6/6] Creating run directory..."
160
+
161
+ cat > "$WS/run/filelist.f" << 'FILELIST'
162
+ // Packages (order matters — dependencies first)
163
+ +incdir+../prim
164
+ ../prim/prim_assert.sv
165
+ ../prim/prim_util_pkg.sv
166
+ ../prim/prim_mubi_pkg.sv
167
+ ../prim/prim_alert_pkg.sv
168
+ ../prim/prim_subreg_pkg.sv
169
+ ../prim/prim_secded_pkg.sv
170
+ ../pkg/top_pkg.sv
171
+ ../tlul/tlul_pkg.sv
172
+ ../pkg/lc_ctrl_state_pkg.sv
173
+ ../pkg/lc_ctrl_reg_pkg.sv
174
+ ../pkg/lc_ctrl_pkg.sv
175
+ ../pkg/top_racl_pkg.sv
176
+ ../pkg/ast_pkg.sv
177
+ ../pkg/adc_ctrl_reg_pkg.sv
178
+ ../pkg/adc_ctrl_pkg.sv
179
+
180
+ // SECDED
181
+ ../prim/prim_secded_inv_64_57_enc.sv
182
+ ../prim/prim_secded_inv_64_57_dec.sv
183
+ ../prim/prim_secded_inv_39_32_enc.sv
184
+ ../prim/prim_secded_inv_39_32_dec.sv
185
+
186
+ // TLUL
187
+ ../tlul/tlul_err.sv
188
+ ../tlul/tlul_cmd_intg_chk.sv
189
+ ../tlul/tlul_rsp_intg_gen.sv
190
+ ../tlul/tlul_data_integ_dec.sv
191
+ ../tlul/tlul_data_integ_enc.sv
192
+ ../tlul/tlul_adapter_reg.sv
193
+
194
+ // Prim leaf modules
195
+ ../prim/prim_buf.sv
196
+ ../prim/prim_xnor2.sv
197
+ ../prim/prim_flop.sv
198
+ ../prim/prim_cdc_rand_delay.sv
199
+ ../prim/prim_flop_2sync.sv
200
+ ../prim/prim_onehot_enc.sv
201
+ ../prim/prim_onehot_check.sv
202
+ ../prim/prim_subreg_arb.sv
203
+ ../prim/prim_subreg.sv
204
+ ../prim/prim_subreg_ext.sv
205
+ ../prim/prim_reg_we_check.sv
206
+ ../prim/prim_sec_anchor_buf.sv
207
+ ../prim/prim_sec_anchor_flop.sv
208
+ ../prim/prim_alert_sender.sv
209
+ ../prim/prim_intr_hw.sv
210
+ ../prim/prim_lc_sync.sv
211
+ ../prim/prim_edge_detector.sv
212
+ ../prim/prim_reg_cdc_arb.sv
213
+ ../prim/prim_reg_cdc.sv
214
+ ../prim/prim_pulse_sync.sv
215
+ ../prim/prim_sync_reqack.sv
216
+
217
+ // ADC_CTRL
218
+ ../rtl/adc_ctrl_reg_top.sv
219
+ ../rtl/adc_ctrl_fsm.sv
220
+ ../rtl/adc_ctrl_intr.sv
221
+ ../rtl/adc_ctrl_core.sv
222
+ ../rtl/adc_ctrl.sv
223
+ FILELIST
224
+
225
+ cat > "$WS/run/Makefile" << 'MAKEFILE'
226
+ .PHONY: compile clean
227
+
228
+ compile:
229
+ @mkdir -p compile_log
230
+ xrun -c -64 -sv -access +rwc -elaborate \
231
+ -f filelist.f \
232
+ -timescale 1ns/1ps \
233
+ -l compile_log/compile.log 2>&1 || true
234
+ @echo "Check compile_log/compile.log"
235
+
236
+ clean:
237
+ rm -rf xcelium.d compile_log
238
+ MAKEFILE
239
+
240
+ echo " Created filelist.f and Makefile"
241
+
242
+ echo ""
243
+ echo "[verify] Workspace contents:"
244
+ for d in prim tlul pkg spec rtl run; do
245
+ count=$(find "$WS/$d" -type f 2>/dev/null | wc -l)
246
+ echo " $d/: $count files"
247
+ done
248
+
249
+ echo ""
250
+ echo "=== Workspace populated. adc_ctrl_intr.sv stub added by environment Dockerfile. ==="
images/rtl/adc_ctrl/Dockerfile ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TitanBench ADC_CTRL-RTL — extends titanbench-base with OpenTitan infrastructure.
2
+ #
3
+ # Uses two build contexts:
4
+ # - default context (.) = OpenTitan repo root
5
+ # - titanbench = titanbench repo root
6
+ #
7
+ # Usage:
8
+ # docker build -f images/rtl/adc_ctrl/image/Dockerfile \
9
+ # --build-context titanbench=/path/to/titanbench \
10
+ # -t titanbench-adc_ctrl-rtl /path/to/opentitan
11
+
12
+ FROM titanbench-base:latest
13
+
14
+ # Copy the OpenTitan repo
15
+ COPY --chown=dev:dev . /home/dev/src/
16
+
17
+ # Copy the setup script from the titanbench repo
18
+ COPY --from=titanbench tasks_missing_rtl/adc_ctrl-rtl/scripts/setup_workspace.sh /home/dev/scripts/setup_workspace.sh
19
+ RUN chmod +x /home/dev/scripts/setup_workspace.sh \
20
+ && bash /home/dev/scripts/setup_workspace.sh
21
+
22
+ # Git setup — dvsim requires a git repo with at least one commit
23
+ RUN git config --global --add safe.directory /home/dev/src \
24
+ && git config --global user.email "titanbench@opentitan.org" \
25
+ && git config --global user.name "TitanBench" \
26
+ && cd /home/dev/src \
27
+ && git init \
28
+ && git add -A \
29
+ && git commit -m "titanbench adc_ctrl-rtl base"
30
+
31
+ WORKDIR /home/dev/workspace/code
32
+ ENTRYPOINT []
33
+ CMD ["sh", "-c", "sleep infinity"]
images/rtl/adc_ctrl/scripts/setup_workspace.sh ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ REPO_TOP="/home/dev/src"
4
+ WS="/home/dev/workspace/code"
5
+ ADC_SRC="$REPO_TOP/hw/ip/adc_ctrl"
6
+ mkdir -p "$WS"/{prim,tlul,pkg,spec,run,rtl}
7
+ PRIM_SRC="$REPO_TOP/hw/ip/prim/rtl"
8
+ PRIM_GEN_SRC="$REPO_TOP/hw/ip/prim_generic/rtl"
9
+ PRIM_FILES=(
10
+ prim_alert_pkg.sv prim_mubi_pkg.sv prim_secded_pkg.sv prim_subreg_pkg.sv prim_util_pkg.sv
11
+ prim_assert.sv prim_assert_sec_cm.svh prim_assert_standard_macros.svh prim_flop_macros.sv
12
+ prim_cdc_rand_delay.sv prim_onehot_enc.sv prim_onehot_check.sv prim_subreg.sv prim_subreg_arb.sv
13
+ prim_subreg_ext.sv prim_reg_we_check.sv prim_sec_anchor_buf.sv prim_sec_anchor_flop.sv
14
+ prim_alert_sender.sv prim_intr_hw.sv prim_lc_sync.sv prim_edge_detector.sv prim_reg_cdc.sv
15
+ prim_reg_cdc_arb.sv prim_pulse_sync.sv prim_sync_reqack.sv
16
+ prim_secded_inv_22_16_dec.sv prim_secded_inv_22_16_enc.sv prim_secded_inv_28_22_dec.sv
17
+ prim_secded_inv_28_22_enc.sv prim_secded_inv_39_32_dec.sv prim_secded_inv_39_32_enc.sv
18
+ prim_secded_inv_64_57_dec.sv prim_secded_inv_64_57_enc.sv prim_secded_inv_72_64_dec.sv
19
+ prim_secded_inv_72_64_enc.sv prim_secded_inv_hamming_22_16_dec.sv prim_secded_inv_hamming_22_16_enc.sv
20
+ prim_secded_inv_hamming_39_32_dec.sv prim_secded_inv_hamming_39_32_enc.sv
21
+ prim_secded_inv_hamming_72_64_dec.sv prim_secded_inv_hamming_72_64_enc.sv
22
+ prim_secded_inv_hamming_76_68_dec.sv prim_secded_inv_hamming_76_68_enc.sv prim_util_memload.svh
23
+ )
24
+ PRIM_GENERIC_FILES=(prim_buf.sv prim_flop.sv prim_flop_2sync.sv prim_xnor2.sv)
25
+ for f in "${PRIM_FILES[@]}"; do cp "$PRIM_SRC/$f" "$WS/prim/"; done
26
+ for f in "${PRIM_GENERIC_FILES[@]}"; do cp "$PRIM_GEN_SRC/$f" "$WS/prim/"; done
27
+ TLUL_SRC="$REPO_TOP/hw/ip/tlul/rtl"
28
+ for f in tlul_pkg.sv tlul_adapter_reg.sv tlul_cmd_intg_chk.sv tlul_data_integ_dec.sv tlul_data_integ_enc.sv tlul_err.sv tlul_rsp_intg_gen.sv; do cp "$TLUL_SRC/$f" "$WS/tlul/"; done
29
+ cp "$ADC_SRC/rtl/adc_ctrl_reg_pkg.sv" "$WS/pkg/"
30
+ cp "$ADC_SRC/rtl/adc_ctrl_pkg.sv" "$WS/pkg/"
31
+ cp "$REPO_TOP/hw/top_earlgrey/rtl/top_pkg.sv" "$WS/pkg/"
32
+ cp "$REPO_TOP/hw/top_earlgrey/rtl/autogen/top_racl_pkg.sv" "$WS/pkg/"
33
+ cp "$REPO_TOP/hw/ip/lc_ctrl/rtl/lc_ctrl_pkg.sv" "$WS/pkg/"
34
+ cp "$REPO_TOP/hw/ip/lc_ctrl/rtl/lc_ctrl_reg_pkg.sv" "$WS/pkg/"
35
+ cp "$REPO_TOP/hw/ip/lc_ctrl/rtl/lc_ctrl_state_pkg.sv" "$WS/pkg/"
36
+ cat > "$WS/pkg/ast_pkg.sv" <<'ASTPKG'
37
+ package ast_pkg;
38
+ parameter int unsigned AdcChannels = 2;
39
+ parameter int unsigned AdcDataWidth = 10;
40
+ typedef struct packed {
41
+ logic [AdcChannels-1:0] channel_sel;
42
+ logic pd;
43
+ } adc_ast_req_t;
44
+ typedef struct packed {
45
+ logic [AdcDataWidth-1:0] data;
46
+ logic data_valid;
47
+ } adc_ast_rsp_t;
48
+ endpackage
49
+ ASTPKG
50
+ for f in theory_of_operation.md registers.md interfaces.md programmers_guide.md adc_overview.svg debug_cable_regions.svg; do cp "$ADC_SRC/doc/$f" "$WS/spec/" 2>/dev/null || true; done
51
+ cp "$ADC_SRC/data/adc_ctrl_testplan.hjson" "$WS/spec/" 2>/dev/null || true
52
+ cp "$ADC_SRC/rtl/adc_ctrl.sv" "$WS/rtl/"
53
+ cp "$ADC_SRC/rtl/adc_ctrl_reg_top.sv" "$WS/rtl/"
54
+ cat > "$WS/run/filelist.f" <<'FILELIST'
55
+ +incdir+../prim
56
+ ../prim/prim_assert.sv
57
+ ../prim/prim_util_pkg.sv
58
+ ../prim/prim_mubi_pkg.sv
59
+ ../prim/prim_alert_pkg.sv
60
+ ../prim/prim_subreg_pkg.sv
61
+ ../prim/prim_secded_pkg.sv
62
+ ../pkg/top_pkg.sv
63
+ ../tlul/tlul_pkg.sv
64
+ ../pkg/lc_ctrl_state_pkg.sv
65
+ ../pkg/lc_ctrl_reg_pkg.sv
66
+ ../pkg/lc_ctrl_pkg.sv
67
+ ../pkg/top_racl_pkg.sv
68
+ ../pkg/ast_pkg.sv
69
+ ../pkg/adc_ctrl_reg_pkg.sv
70
+ ../pkg/adc_ctrl_pkg.sv
71
+ ../prim/prim_secded_inv_64_57_enc.sv
72
+ ../prim/prim_secded_inv_64_57_dec.sv
73
+ ../prim/prim_secded_inv_39_32_enc.sv
74
+ ../prim/prim_secded_inv_39_32_dec.sv
75
+ ../tlul/tlul_err.sv
76
+ ../tlul/tlul_cmd_intg_chk.sv
77
+ ../tlul/tlul_rsp_intg_gen.sv
78
+ ../tlul/tlul_data_integ_dec.sv
79
+ ../tlul/tlul_data_integ_enc.sv
80
+ ../tlul/tlul_adapter_reg.sv
81
+ ../prim/prim_buf.sv
82
+ ../prim/prim_xnor2.sv
83
+ ../prim/prim_flop.sv
84
+ ../prim/prim_cdc_rand_delay.sv
85
+ ../prim/prim_flop_2sync.sv
86
+ ../prim/prim_onehot_enc.sv
87
+ ../prim/prim_onehot_check.sv
88
+ ../prim/prim_subreg_arb.sv
89
+ ../prim/prim_subreg.sv
90
+ ../prim/prim_subreg_ext.sv
91
+ ../prim/prim_reg_we_check.sv
92
+ ../prim/prim_sec_anchor_buf.sv
93
+ ../prim/prim_sec_anchor_flop.sv
94
+ ../prim/prim_alert_sender.sv
95
+ ../prim/prim_intr_hw.sv
96
+ ../prim/prim_lc_sync.sv
97
+ ../prim/prim_edge_detector.sv
98
+ ../prim/prim_reg_cdc_arb.sv
99
+ ../prim/prim_reg_cdc.sv
100
+ ../prim/prim_pulse_sync.sv
101
+ ../prim/prim_sync_reqack.sv
102
+ ../rtl/adc_ctrl_reg_top.sv
103
+ ../rtl/adc_ctrl_fsm.sv
104
+ ../rtl/adc_ctrl_intr.sv
105
+ ../rtl/adc_ctrl_core.sv
106
+ ../rtl/adc_ctrl.sv
107
+ FILELIST
108
+ cat > "$WS/run/Makefile" <<'MAKEFILE'
109
+ .PHONY: compile clean
110
+ compile:
111
+ @mkdir -p compile_log
112
+ xrun -c -64 -sv -access +rwc -elaborate -f filelist.f -timescale 1ns/1ps -l compile_log/compile.log 2>&1 || true
113
+ @echo "Check compile_log/compile.log"
114
+ clean:
115
+ rm -rf xcelium.d compile_log
116
+ MAKEFILE
images/rtl/aes/Dockerfile ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TitanBench AES-RTL — extends titanbench-base with OpenTitan infrastructure.
2
+ #
3
+ # Uses two build contexts:
4
+ # - default context (.) = OpenTitan repo root
5
+ # - titanbench = titanbench repo root
6
+ #
7
+ # Usage:
8
+ # docker build -f images/rtl/aes/image/Dockerfile \
9
+ # --build-context titanbench=/path/to/titanbench \
10
+ # -t titanbench-aes-rtl /path/to/opentitan
11
+
12
+ FROM titanbench-base:latest
13
+
14
+ # Copy the OpenTitan repo
15
+ COPY --chown=dev:dev . /home/dev/src/
16
+
17
+ # Copy the setup script from the titanbench repo
18
+ COPY --from=titanbench images/rtl/aes/scripts/setup_workspace.sh /home/dev/scripts/setup_workspace.sh
19
+ RUN chmod +x /home/dev/scripts/setup_workspace.sh \
20
+ && bash /home/dev/scripts/setup_workspace.sh
21
+
22
+ # Git setup — dvsim requires a git repo with at least one commit
23
+ RUN git config --global --add safe.directory /home/dev/src \
24
+ && git config --global user.email "titanbench@opentitan.org" \
25
+ && git config --global user.name "TitanBench" \
26
+ && cd /home/dev/src \
27
+ && git init \
28
+ && git add -A \
29
+ && git commit -m "titanbench aes-rtl base"
30
+
31
+ WORKDIR /home/dev/workspace/code
32
+ ENTRYPOINT []
33
+ CMD ["sh", "-c", "sleep infinity"]
images/rtl/aes/scripts/setup_workspace.sh ADDED
@@ -0,0 +1,343 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Copyright lowRISC contributors (OpenTitan project).
3
+ # Licensed under the Apache License, Version 2.0, see LICENSE for details.
4
+ # SPDX-License-Identifier: Apache-2.0
5
+ #
6
+ # Populates the AES-RTL workspace with infrastructure files from OpenTitan.
7
+ # Copies prim, tlul, pkg, and spec docs — but NOT ground-truth RTL.
8
+ #
9
+ # Run at image build time. Build context = OpenTitan repo root.
10
+
11
+ set -euo pipefail
12
+
13
+ REPO_TOP="/home/dev/src"
14
+ WS="/home/dev/workspace/code"
15
+
16
+ echo "=== TitanBench: Populating AES-RTL workspace from OpenTitan ==="
17
+
18
+ # ── Create workspace directories ─────────────────────────────────────
19
+ mkdir -p "$WS"/{prim,tlul,pkg,spec}
20
+
21
+ # ── Prim modules (from hw/ip/prim/rtl/) ─────────────────────────────
22
+ echo "[1/5] Copying prim modules..."
23
+ PRIM_SRC="$REPO_TOP/hw/ip/prim/rtl"
24
+ PRIM_GEN_SRC="$REPO_TOP/hw/ip/prim_generic/rtl"
25
+
26
+ # Files from hw/ip/prim/rtl/
27
+ PRIM_FILES=(
28
+ # Packages
29
+ prim_alert_pkg.sv
30
+ prim_cipher_pkg.sv
31
+ prim_count_pkg.sv
32
+ prim_mubi_pkg.sv
33
+ prim_secded_pkg.sv
34
+ prim_subreg_pkg.sv
35
+ prim_trivium_pkg.sv
36
+ prim_util_pkg.sv
37
+ # Assertion headers
38
+ prim_assert.sv
39
+ prim_assert_sec_cm.svh
40
+ prim_assert_standard_macros.svh
41
+ # FIFO / memory
42
+ prim_fifo_assert.svh
43
+ prim_fifo_sync.sv
44
+ prim_fifo_sync_cnt.sv
45
+ prim_packer_fifo.sv
46
+ prim_ram_1p_adv.sv
47
+ # Flops
48
+ prim_flop_macros.sv
49
+ prim_cdc_rand_delay.sv
50
+ prim_sparse_fsm_flop.sv
51
+ # Combinational
52
+ prim_onehot_enc.sv
53
+ prim_onehot_check.sv
54
+ prim_onehot_mux.sv
55
+ prim_count.sv
56
+ prim_diff_decode.sv
57
+ prim_blanker.sv
58
+ # Subreg
59
+ prim_subreg.sv
60
+ prim_subreg_arb.sv
61
+ prim_subreg_ext.sv
62
+ prim_subreg_shadow.sv
63
+ prim_reg_we_check.sv
64
+ # Security
65
+ prim_sec_anchor_buf.sv
66
+ prim_sec_anchor_const.sv
67
+ prim_sec_anchor_flop.sv
68
+ prim_alert_sender.sv
69
+ prim_intr_hw.sv
70
+ # Synchronization
71
+ prim_lc_dec.sv
72
+ prim_lc_sync.sv
73
+ prim_sync_reqack.sv
74
+ prim_sync_reqack_data.sv
75
+ prim_mubi4_dec.sv
76
+ prim_mubi4_sender.sv
77
+ prim_mubi4_sync.sv
78
+ prim_mubi8_dec.sv
79
+ prim_mubi8_sender.sv
80
+ prim_mubi8_sync.sv
81
+ # Crypto / LFSR
82
+ prim_dom_and_2share.sv
83
+ prim_double_lfsr.sv
84
+ prim_edn_req.sv
85
+ prim_gf_mult.sv
86
+ prim_lfsr.sv
87
+ prim_subst_perm.sv
88
+ prim_trivium.sv
89
+ # Arbitration
90
+ prim_arbiter_fixed.sv
91
+ prim_arbiter_tree.sv
92
+ # SECDED (integrity)
93
+ prim_secded_inv_22_16_dec.sv
94
+ prim_secded_inv_22_16_enc.sv
95
+ prim_secded_inv_28_22_dec.sv
96
+ prim_secded_inv_28_22_enc.sv
97
+ prim_secded_inv_39_32_dec.sv
98
+ prim_secded_inv_39_32_enc.sv
99
+ prim_secded_inv_64_57_dec.sv
100
+ prim_secded_inv_64_57_enc.sv
101
+ prim_secded_inv_72_64_dec.sv
102
+ prim_secded_inv_72_64_enc.sv
103
+ prim_secded_inv_hamming_22_16_dec.sv
104
+ prim_secded_inv_hamming_22_16_enc.sv
105
+ prim_secded_inv_hamming_39_32_dec.sv
106
+ prim_secded_inv_hamming_39_32_enc.sv
107
+ prim_secded_inv_hamming_72_64_dec.sv
108
+ prim_secded_inv_hamming_72_64_enc.sv
109
+ prim_secded_inv_hamming_76_68_dec.sv
110
+ prim_secded_inv_hamming_76_68_enc.sv
111
+ # Misc headers
112
+ prim_util_memload.svh
113
+ )
114
+
115
+ # Files from hw/ip/prim_generic/rtl/ (technology-independent implementations)
116
+ PRIM_GENERIC_FILES=(
117
+ prim_and2.sv
118
+ prim_buf.sv
119
+ prim_flop.sv
120
+ prim_flop_2sync.sv
121
+ prim_flop_en.sv
122
+ prim_ram_1p.sv
123
+ prim_ram_1p_pkg.sv
124
+ prim_xnor2.sv
125
+ prim_xor2.sv
126
+ )
127
+
128
+ for f in "${PRIM_FILES[@]}"; do
129
+ cp "$PRIM_SRC/$f" "$WS/prim/"
130
+ done
131
+ for f in "${PRIM_GENERIC_FILES[@]}"; do
132
+ cp "$PRIM_GEN_SRC/$f" "$WS/prim/"
133
+ done
134
+ echo " Copied $((${#PRIM_FILES[@]} + ${#PRIM_GENERIC_FILES[@]})) prim files"
135
+
136
+ # ── TLUL modules (from hw/ip/tlul/rtl/) ─────────────────────────────
137
+ echo "[2/5] Copying TLUL modules..."
138
+ TLUL_SRC="$REPO_TOP/hw/ip/tlul/rtl"
139
+
140
+ TLUL_FILES=(
141
+ tlul_pkg.sv
142
+ tlul_adapter_reg.sv
143
+ tlul_cmd_intg_chk.sv
144
+ tlul_data_integ_dec.sv
145
+ tlul_data_integ_enc.sv
146
+ tlul_err.sv
147
+ tlul_rsp_intg_gen.sv
148
+ )
149
+
150
+ for f in "${TLUL_FILES[@]}"; do
151
+ cp "$TLUL_SRC/$f" "$WS/tlul/"
152
+ done
153
+ echo " Copied ${#TLUL_FILES[@]} TLUL files"
154
+
155
+ # ── Package files (from various IPs) ────────────────────────────────
156
+ echo "[3/5] Copying package files..."
157
+
158
+ # AES-specific
159
+ cp "$REPO_TOP/hw/ip/aes/rtl/aes_pkg.sv" "$WS/pkg/"
160
+ cp "$REPO_TOP/hw/ip/aes/rtl/aes_reg_pkg.sv" "$WS/pkg/"
161
+ cp "$REPO_TOP/hw/ip/aes/rtl/aes_sbox_canright_pkg.sv" "$WS/pkg/"
162
+
163
+ # CSRNG / EDN / Entropy / KeyMgr dependencies
164
+ cp "$REPO_TOP/hw/ip/csrng/rtl/csrng_pkg.sv" "$WS/pkg/"
165
+ cp "$REPO_TOP/hw/ip/csrng/rtl/csrng_reg_pkg.sv" "$WS/pkg/"
166
+ cp "$REPO_TOP/hw/ip/edn/rtl/edn_pkg.sv" "$WS/pkg/"
167
+ cp "$REPO_TOP/hw/ip/entropy_src/rtl/entropy_src_pkg.sv" "$WS/pkg/"
168
+ cp "$REPO_TOP/hw/ip/keymgr/rtl/keymgr_pkg.sv" "$WS/pkg/"
169
+ cp "$REPO_TOP/hw/ip/keymgr/rtl/keymgr_reg_pkg.sv" "$WS/pkg/"
170
+
171
+ # Shared
172
+ cp "$REPO_TOP/hw/ip/lc_ctrl/rtl/lc_ctrl_pkg.sv" "$WS/pkg/"
173
+ cp "$REPO_TOP/hw/ip/lc_ctrl/rtl/lc_ctrl_reg_pkg.sv" "$WS/pkg/"
174
+ cp "$REPO_TOP/hw/ip/lc_ctrl/rtl/lc_ctrl_state_pkg.sv" "$WS/pkg/"
175
+ cp "$REPO_TOP/hw/top_earlgrey/rtl/top_pkg.sv" "$WS/pkg/"
176
+ cp "$REPO_TOP/hw/top_earlgrey/rtl/autogen/top_racl_pkg.sv" "$WS/pkg/"
177
+
178
+ echo " Copied 14 package files"
179
+
180
+ # ── Spec documentation (from hw/ip/aes/doc/) ────────────────────────
181
+ echo "[4/5] Copying spec documentation..."
182
+
183
+ cp "$REPO_TOP/hw/ip/aes/doc/theory_of_operation.md" "$WS/spec/"
184
+ cp "$REPO_TOP/hw/ip/aes/doc/registers.md" "$WS/spec/"
185
+ cp "$REPO_TOP/hw/ip/aes/doc/interfaces.md" "$WS/spec/"
186
+ cp "$REPO_TOP/hw/ip/aes/doc/programmers_guide.md" "$WS/spec/"
187
+ cp "$REPO_TOP/hw/ip/aes/data/aes_testplan.hjson" "$WS/spec/"
188
+ cp "$REPO_TOP/hw/ip/aes/data/aes.hjson" "$WS/spec/"
189
+ cp "$REPO_TOP/hw/ip/aes/data/aes_sec_cm_testplan.hjson" "$WS/spec/" 2>/dev/null || true
190
+
191
+ echo " Copied spec docs"
192
+
193
+ # ── Run directory (filelist + Makefile) ──────────────────────────────
194
+ echo "[5/6] Creating run directory..."
195
+ mkdir -p "$WS/run"
196
+
197
+ cat > "$WS/run/filelist.f" << 'FILELIST'
198
+ // Packages (order matters - dependencies first)
199
+ +incdir+../prim
200
+ ../prim/prim_assert.sv
201
+ ../prim/prim_util_pkg.sv
202
+ ../prim/prim_mubi_pkg.sv
203
+ ../prim/prim_alert_pkg.sv
204
+ ../prim/prim_subreg_pkg.sv
205
+ ../prim/prim_secded_pkg.sv
206
+ ../prim/prim_count_pkg.sv
207
+ ../prim/prim_ram_1p_pkg.sv
208
+ ../prim/prim_cipher_pkg.sv
209
+ ../prim/prim_trivium_pkg.sv
210
+ ../pkg/top_pkg.sv
211
+ ../tlul/tlul_pkg.sv
212
+ ../pkg/lc_ctrl_state_pkg.sv
213
+ ../pkg/lc_ctrl_reg_pkg.sv
214
+ ../pkg/lc_ctrl_pkg.sv
215
+ ../pkg/top_racl_pkg.sv
216
+ ../pkg/entropy_src_pkg.sv
217
+ ../pkg/csrng_reg_pkg.sv
218
+ ../pkg/csrng_pkg.sv
219
+ ../pkg/edn_pkg.sv
220
+ ../pkg/keymgr_reg_pkg.sv
221
+ ../pkg/keymgr_pkg.sv
222
+ ../pkg/aes_sbox_canright_pkg.sv
223
+ ../pkg/aes_reg_pkg.sv
224
+ ../pkg/aes_pkg.sv
225
+
226
+ // SECDED encoder/decoder modules (used by TLUL integrity)
227
+ ../prim/prim_secded_inv_64_57_enc.sv
228
+ ../prim/prim_secded_inv_64_57_dec.sv
229
+ ../prim/prim_secded_inv_39_32_enc.sv
230
+ ../prim/prim_secded_inv_39_32_dec.sv
231
+
232
+ // TLUL modules
233
+ ../tlul/tlul_err.sv
234
+ ../tlul/tlul_cmd_intg_chk.sv
235
+ ../tlul/tlul_rsp_intg_gen.sv
236
+ ../tlul/tlul_data_integ_dec.sv
237
+ ../tlul/tlul_data_integ_enc.sv
238
+ ../tlul/tlul_adapter_reg.sv
239
+
240
+ // Prim modules (leaf first)
241
+ ../prim/prim_buf.sv
242
+ ../prim/prim_and2.sv
243
+ ../prim/prim_xor2.sv
244
+ ../prim/prim_xnor2.sv
245
+ ../prim/prim_flop.sv
246
+ ../prim/prim_flop_en.sv
247
+ ../prim/prim_cdc_rand_delay.sv
248
+ ../prim/prim_flop_2sync.sv
249
+ ../prim/prim_onehot_enc.sv
250
+ ../prim/prim_onehot_check.sv
251
+ ../prim/prim_onehot_mux.sv
252
+ ../prim/prim_count.sv
253
+ ../prim/prim_subreg_arb.sv
254
+ ../prim/prim_subreg.sv
255
+ ../prim/prim_subreg_ext.sv
256
+ ../prim/prim_subreg_shadow.sv
257
+ ../prim/prim_reg_we_check.sv
258
+ ../prim/prim_sec_anchor_buf.sv
259
+ ../prim/prim_sec_anchor_flop.sv
260
+ ../prim/prim_sec_anchor_const.sv
261
+ ../prim/prim_diff_decode.sv
262
+ ../prim/prim_alert_sender.sv
263
+ ../prim/prim_lc_sync.sv
264
+ ../prim/prim_sync_reqack.sv
265
+ ../prim/prim_sync_reqack_data.sv
266
+ ../prim/prim_lfsr.sv
267
+ ../prim/prim_trivium.sv
268
+ ../prim/prim_blanker.sv
269
+ ../prim/prim_sparse_fsm_flop.sv
270
+ ../prim/prim_packer_fifo.sv
271
+ ../prim/prim_gf_mult.sv
272
+
273
+ // AES RTL (boilerplate - provided)
274
+ ../rtl/aes_reg_top.sv
275
+ ../rtl/aes_ctrl_reg_shadowed.sv
276
+ ../rtl/aes_ctrl_gcm_reg_shadowed.sv
277
+ ../rtl/aes_reg_status.sv
278
+ ../rtl/aes_ghash.sv
279
+ ../rtl/aes_ghash_wrap.sv
280
+
281
+ // AES RTL (agent-written)
282
+ ../rtl/aes_sbox_lut.sv
283
+ ../rtl/aes_sbox.sv
284
+ ../rtl/aes_sub_bytes.sv
285
+ ../rtl/aes_shift_rows.sv
286
+ ../rtl/aes_mix_single_column.sv
287
+ ../rtl/aes_mix_columns.sv
288
+ ../rtl/aes_key_expand.sv
289
+ ../rtl/aes_reduced_round.sv
290
+ ../rtl/aes_sel_buf_chk.sv
291
+ ../rtl/aes_prng_clearing.sv
292
+ ../rtl/aes_cipher_control_fsm_p.sv
293
+ ../rtl/aes_cipher_control_fsm_n.sv
294
+ ../rtl/aes_cipher_control_fsm.sv
295
+ ../rtl/aes_cipher_control.sv
296
+ ../rtl/aes_cipher_core.sv
297
+ ../rtl/aes_ctr_fsm_p.sv
298
+ ../rtl/aes_ctr_fsm_n.sv
299
+ ../rtl/aes_ctr_fsm.sv
300
+ ../rtl/aes_ctr.sv
301
+ ../rtl/aes_control_fsm_p.sv
302
+ ../rtl/aes_control_fsm_n.sv
303
+ ../rtl/aes_control_fsm.sv
304
+ ../rtl/aes_control.sv
305
+ ../rtl/aes_core.sv
306
+ ../rtl/aes.sv
307
+ FILELIST
308
+
309
+ cat > "$WS/run/Makefile" << 'MAKEFILE'
310
+ .PHONY: compile clean
311
+
312
+ compile:
313
+ @mkdir -p compile_log
314
+ @xrun -c -64 -sv -access +rwc -elaborate \
315
+ -f filelist.f \
316
+ -timescale 1ns/1ps \
317
+ -l compile_log/compile.log 2>&1; \
318
+ STATUS=$$?; \
319
+ if [ $$STATUS -eq 0 ]; then \
320
+ echo "COMPILE PASSED"; \
321
+ else \
322
+ echo "COMPILE FAILED (see compile_log/compile.log)"; \
323
+ grep 'xmvlog: \*E\|xmelab: \*E' compile_log/compile.log 2>/dev/null; \
324
+ exit 1; \
325
+ fi
326
+
327
+ clean:
328
+ rm -rf xcelium.d compile_log
329
+ MAKEFILE
330
+
331
+ echo " Created filelist.f and Makefile"
332
+
333
+ # ── Verification ─────────────────────────────────────────────────────
334
+ echo "[6/6] Verifying workspace..."
335
+
336
+ EXPECTED_DIRS=(prim tlul pkg spec run)
337
+ for d in "${EXPECTED_DIRS[@]}"; do
338
+ count=$(find "$WS/$d" -type f | wc -l)
339
+ echo " $d/: $count files"
340
+ done
341
+
342
+ echo ""
343
+ echo "=== Workspace populated. Agent stubs, PDFs, and run/ added by environment Dockerfile. ==="
images/rtl/alert_handler-accu/Dockerfile ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TitanBench ALERT_HANDLER-ACCU-RTL — extends titanbench-base with OpenTitan infrastructure.
2
+ #
3
+ # docker build -f images/rtl/alert_handler-accu/image/Dockerfile \
4
+ # --build-context titanbench=/path/to/titanbench \
5
+ # -t titanbench-alert_handler-accu-rtl /path/to/opentitan
6
+
7
+ FROM titanbench-base:latest
8
+
9
+ COPY --chown=dev:dev . /home/dev/src/
10
+
11
+ # Restore autogen files for non-Earlgrey tops that .dockerignore excludes
12
+ # but fusesoc needs when building alert_handler DV.
13
+ COPY --from=titanbench joe_exp/ot_autogen_fix/hw/ /home/dev/src/hw/
14
+
15
+ COPY --from=titanbench images/rtl/alert_handler-accu/scripts/setup_workspace.sh /home/dev/scripts/setup_workspace.sh
16
+ RUN chmod +x /home/dev/scripts/setup_workspace.sh \
17
+ && bash /home/dev/scripts/setup_workspace.sh
18
+
19
+ RUN git config --global --add safe.directory /home/dev/src \
20
+ && git config --global user.email "titanbench@opentitan.org" \
21
+ && git config --global user.name "TitanBench" \
22
+ && cd /home/dev/src \
23
+ && git init \
24
+ && git add -A \
25
+ && git commit -m "titanbench alert_handler-accu-rtl base"
26
+
27
+ WORKDIR /home/dev/workspace/code
28
+ ENTRYPOINT []
29
+ CMD ["sh", "-c", "sleep infinity"]
images/rtl/alert_handler-accu/scripts/setup_workspace.sh ADDED
@@ -0,0 +1,200 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Copyright lowRISC contributors (OpenTitan project).
3
+ # Licensed under the Apache License, Version 2.0, see LICENSE for details.
4
+ # SPDX-License-Identifier: Apache-2.0
5
+ #
6
+ # Populates the ALERT_HANDLER-ACCU-RTL workspace with infrastructure + oracle RTL for every
7
+ # module except alert_handler_accu.sv (overlaid as a stub by the environment Dockerfile).
8
+
9
+ set -euo pipefail
10
+
11
+ REPO_TOP="/home/dev/src"
12
+ WS="/home/dev/workspace/code"
13
+ AH_RTL="$REPO_TOP/hw/top_earlgrey/ip_autogen/alert_handler/rtl"
14
+ AH_DATA="$REPO_TOP/hw/top_earlgrey/ip_autogen/alert_handler/data"
15
+ AH_DOC="$REPO_TOP/hw/top_earlgrey/ip_autogen/alert_handler/doc"
16
+
17
+ echo "=== TitanBench: Populating ALERT_HANDLER-ACCU-RTL workspace ==="
18
+
19
+ mkdir -p "$WS"/{prim,tlul,pkg,spec,run,rtl}
20
+
21
+ echo "[1/6] Copying prim modules..."
22
+ PRIM_SRC="$REPO_TOP/hw/ip/prim/rtl"
23
+ PRIM_GEN_SRC="$REPO_TOP/hw/ip/prim_generic/rtl"
24
+
25
+ PRIM_FILES=(
26
+ prim_alert_pkg.sv prim_esc_pkg.sv prim_mubi_pkg.sv prim_secded_pkg.sv
27
+ prim_subreg_pkg.sv prim_util_pkg.sv prim_count_pkg.sv
28
+ prim_assert.sv prim_assert_sec_cm.svh prim_assert_standard_macros.svh
29
+ prim_flop_macros.sv prim_cdc_rand_delay.sv
30
+ prim_onehot_enc.sv prim_onehot_check.sv
31
+ prim_subreg.sv prim_subreg_arb.sv prim_subreg_ext.sv prim_subreg_shadow.sv
32
+ prim_reg_we_check.sv
33
+ prim_sec_anchor_buf.sv prim_sec_anchor_flop.sv
34
+ prim_alert_sender.sv prim_alert_receiver.sv prim_esc_sender.sv
35
+ prim_intr_hw.sv prim_edn_req.sv
36
+ prim_lc_sync.sv prim_edge_detector.sv prim_pulse_sync.sv prim_sync_reqack.sv
37
+ prim_mubi4_sync.sv
38
+ prim_count.sv prim_sparse_fsm_flop.sv prim_double_lfsr.sv prim_lfsr.sv
39
+ prim_reg_cdc.sv prim_reg_cdc_arb.sv
40
+ prim_packer_fifo.sv prim_fifo_sync.sv prim_max_tree.sv prim_diff_decode.sv
41
+ prim_secded_inv_22_16_dec.sv prim_secded_inv_22_16_enc.sv
42
+ prim_secded_inv_28_22_dec.sv prim_secded_inv_28_22_enc.sv
43
+ prim_secded_inv_39_32_dec.sv prim_secded_inv_39_32_enc.sv
44
+ prim_secded_inv_64_57_dec.sv prim_secded_inv_64_57_enc.sv
45
+ prim_secded_inv_72_64_dec.sv prim_secded_inv_72_64_enc.sv
46
+ prim_secded_inv_hamming_22_16_dec.sv prim_secded_inv_hamming_22_16_enc.sv
47
+ prim_secded_inv_hamming_39_32_dec.sv prim_secded_inv_hamming_39_32_enc.sv
48
+ prim_secded_inv_hamming_72_64_dec.sv prim_secded_inv_hamming_72_64_enc.sv
49
+ prim_secded_inv_hamming_76_68_dec.sv prim_secded_inv_hamming_76_68_enc.sv
50
+ prim_util_memload.svh
51
+ )
52
+ PRIM_GENERIC_FILES=( prim_buf.sv prim_flop.sv prim_flop_2sync.sv prim_xnor2.sv )
53
+ for f in "${PRIM_FILES[@]}"; do cp "$PRIM_SRC/$f" "$WS/prim/" 2>/dev/null || echo " missing $f"; done
54
+ for f in "${PRIM_GENERIC_FILES[@]}"; do cp "$PRIM_GEN_SRC/$f" "$WS/prim/"; done
55
+ echo " Copied prims"
56
+
57
+ echo "[2/6] Copying TLUL modules..."
58
+ TLUL_SRC="$REPO_TOP/hw/ip/tlul/rtl"
59
+ for f in tlul_pkg.sv tlul_adapter_reg.sv tlul_adapter_reg_shadowed.sv tlul_cmd_intg_chk.sv tlul_data_integ_dec.sv tlul_data_integ_enc.sv tlul_err.sv tlul_rsp_intg_gen.sv; do
60
+ cp "$TLUL_SRC/$f" "$WS/tlul/" 2>/dev/null || echo " missing $f"
61
+ done
62
+
63
+ echo "[3/6] Copying package files..."
64
+ cp "$AH_RTL/alert_handler_reg_pkg.sv" "$WS/pkg/"
65
+ cp "$AH_RTL/alert_handler_pkg.sv" "$WS/pkg/"
66
+ cp "$REPO_TOP/hw/top_earlgrey/rtl/top_pkg.sv" "$WS/pkg/"
67
+ cp "$REPO_TOP/hw/top_earlgrey/rtl/autogen/top_racl_pkg.sv" "$WS/pkg/"
68
+ cp "$REPO_TOP/hw/ip/lc_ctrl/rtl/lc_ctrl_pkg.sv" "$WS/pkg/"
69
+ cp "$REPO_TOP/hw/ip/lc_ctrl/rtl/lc_ctrl_reg_pkg.sv" "$WS/pkg/"
70
+ cp "$REPO_TOP/hw/ip/lc_ctrl/rtl/lc_ctrl_state_pkg.sv" "$WS/pkg/"
71
+ cp "$REPO_TOP/hw/ip/edn/rtl/edn_pkg.sv" "$WS/pkg/"
72
+
73
+ echo "[4/6] Copying spec documentation..."
74
+ cp "$AH_DOC/theory_of_operation.md" "$WS/spec/"
75
+ cp "$AH_DOC/programmers_guide.md" "$WS/spec/"
76
+ cp "$AH_DOC/alert_handler_alert_rxtx.svg" "$WS/spec/" 2>/dev/null || true
77
+ cp "$AH_DOC/alert_handler_block_diagram.svg" "$WS/spec/" 2>/dev/null || true
78
+ cp "$AH_DOC/alert_handler_escalation_rxtx.svg" "$WS/spec/" 2>/dev/null || true
79
+ cp "$AH_DOC/alert_handler_lpg_ctrl.svg" "$WS/spec/" 2>/dev/null || true
80
+ cp "$AH_DOC/alert_handler_lp_overview.svg" "$WS/spec/" 2>/dev/null || true
81
+ cp "$AH_DOC/alert_handler_receiver_fsm.svg" "$WS/spec/" 2>/dev/null || true
82
+ cp "$AH_DATA/alert_handler_testplan.hjson" "$WS/spec/" 2>/dev/null || true
83
+ cp "$AH_DATA/alert_handler.hjson" "$WS/spec/" 2>/dev/null || true
84
+ cp "$AH_DATA/alert_handler_sec_cm_testplan.hjson" "$WS/spec/" 2>/dev/null || true
85
+ cp "$AH_DOC/checklist.md" "$WS/spec/" 2>/dev/null || true
86
+
87
+ cp "$AH_RTL/../README.md" "$WS/spec/alert_handler_README.md" 2>/dev/null || true
88
+
89
+ echo "[5/6] Copying RTL (all except alert_handler_accu.sv)..."
90
+ for f in alert_handler.sv alert_handler_reg_top.sv alert_handler_reg_wrap.sv \
91
+ alert_handler_accu.sv alert_handler_class.sv alert_handler_esc_timer.sv \
92
+ alert_handler_lpg_ctrl.sv alert_handler_ping_timer.sv; do
93
+ if [ "$f" = "alert_handler_accu.sv" ]; then
94
+ echo " skipping $f (agent stub)"
95
+ continue
96
+ fi
97
+ cp "$AH_RTL/$f" "$WS/rtl/"
98
+ done
99
+
100
+ echo "[6/6] Creating run directory..."
101
+ cat > "$WS/run/filelist.f" << 'FILELIST'
102
+ +incdir+../prim
103
+ ../prim/prim_assert.sv
104
+ ../prim/prim_util_pkg.sv
105
+ ../prim/prim_mubi_pkg.sv
106
+ ../prim/prim_alert_pkg.sv
107
+ ../prim/prim_esc_pkg.sv
108
+ ../prim/prim_subreg_pkg.sv
109
+ ../prim/prim_secded_pkg.sv
110
+ ../prim/prim_count_pkg.sv
111
+ ../pkg/top_pkg.sv
112
+ ../tlul/tlul_pkg.sv
113
+ ../pkg/lc_ctrl_state_pkg.sv
114
+ ../pkg/lc_ctrl_reg_pkg.sv
115
+ ../pkg/lc_ctrl_pkg.sv
116
+ ../pkg/top_racl_pkg.sv
117
+ ../pkg/edn_pkg.sv
118
+ ../pkg/alert_handler_reg_pkg.sv
119
+ ../pkg/alert_handler_pkg.sv
120
+
121
+ ../prim/prim_secded_inv_64_57_enc.sv
122
+ ../prim/prim_secded_inv_64_57_dec.sv
123
+ ../prim/prim_secded_inv_39_32_enc.sv
124
+ ../prim/prim_secded_inv_39_32_dec.sv
125
+
126
+ ../tlul/tlul_err.sv
127
+ ../tlul/tlul_cmd_intg_chk.sv
128
+ ../tlul/tlul_rsp_intg_gen.sv
129
+ ../tlul/tlul_data_integ_dec.sv
130
+ ../tlul/tlul_data_integ_enc.sv
131
+ ../tlul/tlul_adapter_reg.sv
132
+ ../tlul/tlul_adapter_reg_shadowed.sv
133
+
134
+ ../prim/prim_buf.sv
135
+ ../prim/prim_xnor2.sv
136
+ ../prim/prim_flop.sv
137
+ ../prim/prim_cdc_rand_delay.sv
138
+ ../prim/prim_flop_2sync.sv
139
+ ../prim/prim_mubi4_sync.sv
140
+ ../prim/prim_onehot_enc.sv
141
+ ../prim/prim_onehot_check.sv
142
+ ../prim/prim_subreg_arb.sv
143
+ ../prim/prim_subreg.sv
144
+ ../prim/prim_subreg_ext.sv
145
+ ../prim/prim_subreg_shadow.sv
146
+ ../prim/prim_reg_we_check.sv
147
+ ../prim/prim_sec_anchor_buf.sv
148
+ ../prim/prim_sec_anchor_flop.sv
149
+ ../prim/prim_alert_sender.sv
150
+ ../prim/prim_alert_receiver.sv
151
+ ../prim/prim_esc_sender.sv
152
+ ../prim/prim_intr_hw.sv
153
+ ../prim/prim_lc_sync.sv
154
+ ../prim/prim_edge_detector.sv
155
+ ../prim/prim_pulse_sync.sv
156
+ ../prim/prim_sync_reqack.sv
157
+ ../prim/prim_fifo_sync.sv
158
+ ../prim/prim_packer_fifo.sv
159
+ ../prim/prim_max_tree.sv
160
+ ../prim/prim_diff_decode.sv
161
+ ../prim/prim_edn_req.sv
162
+ ../prim/prim_count.sv
163
+ ../prim/prim_sparse_fsm_flop.sv
164
+ ../prim/prim_lfsr.sv
165
+ ../prim/prim_double_lfsr.sv
166
+ ../prim/prim_reg_cdc_arb.sv
167
+ ../prim/prim_reg_cdc.sv
168
+
169
+ ../rtl/alert_handler_reg_top.sv
170
+ ../rtl/alert_handler_reg_wrap.sv
171
+ ../rtl/alert_handler_accu.sv
172
+ ../rtl/alert_handler_class.sv
173
+ ../rtl/alert_handler_lpg_ctrl.sv
174
+ ../rtl/alert_handler_esc_timer.sv
175
+ ../rtl/alert_handler_ping_timer.sv
176
+ ../rtl/alert_handler.sv
177
+ FILELIST
178
+
179
+ cat > "$WS/run/Makefile" << 'MAKEFILE'
180
+ .PHONY: compile clean
181
+
182
+ compile:
183
+ @mkdir -p compile_log
184
+ xrun -c -64 -sv -access +rwc -elaborate \
185
+ -f filelist.f \
186
+ -timescale 1ns/1ps \
187
+ -l compile_log/compile.log 2>&1 || true
188
+ @echo "Check compile_log/compile.log"
189
+
190
+ clean:
191
+ rm -rf xcelium.d compile_log
192
+ MAKEFILE
193
+
194
+ echo ""
195
+ echo "[verify] Workspace contents:"
196
+ for d in prim tlul pkg spec rtl run; do
197
+ echo " $d/: $(find $WS/$d -type f 2>/dev/null | wc -l) files"
198
+ done
199
+ echo ""
200
+ echo "=== Workspace populated. alert_handler_accu.sv stub added by environment Dockerfile. ==="
images/rtl/alert_handler-class/Dockerfile ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TitanBench ALERT_HANDLER-CLASS-RTL — extends titanbench-base with OpenTitan infrastructure.
2
+ #
3
+ # docker build -f images/rtl/alert_handler-class/image/Dockerfile \
4
+ # --build-context titanbench=/path/to/titanbench \
5
+ # -t titanbench-alert_handler-class-rtl /path/to/opentitan
6
+
7
+ FROM titanbench-base:latest
8
+
9
+ COPY --chown=dev:dev . /home/dev/src/
10
+
11
+ # Restore autogen files for non-Earlgrey tops that .dockerignore excludes
12
+ # but fusesoc needs when building alert_handler DV.
13
+ COPY --from=titanbench joe_exp/ot_autogen_fix/hw/ /home/dev/src/hw/
14
+
15
+ COPY --from=titanbench images/rtl/alert_handler-class/scripts/setup_workspace.sh /home/dev/scripts/setup_workspace.sh
16
+ RUN chmod +x /home/dev/scripts/setup_workspace.sh \
17
+ && bash /home/dev/scripts/setup_workspace.sh
18
+
19
+ RUN git config --global --add safe.directory /home/dev/src \
20
+ && git config --global user.email "titanbench@opentitan.org" \
21
+ && git config --global user.name "TitanBench" \
22
+ && cd /home/dev/src \
23
+ && git init \
24
+ && git add -A \
25
+ && git commit -m "titanbench alert_handler-class-rtl base"
26
+
27
+ WORKDIR /home/dev/workspace/code
28
+ ENTRYPOINT []
29
+ CMD ["sh", "-c", "sleep infinity"]
images/rtl/alert_handler-class/scripts/setup_workspace.sh ADDED
@@ -0,0 +1,200 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Copyright lowRISC contributors (OpenTitan project).
3
+ # Licensed under the Apache License, Version 2.0, see LICENSE for details.
4
+ # SPDX-License-Identifier: Apache-2.0
5
+ #
6
+ # Populates the ALERT_HANDLER-CLASS-RTL workspace with infrastructure + oracle RTL for every
7
+ # module except alert_handler_class.sv (overlaid as a stub by the environment Dockerfile).
8
+
9
+ set -euo pipefail
10
+
11
+ REPO_TOP="/home/dev/src"
12
+ WS="/home/dev/workspace/code"
13
+ AH_RTL="$REPO_TOP/hw/top_earlgrey/ip_autogen/alert_handler/rtl"
14
+ AH_DATA="$REPO_TOP/hw/top_earlgrey/ip_autogen/alert_handler/data"
15
+ AH_DOC="$REPO_TOP/hw/top_earlgrey/ip_autogen/alert_handler/doc"
16
+
17
+ echo "=== TitanBench: Populating ALERT_HANDLER-CLASS-RTL workspace ==="
18
+
19
+ mkdir -p "$WS"/{prim,tlul,pkg,spec,run,rtl}
20
+
21
+ echo "[1/6] Copying prim modules..."
22
+ PRIM_SRC="$REPO_TOP/hw/ip/prim/rtl"
23
+ PRIM_GEN_SRC="$REPO_TOP/hw/ip/prim_generic/rtl"
24
+
25
+ PRIM_FILES=(
26
+ prim_alert_pkg.sv prim_esc_pkg.sv prim_mubi_pkg.sv prim_secded_pkg.sv
27
+ prim_subreg_pkg.sv prim_util_pkg.sv prim_count_pkg.sv
28
+ prim_assert.sv prim_assert_sec_cm.svh prim_assert_standard_macros.svh
29
+ prim_flop_macros.sv prim_cdc_rand_delay.sv
30
+ prim_onehot_enc.sv prim_onehot_check.sv
31
+ prim_subreg.sv prim_subreg_arb.sv prim_subreg_ext.sv prim_subreg_shadow.sv
32
+ prim_reg_we_check.sv
33
+ prim_sec_anchor_buf.sv prim_sec_anchor_flop.sv
34
+ prim_alert_sender.sv prim_alert_receiver.sv prim_esc_sender.sv
35
+ prim_intr_hw.sv prim_edn_req.sv
36
+ prim_lc_sync.sv prim_edge_detector.sv prim_pulse_sync.sv prim_sync_reqack.sv
37
+ prim_mubi4_sync.sv
38
+ prim_count.sv prim_sparse_fsm_flop.sv prim_double_lfsr.sv prim_lfsr.sv
39
+ prim_reg_cdc.sv prim_reg_cdc_arb.sv
40
+ prim_packer_fifo.sv prim_fifo_sync.sv prim_max_tree.sv prim_diff_decode.sv
41
+ prim_secded_inv_22_16_dec.sv prim_secded_inv_22_16_enc.sv
42
+ prim_secded_inv_28_22_dec.sv prim_secded_inv_28_22_enc.sv
43
+ prim_secded_inv_39_32_dec.sv prim_secded_inv_39_32_enc.sv
44
+ prim_secded_inv_64_57_dec.sv prim_secded_inv_64_57_enc.sv
45
+ prim_secded_inv_72_64_dec.sv prim_secded_inv_72_64_enc.sv
46
+ prim_secded_inv_hamming_22_16_dec.sv prim_secded_inv_hamming_22_16_enc.sv
47
+ prim_secded_inv_hamming_39_32_dec.sv prim_secded_inv_hamming_39_32_enc.sv
48
+ prim_secded_inv_hamming_72_64_dec.sv prim_secded_inv_hamming_72_64_enc.sv
49
+ prim_secded_inv_hamming_76_68_dec.sv prim_secded_inv_hamming_76_68_enc.sv
50
+ prim_util_memload.svh
51
+ )
52
+ PRIM_GENERIC_FILES=( prim_buf.sv prim_flop.sv prim_flop_2sync.sv prim_xnor2.sv )
53
+ for f in "${PRIM_FILES[@]}"; do cp "$PRIM_SRC/$f" "$WS/prim/" 2>/dev/null || echo " missing $f"; done
54
+ for f in "${PRIM_GENERIC_FILES[@]}"; do cp "$PRIM_GEN_SRC/$f" "$WS/prim/"; done
55
+ echo " Copied prims"
56
+
57
+ echo "[2/6] Copying TLUL modules..."
58
+ TLUL_SRC="$REPO_TOP/hw/ip/tlul/rtl"
59
+ for f in tlul_pkg.sv tlul_adapter_reg.sv tlul_adapter_reg_shadowed.sv tlul_cmd_intg_chk.sv tlul_data_integ_dec.sv tlul_data_integ_enc.sv tlul_err.sv tlul_rsp_intg_gen.sv; do
60
+ cp "$TLUL_SRC/$f" "$WS/tlul/" 2>/dev/null || echo " missing $f"
61
+ done
62
+
63
+ echo "[3/6] Copying package files..."
64
+ cp "$AH_RTL/alert_handler_reg_pkg.sv" "$WS/pkg/"
65
+ cp "$AH_RTL/alert_handler_pkg.sv" "$WS/pkg/"
66
+ cp "$REPO_TOP/hw/top_earlgrey/rtl/top_pkg.sv" "$WS/pkg/"
67
+ cp "$REPO_TOP/hw/top_earlgrey/rtl/autogen/top_racl_pkg.sv" "$WS/pkg/"
68
+ cp "$REPO_TOP/hw/ip/lc_ctrl/rtl/lc_ctrl_pkg.sv" "$WS/pkg/"
69
+ cp "$REPO_TOP/hw/ip/lc_ctrl/rtl/lc_ctrl_reg_pkg.sv" "$WS/pkg/"
70
+ cp "$REPO_TOP/hw/ip/lc_ctrl/rtl/lc_ctrl_state_pkg.sv" "$WS/pkg/"
71
+ cp "$REPO_TOP/hw/ip/edn/rtl/edn_pkg.sv" "$WS/pkg/"
72
+
73
+ echo "[4/6] Copying spec documentation..."
74
+ cp "$AH_DOC/theory_of_operation.md" "$WS/spec/"
75
+ cp "$AH_DOC/programmers_guide.md" "$WS/spec/"
76
+ cp "$AH_DOC/alert_handler_alert_rxtx.svg" "$WS/spec/" 2>/dev/null || true
77
+ cp "$AH_DOC/alert_handler_block_diagram.svg" "$WS/spec/" 2>/dev/null || true
78
+ cp "$AH_DOC/alert_handler_escalation_rxtx.svg" "$WS/spec/" 2>/dev/null || true
79
+ cp "$AH_DOC/alert_handler_lpg_ctrl.svg" "$WS/spec/" 2>/dev/null || true
80
+ cp "$AH_DOC/alert_handler_lp_overview.svg" "$WS/spec/" 2>/dev/null || true
81
+ cp "$AH_DOC/alert_handler_receiver_fsm.svg" "$WS/spec/" 2>/dev/null || true
82
+ cp "$AH_DATA/alert_handler_testplan.hjson" "$WS/spec/" 2>/dev/null || true
83
+ cp "$AH_DATA/alert_handler.hjson" "$WS/spec/" 2>/dev/null || true
84
+ cp "$AH_DATA/alert_handler_sec_cm_testplan.hjson" "$WS/spec/" 2>/dev/null || true
85
+ cp "$AH_DOC/checklist.md" "$WS/spec/" 2>/dev/null || true
86
+
87
+ cp "$AH_RTL/../README.md" "$WS/spec/alert_handler_README.md" 2>/dev/null || true
88
+
89
+ echo "[5/6] Copying RTL (all except alert_handler_class.sv)..."
90
+ for f in alert_handler.sv alert_handler_reg_top.sv alert_handler_reg_wrap.sv \
91
+ alert_handler_accu.sv alert_handler_class.sv alert_handler_esc_timer.sv \
92
+ alert_handler_lpg_ctrl.sv alert_handler_ping_timer.sv; do
93
+ if [ "$f" = "alert_handler_class.sv" ]; then
94
+ echo " skipping $f (agent stub)"
95
+ continue
96
+ fi
97
+ cp "$AH_RTL/$f" "$WS/rtl/"
98
+ done
99
+
100
+ echo "[6/6] Creating run directory..."
101
+ cat > "$WS/run/filelist.f" << 'FILELIST'
102
+ +incdir+../prim
103
+ ../prim/prim_assert.sv
104
+ ../prim/prim_util_pkg.sv
105
+ ../prim/prim_mubi_pkg.sv
106
+ ../prim/prim_alert_pkg.sv
107
+ ../prim/prim_esc_pkg.sv
108
+ ../prim/prim_subreg_pkg.sv
109
+ ../prim/prim_secded_pkg.sv
110
+ ../prim/prim_count_pkg.sv
111
+ ../pkg/top_pkg.sv
112
+ ../tlul/tlul_pkg.sv
113
+ ../pkg/lc_ctrl_state_pkg.sv
114
+ ../pkg/lc_ctrl_reg_pkg.sv
115
+ ../pkg/lc_ctrl_pkg.sv
116
+ ../pkg/top_racl_pkg.sv
117
+ ../pkg/edn_pkg.sv
118
+ ../pkg/alert_handler_reg_pkg.sv
119
+ ../pkg/alert_handler_pkg.sv
120
+
121
+ ../prim/prim_secded_inv_64_57_enc.sv
122
+ ../prim/prim_secded_inv_64_57_dec.sv
123
+ ../prim/prim_secded_inv_39_32_enc.sv
124
+ ../prim/prim_secded_inv_39_32_dec.sv
125
+
126
+ ../tlul/tlul_err.sv
127
+ ../tlul/tlul_cmd_intg_chk.sv
128
+ ../tlul/tlul_rsp_intg_gen.sv
129
+ ../tlul/tlul_data_integ_dec.sv
130
+ ../tlul/tlul_data_integ_enc.sv
131
+ ../tlul/tlul_adapter_reg.sv
132
+ ../tlul/tlul_adapter_reg_shadowed.sv
133
+
134
+ ../prim/prim_buf.sv
135
+ ../prim/prim_xnor2.sv
136
+ ../prim/prim_flop.sv
137
+ ../prim/prim_cdc_rand_delay.sv
138
+ ../prim/prim_flop_2sync.sv
139
+ ../prim/prim_mubi4_sync.sv
140
+ ../prim/prim_onehot_enc.sv
141
+ ../prim/prim_onehot_check.sv
142
+ ../prim/prim_subreg_arb.sv
143
+ ../prim/prim_subreg.sv
144
+ ../prim/prim_subreg_ext.sv
145
+ ../prim/prim_subreg_shadow.sv
146
+ ../prim/prim_reg_we_check.sv
147
+ ../prim/prim_sec_anchor_buf.sv
148
+ ../prim/prim_sec_anchor_flop.sv
149
+ ../prim/prim_alert_sender.sv
150
+ ../prim/prim_alert_receiver.sv
151
+ ../prim/prim_esc_sender.sv
152
+ ../prim/prim_intr_hw.sv
153
+ ../prim/prim_lc_sync.sv
154
+ ../prim/prim_edge_detector.sv
155
+ ../prim/prim_pulse_sync.sv
156
+ ../prim/prim_sync_reqack.sv
157
+ ../prim/prim_fifo_sync.sv
158
+ ../prim/prim_packer_fifo.sv
159
+ ../prim/prim_max_tree.sv
160
+ ../prim/prim_diff_decode.sv
161
+ ../prim/prim_edn_req.sv
162
+ ../prim/prim_count.sv
163
+ ../prim/prim_sparse_fsm_flop.sv
164
+ ../prim/prim_lfsr.sv
165
+ ../prim/prim_double_lfsr.sv
166
+ ../prim/prim_reg_cdc_arb.sv
167
+ ../prim/prim_reg_cdc.sv
168
+
169
+ ../rtl/alert_handler_reg_top.sv
170
+ ../rtl/alert_handler_reg_wrap.sv
171
+ ../rtl/alert_handler_accu.sv
172
+ ../rtl/alert_handler_class.sv
173
+ ../rtl/alert_handler_lpg_ctrl.sv
174
+ ../rtl/alert_handler_esc_timer.sv
175
+ ../rtl/alert_handler_ping_timer.sv
176
+ ../rtl/alert_handler.sv
177
+ FILELIST
178
+
179
+ cat > "$WS/run/Makefile" << 'MAKEFILE'
180
+ .PHONY: compile clean
181
+
182
+ compile:
183
+ @mkdir -p compile_log
184
+ xrun -c -64 -sv -access +rwc -elaborate \
185
+ -f filelist.f \
186
+ -timescale 1ns/1ps \
187
+ -l compile_log/compile.log 2>&1 || true
188
+ @echo "Check compile_log/compile.log"
189
+
190
+ clean:
191
+ rm -rf xcelium.d compile_log
192
+ MAKEFILE
193
+
194
+ echo ""
195
+ echo "[verify] Workspace contents:"
196
+ for d in prim tlul pkg spec rtl run; do
197
+ echo " $d/: $(find $WS/$d -type f 2>/dev/null | wc -l) files"
198
+ done
199
+ echo ""
200
+ echo "=== Workspace populated. alert_handler_class.sv stub added by environment Dockerfile. ==="
images/rtl/alert_handler-esc-timer/Dockerfile ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TitanBench ALERT_HANDLER-ESC-TIMER-RTL — extends titanbench-base with OpenTitan infrastructure.
2
+ #
3
+ # docker build -f images/rtl/alert_handler-esc-timer/image/Dockerfile \
4
+ # --build-context titanbench=/path/to/titanbench \
5
+ # -t titanbench-alert_handler-esc-timer-rtl /path/to/opentitan
6
+
7
+ FROM titanbench-base:latest
8
+
9
+ COPY --chown=dev:dev . /home/dev/src/
10
+
11
+ # Restore autogen files for non-Earlgrey tops that .dockerignore excludes
12
+ # but fusesoc needs when building alert_handler DV.
13
+ COPY --from=titanbench joe_exp/ot_autogen_fix/hw/ /home/dev/src/hw/
14
+
15
+ COPY --from=titanbench images/rtl/alert_handler-esc-timer/scripts/setup_workspace.sh /home/dev/scripts/setup_workspace.sh
16
+ RUN chmod +x /home/dev/scripts/setup_workspace.sh \
17
+ && bash /home/dev/scripts/setup_workspace.sh
18
+
19
+ RUN git config --global --add safe.directory /home/dev/src \
20
+ && git config --global user.email "titanbench@opentitan.org" \
21
+ && git config --global user.name "TitanBench" \
22
+ && cd /home/dev/src \
23
+ && git init \
24
+ && git add -A \
25
+ && git commit -m "titanbench alert_handler-esc-timer-rtl base"
26
+
27
+ WORKDIR /home/dev/workspace/code
28
+ ENTRYPOINT []
29
+ CMD ["sh", "-c", "sleep infinity"]
images/rtl/alert_handler-esc-timer/scripts/setup_workspace.sh ADDED
@@ -0,0 +1,200 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Copyright lowRISC contributors (OpenTitan project).
3
+ # Licensed under the Apache License, Version 2.0, see LICENSE for details.
4
+ # SPDX-License-Identifier: Apache-2.0
5
+ #
6
+ # Populates the ALERT_HANDLER-ESC-TIMER-RTL workspace with infrastructure + oracle RTL for every
7
+ # module except alert_handler_esc_timer.sv (overlaid as a stub by the environment Dockerfile).
8
+
9
+ set -euo pipefail
10
+
11
+ REPO_TOP="/home/dev/src"
12
+ WS="/home/dev/workspace/code"
13
+ AH_RTL="$REPO_TOP/hw/top_earlgrey/ip_autogen/alert_handler/rtl"
14
+ AH_DATA="$REPO_TOP/hw/top_earlgrey/ip_autogen/alert_handler/data"
15
+ AH_DOC="$REPO_TOP/hw/top_earlgrey/ip_autogen/alert_handler/doc"
16
+
17
+ echo "=== TitanBench: Populating ALERT_HANDLER-ESC-TIMER-RTL workspace ==="
18
+
19
+ mkdir -p "$WS"/{prim,tlul,pkg,spec,run,rtl}
20
+
21
+ echo "[1/6] Copying prim modules..."
22
+ PRIM_SRC="$REPO_TOP/hw/ip/prim/rtl"
23
+ PRIM_GEN_SRC="$REPO_TOP/hw/ip/prim_generic/rtl"
24
+
25
+ PRIM_FILES=(
26
+ prim_alert_pkg.sv prim_esc_pkg.sv prim_mubi_pkg.sv prim_secded_pkg.sv
27
+ prim_subreg_pkg.sv prim_util_pkg.sv prim_count_pkg.sv
28
+ prim_assert.sv prim_assert_sec_cm.svh prim_assert_standard_macros.svh
29
+ prim_flop_macros.sv prim_cdc_rand_delay.sv
30
+ prim_onehot_enc.sv prim_onehot_check.sv
31
+ prim_subreg.sv prim_subreg_arb.sv prim_subreg_ext.sv prim_subreg_shadow.sv
32
+ prim_reg_we_check.sv
33
+ prim_sec_anchor_buf.sv prim_sec_anchor_flop.sv
34
+ prim_alert_sender.sv prim_alert_receiver.sv prim_esc_sender.sv
35
+ prim_intr_hw.sv prim_edn_req.sv
36
+ prim_lc_sync.sv prim_edge_detector.sv prim_pulse_sync.sv prim_sync_reqack.sv
37
+ prim_mubi4_sync.sv
38
+ prim_count.sv prim_sparse_fsm_flop.sv prim_double_lfsr.sv prim_lfsr.sv
39
+ prim_reg_cdc.sv prim_reg_cdc_arb.sv
40
+ prim_packer_fifo.sv prim_fifo_sync.sv prim_max_tree.sv prim_diff_decode.sv
41
+ prim_secded_inv_22_16_dec.sv prim_secded_inv_22_16_enc.sv
42
+ prim_secded_inv_28_22_dec.sv prim_secded_inv_28_22_enc.sv
43
+ prim_secded_inv_39_32_dec.sv prim_secded_inv_39_32_enc.sv
44
+ prim_secded_inv_64_57_dec.sv prim_secded_inv_64_57_enc.sv
45
+ prim_secded_inv_72_64_dec.sv prim_secded_inv_72_64_enc.sv
46
+ prim_secded_inv_hamming_22_16_dec.sv prim_secded_inv_hamming_22_16_enc.sv
47
+ prim_secded_inv_hamming_39_32_dec.sv prim_secded_inv_hamming_39_32_enc.sv
48
+ prim_secded_inv_hamming_72_64_dec.sv prim_secded_inv_hamming_72_64_enc.sv
49
+ prim_secded_inv_hamming_76_68_dec.sv prim_secded_inv_hamming_76_68_enc.sv
50
+ prim_util_memload.svh
51
+ )
52
+ PRIM_GENERIC_FILES=( prim_buf.sv prim_flop.sv prim_flop_2sync.sv prim_xnor2.sv )
53
+ for f in "${PRIM_FILES[@]}"; do cp "$PRIM_SRC/$f" "$WS/prim/" 2>/dev/null || echo " missing $f"; done
54
+ for f in "${PRIM_GENERIC_FILES[@]}"; do cp "$PRIM_GEN_SRC/$f" "$WS/prim/"; done
55
+ echo " Copied prims"
56
+
57
+ echo "[2/6] Copying TLUL modules..."
58
+ TLUL_SRC="$REPO_TOP/hw/ip/tlul/rtl"
59
+ for f in tlul_pkg.sv tlul_adapter_reg.sv tlul_adapter_reg_shadowed.sv tlul_cmd_intg_chk.sv tlul_data_integ_dec.sv tlul_data_integ_enc.sv tlul_err.sv tlul_rsp_intg_gen.sv; do
60
+ cp "$TLUL_SRC/$f" "$WS/tlul/" 2>/dev/null || echo " missing $f"
61
+ done
62
+
63
+ echo "[3/6] Copying package files..."
64
+ cp "$AH_RTL/alert_handler_reg_pkg.sv" "$WS/pkg/"
65
+ cp "$AH_RTL/alert_handler_pkg.sv" "$WS/pkg/"
66
+ cp "$REPO_TOP/hw/top_earlgrey/rtl/top_pkg.sv" "$WS/pkg/"
67
+ cp "$REPO_TOP/hw/top_earlgrey/rtl/autogen/top_racl_pkg.sv" "$WS/pkg/"
68
+ cp "$REPO_TOP/hw/ip/lc_ctrl/rtl/lc_ctrl_pkg.sv" "$WS/pkg/"
69
+ cp "$REPO_TOP/hw/ip/lc_ctrl/rtl/lc_ctrl_reg_pkg.sv" "$WS/pkg/"
70
+ cp "$REPO_TOP/hw/ip/lc_ctrl/rtl/lc_ctrl_state_pkg.sv" "$WS/pkg/"
71
+ cp "$REPO_TOP/hw/ip/edn/rtl/edn_pkg.sv" "$WS/pkg/"
72
+
73
+ echo "[4/6] Copying spec documentation..."
74
+ cp "$AH_DOC/theory_of_operation.md" "$WS/spec/"
75
+ cp "$AH_DOC/programmers_guide.md" "$WS/spec/"
76
+ cp "$AH_DOC/alert_handler_alert_rxtx.svg" "$WS/spec/" 2>/dev/null || true
77
+ cp "$AH_DOC/alert_handler_block_diagram.svg" "$WS/spec/" 2>/dev/null || true
78
+ cp "$AH_DOC/alert_handler_escalation_rxtx.svg" "$WS/spec/" 2>/dev/null || true
79
+ cp "$AH_DOC/alert_handler_lpg_ctrl.svg" "$WS/spec/" 2>/dev/null || true
80
+ cp "$AH_DOC/alert_handler_lp_overview.svg" "$WS/spec/" 2>/dev/null || true
81
+ cp "$AH_DOC/alert_handler_receiver_fsm.svg" "$WS/spec/" 2>/dev/null || true
82
+ cp "$AH_DATA/alert_handler_testplan.hjson" "$WS/spec/" 2>/dev/null || true
83
+ cp "$AH_DATA/alert_handler.hjson" "$WS/spec/" 2>/dev/null || true
84
+ cp "$AH_DATA/alert_handler_sec_cm_testplan.hjson" "$WS/spec/" 2>/dev/null || true
85
+ cp "$AH_DOC/checklist.md" "$WS/spec/" 2>/dev/null || true
86
+
87
+ cp "$AH_RTL/../README.md" "$WS/spec/alert_handler_README.md" 2>/dev/null || true
88
+
89
+ echo "[5/6] Copying RTL (all except alert_handler_esc_timer.sv)..."
90
+ for f in alert_handler.sv alert_handler_reg_top.sv alert_handler_reg_wrap.sv \
91
+ alert_handler_accu.sv alert_handler_class.sv alert_handler_esc_timer.sv \
92
+ alert_handler_lpg_ctrl.sv alert_handler_ping_timer.sv; do
93
+ if [ "$f" = "alert_handler_esc_timer.sv" ]; then
94
+ echo " skipping $f (agent stub)"
95
+ continue
96
+ fi
97
+ cp "$AH_RTL/$f" "$WS/rtl/"
98
+ done
99
+
100
+ echo "[6/6] Creating run directory..."
101
+ cat > "$WS/run/filelist.f" << 'FILELIST'
102
+ +incdir+../prim
103
+ ../prim/prim_assert.sv
104
+ ../prim/prim_util_pkg.sv
105
+ ../prim/prim_mubi_pkg.sv
106
+ ../prim/prim_alert_pkg.sv
107
+ ../prim/prim_esc_pkg.sv
108
+ ../prim/prim_subreg_pkg.sv
109
+ ../prim/prim_secded_pkg.sv
110
+ ../prim/prim_count_pkg.sv
111
+ ../pkg/top_pkg.sv
112
+ ../tlul/tlul_pkg.sv
113
+ ../pkg/lc_ctrl_state_pkg.sv
114
+ ../pkg/lc_ctrl_reg_pkg.sv
115
+ ../pkg/lc_ctrl_pkg.sv
116
+ ../pkg/top_racl_pkg.sv
117
+ ../pkg/edn_pkg.sv
118
+ ../pkg/alert_handler_reg_pkg.sv
119
+ ../pkg/alert_handler_pkg.sv
120
+
121
+ ../prim/prim_secded_inv_64_57_enc.sv
122
+ ../prim/prim_secded_inv_64_57_dec.sv
123
+ ../prim/prim_secded_inv_39_32_enc.sv
124
+ ../prim/prim_secded_inv_39_32_dec.sv
125
+
126
+ ../tlul/tlul_err.sv
127
+ ../tlul/tlul_cmd_intg_chk.sv
128
+ ../tlul/tlul_rsp_intg_gen.sv
129
+ ../tlul/tlul_data_integ_dec.sv
130
+ ../tlul/tlul_data_integ_enc.sv
131
+ ../tlul/tlul_adapter_reg.sv
132
+ ../tlul/tlul_adapter_reg_shadowed.sv
133
+
134
+ ../prim/prim_buf.sv
135
+ ../prim/prim_xnor2.sv
136
+ ../prim/prim_flop.sv
137
+ ../prim/prim_cdc_rand_delay.sv
138
+ ../prim/prim_flop_2sync.sv
139
+ ../prim/prim_mubi4_sync.sv
140
+ ../prim/prim_onehot_enc.sv
141
+ ../prim/prim_onehot_check.sv
142
+ ../prim/prim_subreg_arb.sv
143
+ ../prim/prim_subreg.sv
144
+ ../prim/prim_subreg_ext.sv
145
+ ../prim/prim_subreg_shadow.sv
146
+ ../prim/prim_reg_we_check.sv
147
+ ../prim/prim_sec_anchor_buf.sv
148
+ ../prim/prim_sec_anchor_flop.sv
149
+ ../prim/prim_alert_sender.sv
150
+ ../prim/prim_alert_receiver.sv
151
+ ../prim/prim_esc_sender.sv
152
+ ../prim/prim_intr_hw.sv
153
+ ../prim/prim_lc_sync.sv
154
+ ../prim/prim_edge_detector.sv
155
+ ../prim/prim_pulse_sync.sv
156
+ ../prim/prim_sync_reqack.sv
157
+ ../prim/prim_fifo_sync.sv
158
+ ../prim/prim_packer_fifo.sv
159
+ ../prim/prim_max_tree.sv
160
+ ../prim/prim_diff_decode.sv
161
+ ../prim/prim_edn_req.sv
162
+ ../prim/prim_count.sv
163
+ ../prim/prim_sparse_fsm_flop.sv
164
+ ../prim/prim_lfsr.sv
165
+ ../prim/prim_double_lfsr.sv
166
+ ../prim/prim_reg_cdc_arb.sv
167
+ ../prim/prim_reg_cdc.sv
168
+
169
+ ../rtl/alert_handler_reg_top.sv
170
+ ../rtl/alert_handler_reg_wrap.sv
171
+ ../rtl/alert_handler_accu.sv
172
+ ../rtl/alert_handler_class.sv
173
+ ../rtl/alert_handler_lpg_ctrl.sv
174
+ ../rtl/alert_handler_esc_timer.sv
175
+ ../rtl/alert_handler_ping_timer.sv
176
+ ../rtl/alert_handler.sv
177
+ FILELIST
178
+
179
+ cat > "$WS/run/Makefile" << 'MAKEFILE'
180
+ .PHONY: compile clean
181
+
182
+ compile:
183
+ @mkdir -p compile_log
184
+ xrun -c -64 -sv -access +rwc -elaborate \
185
+ -f filelist.f \
186
+ -timescale 1ns/1ps \
187
+ -l compile_log/compile.log 2>&1 || true
188
+ @echo "Check compile_log/compile.log"
189
+
190
+ clean:
191
+ rm -rf xcelium.d compile_log
192
+ MAKEFILE
193
+
194
+ echo ""
195
+ echo "[verify] Workspace contents:"
196
+ for d in prim tlul pkg spec rtl run; do
197
+ echo " $d/: $(find $WS/$d -type f 2>/dev/null | wc -l) files"
198
+ done
199
+ echo ""
200
+ echo "=== Workspace populated. alert_handler_esc_timer.sv stub added by environment Dockerfile. ==="
images/rtl/alert_handler-lpg-ctrl/Dockerfile ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TitanBench ALERT_HANDLER-LPG-CTRL-RTL — extends titanbench-base with OpenTitan infrastructure.
2
+ #
3
+ # docker build -f images/rtl/alert_handler-lpg-ctrl/image/Dockerfile \
4
+ # --build-context titanbench=/path/to/titanbench \
5
+ # -t titanbench-alert_handler-lpg-ctrl-rtl /path/to/opentitan
6
+
7
+ FROM titanbench-base:latest
8
+
9
+ COPY --chown=dev:dev . /home/dev/src/
10
+
11
+ # Restore autogen files for non-Earlgrey tops that .dockerignore excludes
12
+ # but fusesoc needs when building alert_handler DV.
13
+ COPY --from=titanbench joe_exp/ot_autogen_fix/hw/ /home/dev/src/hw/
14
+
15
+ COPY --from=titanbench images/rtl/alert_handler-lpg-ctrl/scripts/setup_workspace.sh /home/dev/scripts/setup_workspace.sh
16
+ RUN chmod +x /home/dev/scripts/setup_workspace.sh \
17
+ && bash /home/dev/scripts/setup_workspace.sh
18
+
19
+ RUN git config --global --add safe.directory /home/dev/src \
20
+ && git config --global user.email "titanbench@opentitan.org" \
21
+ && git config --global user.name "TitanBench" \
22
+ && cd /home/dev/src \
23
+ && git init \
24
+ && git add -A \
25
+ && git commit -m "titanbench alert_handler-lpg-ctrl-rtl base"
26
+
27
+ WORKDIR /home/dev/workspace/code
28
+ ENTRYPOINT []
29
+ CMD ["sh", "-c", "sleep infinity"]
images/rtl/alert_handler-lpg-ctrl/scripts/setup_workspace.sh ADDED
@@ -0,0 +1,200 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Copyright lowRISC contributors (OpenTitan project).
3
+ # Licensed under the Apache License, Version 2.0, see LICENSE for details.
4
+ # SPDX-License-Identifier: Apache-2.0
5
+ #
6
+ # Populates the ALERT_HANDLER-LPG-CTRL-RTL workspace with infrastructure + oracle RTL for every
7
+ # module except alert_handler_lpg_ctrl.sv (overlaid as a stub by the environment Dockerfile).
8
+
9
+ set -euo pipefail
10
+
11
+ REPO_TOP="/home/dev/src"
12
+ WS="/home/dev/workspace/code"
13
+ AH_RTL="$REPO_TOP/hw/top_earlgrey/ip_autogen/alert_handler/rtl"
14
+ AH_DATA="$REPO_TOP/hw/top_earlgrey/ip_autogen/alert_handler/data"
15
+ AH_DOC="$REPO_TOP/hw/top_earlgrey/ip_autogen/alert_handler/doc"
16
+
17
+ echo "=== TitanBench: Populating ALERT_HANDLER-LPG-CTRL-RTL workspace ==="
18
+
19
+ mkdir -p "$WS"/{prim,tlul,pkg,spec,run,rtl}
20
+
21
+ echo "[1/6] Copying prim modules..."
22
+ PRIM_SRC="$REPO_TOP/hw/ip/prim/rtl"
23
+ PRIM_GEN_SRC="$REPO_TOP/hw/ip/prim_generic/rtl"
24
+
25
+ PRIM_FILES=(
26
+ prim_alert_pkg.sv prim_esc_pkg.sv prim_mubi_pkg.sv prim_secded_pkg.sv
27
+ prim_subreg_pkg.sv prim_util_pkg.sv prim_count_pkg.sv
28
+ prim_assert.sv prim_assert_sec_cm.svh prim_assert_standard_macros.svh
29
+ prim_flop_macros.sv prim_cdc_rand_delay.sv
30
+ prim_onehot_enc.sv prim_onehot_check.sv
31
+ prim_subreg.sv prim_subreg_arb.sv prim_subreg_ext.sv prim_subreg_shadow.sv
32
+ prim_reg_we_check.sv
33
+ prim_sec_anchor_buf.sv prim_sec_anchor_flop.sv
34
+ prim_alert_sender.sv prim_alert_receiver.sv prim_esc_sender.sv
35
+ prim_intr_hw.sv prim_edn_req.sv
36
+ prim_lc_sync.sv prim_edge_detector.sv prim_pulse_sync.sv prim_sync_reqack.sv
37
+ prim_mubi4_sync.sv
38
+ prim_count.sv prim_sparse_fsm_flop.sv prim_double_lfsr.sv prim_lfsr.sv
39
+ prim_reg_cdc.sv prim_reg_cdc_arb.sv
40
+ prim_packer_fifo.sv prim_fifo_sync.sv prim_max_tree.sv prim_diff_decode.sv
41
+ prim_secded_inv_22_16_dec.sv prim_secded_inv_22_16_enc.sv
42
+ prim_secded_inv_28_22_dec.sv prim_secded_inv_28_22_enc.sv
43
+ prim_secded_inv_39_32_dec.sv prim_secded_inv_39_32_enc.sv
44
+ prim_secded_inv_64_57_dec.sv prim_secded_inv_64_57_enc.sv
45
+ prim_secded_inv_72_64_dec.sv prim_secded_inv_72_64_enc.sv
46
+ prim_secded_inv_hamming_22_16_dec.sv prim_secded_inv_hamming_22_16_enc.sv
47
+ prim_secded_inv_hamming_39_32_dec.sv prim_secded_inv_hamming_39_32_enc.sv
48
+ prim_secded_inv_hamming_72_64_dec.sv prim_secded_inv_hamming_72_64_enc.sv
49
+ prim_secded_inv_hamming_76_68_dec.sv prim_secded_inv_hamming_76_68_enc.sv
50
+ prim_util_memload.svh
51
+ )
52
+ PRIM_GENERIC_FILES=( prim_buf.sv prim_flop.sv prim_flop_2sync.sv prim_xnor2.sv )
53
+ for f in "${PRIM_FILES[@]}"; do cp "$PRIM_SRC/$f" "$WS/prim/" 2>/dev/null || echo " missing $f"; done
54
+ for f in "${PRIM_GENERIC_FILES[@]}"; do cp "$PRIM_GEN_SRC/$f" "$WS/prim/"; done
55
+ echo " Copied prims"
56
+
57
+ echo "[2/6] Copying TLUL modules..."
58
+ TLUL_SRC="$REPO_TOP/hw/ip/tlul/rtl"
59
+ for f in tlul_pkg.sv tlul_adapter_reg.sv tlul_adapter_reg_shadowed.sv tlul_cmd_intg_chk.sv tlul_data_integ_dec.sv tlul_data_integ_enc.sv tlul_err.sv tlul_rsp_intg_gen.sv; do
60
+ cp "$TLUL_SRC/$f" "$WS/tlul/" 2>/dev/null || echo " missing $f"
61
+ done
62
+
63
+ echo "[3/6] Copying package files..."
64
+ cp "$AH_RTL/alert_handler_reg_pkg.sv" "$WS/pkg/"
65
+ cp "$AH_RTL/alert_handler_pkg.sv" "$WS/pkg/"
66
+ cp "$REPO_TOP/hw/top_earlgrey/rtl/top_pkg.sv" "$WS/pkg/"
67
+ cp "$REPO_TOP/hw/top_earlgrey/rtl/autogen/top_racl_pkg.sv" "$WS/pkg/"
68
+ cp "$REPO_TOP/hw/ip/lc_ctrl/rtl/lc_ctrl_pkg.sv" "$WS/pkg/"
69
+ cp "$REPO_TOP/hw/ip/lc_ctrl/rtl/lc_ctrl_reg_pkg.sv" "$WS/pkg/"
70
+ cp "$REPO_TOP/hw/ip/lc_ctrl/rtl/lc_ctrl_state_pkg.sv" "$WS/pkg/"
71
+ cp "$REPO_TOP/hw/ip/edn/rtl/edn_pkg.sv" "$WS/pkg/"
72
+
73
+ echo "[4/6] Copying spec documentation..."
74
+ cp "$AH_DOC/theory_of_operation.md" "$WS/spec/"
75
+ cp "$AH_DOC/programmers_guide.md" "$WS/spec/"
76
+ cp "$AH_DOC/alert_handler_alert_rxtx.svg" "$WS/spec/" 2>/dev/null || true
77
+ cp "$AH_DOC/alert_handler_block_diagram.svg" "$WS/spec/" 2>/dev/null || true
78
+ cp "$AH_DOC/alert_handler_escalation_rxtx.svg" "$WS/spec/" 2>/dev/null || true
79
+ cp "$AH_DOC/alert_handler_lpg_ctrl.svg" "$WS/spec/" 2>/dev/null || true
80
+ cp "$AH_DOC/alert_handler_lp_overview.svg" "$WS/spec/" 2>/dev/null || true
81
+ cp "$AH_DOC/alert_handler_receiver_fsm.svg" "$WS/spec/" 2>/dev/null || true
82
+ cp "$AH_DATA/alert_handler_testplan.hjson" "$WS/spec/" 2>/dev/null || true
83
+ cp "$AH_DATA/alert_handler.hjson" "$WS/spec/" 2>/dev/null || true
84
+ cp "$AH_DATA/alert_handler_sec_cm_testplan.hjson" "$WS/spec/" 2>/dev/null || true
85
+ cp "$AH_DOC/checklist.md" "$WS/spec/" 2>/dev/null || true
86
+
87
+ cp "$AH_RTL/../README.md" "$WS/spec/alert_handler_README.md" 2>/dev/null || true
88
+
89
+ echo "[5/6] Copying RTL (all except alert_handler_lpg_ctrl.sv)..."
90
+ for f in alert_handler.sv alert_handler_reg_top.sv alert_handler_reg_wrap.sv \
91
+ alert_handler_accu.sv alert_handler_class.sv alert_handler_esc_timer.sv \
92
+ alert_handler_lpg_ctrl.sv alert_handler_ping_timer.sv; do
93
+ if [ "$f" = "alert_handler_lpg_ctrl.sv" ]; then
94
+ echo " skipping $f (agent stub)"
95
+ continue
96
+ fi
97
+ cp "$AH_RTL/$f" "$WS/rtl/"
98
+ done
99
+
100
+ echo "[6/6] Creating run directory..."
101
+ cat > "$WS/run/filelist.f" << 'FILELIST'
102
+ +incdir+../prim
103
+ ../prim/prim_assert.sv
104
+ ../prim/prim_util_pkg.sv
105
+ ../prim/prim_mubi_pkg.sv
106
+ ../prim/prim_alert_pkg.sv
107
+ ../prim/prim_esc_pkg.sv
108
+ ../prim/prim_subreg_pkg.sv
109
+ ../prim/prim_secded_pkg.sv
110
+ ../prim/prim_count_pkg.sv
111
+ ../pkg/top_pkg.sv
112
+ ../tlul/tlul_pkg.sv
113
+ ../pkg/lc_ctrl_state_pkg.sv
114
+ ../pkg/lc_ctrl_reg_pkg.sv
115
+ ../pkg/lc_ctrl_pkg.sv
116
+ ../pkg/top_racl_pkg.sv
117
+ ../pkg/edn_pkg.sv
118
+ ../pkg/alert_handler_reg_pkg.sv
119
+ ../pkg/alert_handler_pkg.sv
120
+
121
+ ../prim/prim_secded_inv_64_57_enc.sv
122
+ ../prim/prim_secded_inv_64_57_dec.sv
123
+ ../prim/prim_secded_inv_39_32_enc.sv
124
+ ../prim/prim_secded_inv_39_32_dec.sv
125
+
126
+ ../tlul/tlul_err.sv
127
+ ../tlul/tlul_cmd_intg_chk.sv
128
+ ../tlul/tlul_rsp_intg_gen.sv
129
+ ../tlul/tlul_data_integ_dec.sv
130
+ ../tlul/tlul_data_integ_enc.sv
131
+ ../tlul/tlul_adapter_reg.sv
132
+ ../tlul/tlul_adapter_reg_shadowed.sv
133
+
134
+ ../prim/prim_buf.sv
135
+ ../prim/prim_xnor2.sv
136
+ ../prim/prim_flop.sv
137
+ ../prim/prim_cdc_rand_delay.sv
138
+ ../prim/prim_flop_2sync.sv
139
+ ../prim/prim_mubi4_sync.sv
140
+ ../prim/prim_onehot_enc.sv
141
+ ../prim/prim_onehot_check.sv
142
+ ../prim/prim_subreg_arb.sv
143
+ ../prim/prim_subreg.sv
144
+ ../prim/prim_subreg_ext.sv
145
+ ../prim/prim_subreg_shadow.sv
146
+ ../prim/prim_reg_we_check.sv
147
+ ../prim/prim_sec_anchor_buf.sv
148
+ ../prim/prim_sec_anchor_flop.sv
149
+ ../prim/prim_alert_sender.sv
150
+ ../prim/prim_alert_receiver.sv
151
+ ../prim/prim_esc_sender.sv
152
+ ../prim/prim_intr_hw.sv
153
+ ../prim/prim_lc_sync.sv
154
+ ../prim/prim_edge_detector.sv
155
+ ../prim/prim_pulse_sync.sv
156
+ ../prim/prim_sync_reqack.sv
157
+ ../prim/prim_fifo_sync.sv
158
+ ../prim/prim_packer_fifo.sv
159
+ ../prim/prim_max_tree.sv
160
+ ../prim/prim_diff_decode.sv
161
+ ../prim/prim_edn_req.sv
162
+ ../prim/prim_count.sv
163
+ ../prim/prim_sparse_fsm_flop.sv
164
+ ../prim/prim_lfsr.sv
165
+ ../prim/prim_double_lfsr.sv
166
+ ../prim/prim_reg_cdc_arb.sv
167
+ ../prim/prim_reg_cdc.sv
168
+
169
+ ../rtl/alert_handler_reg_top.sv
170
+ ../rtl/alert_handler_reg_wrap.sv
171
+ ../rtl/alert_handler_accu.sv
172
+ ../rtl/alert_handler_class.sv
173
+ ../rtl/alert_handler_lpg_ctrl.sv
174
+ ../rtl/alert_handler_esc_timer.sv
175
+ ../rtl/alert_handler_ping_timer.sv
176
+ ../rtl/alert_handler.sv
177
+ FILELIST
178
+
179
+ cat > "$WS/run/Makefile" << 'MAKEFILE'
180
+ .PHONY: compile clean
181
+
182
+ compile:
183
+ @mkdir -p compile_log
184
+ xrun -c -64 -sv -access +rwc -elaborate \
185
+ -f filelist.f \
186
+ -timescale 1ns/1ps \
187
+ -l compile_log/compile.log 2>&1 || true
188
+ @echo "Check compile_log/compile.log"
189
+
190
+ clean:
191
+ rm -rf xcelium.d compile_log
192
+ MAKEFILE
193
+
194
+ echo ""
195
+ echo "[verify] Workspace contents:"
196
+ for d in prim tlul pkg spec rtl run; do
197
+ echo " $d/: $(find $WS/$d -type f 2>/dev/null | wc -l) files"
198
+ done
199
+ echo ""
200
+ echo "=== Workspace populated. alert_handler_lpg_ctrl.sv stub added by environment Dockerfile. ==="
images/rtl/alert_handler-ping-timer/Dockerfile ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TitanBench ALERT_HANDLER-PING-TIMER-RTL — extends titanbench-base with OpenTitan infrastructure.
2
+ #
3
+ # docker build -f images/rtl/alert_handler-ping-timer/image/Dockerfile \
4
+ # --build-context titanbench=/path/to/titanbench \
5
+ # -t titanbench-alert_handler-ping-timer-rtl /path/to/opentitan
6
+
7
+ FROM titanbench-base:latest
8
+
9
+ COPY --chown=dev:dev . /home/dev/src/
10
+
11
+ # Restore autogen files for non-Earlgrey tops that .dockerignore excludes
12
+ # but fusesoc needs when building alert_handler DV.
13
+ COPY --from=titanbench joe_exp/ot_autogen_fix/hw/ /home/dev/src/hw/
14
+
15
+ COPY --from=titanbench images/rtl/alert_handler-ping-timer/scripts/setup_workspace.sh /home/dev/scripts/setup_workspace.sh
16
+ RUN chmod +x /home/dev/scripts/setup_workspace.sh \
17
+ && bash /home/dev/scripts/setup_workspace.sh
18
+
19
+ RUN git config --global --add safe.directory /home/dev/src \
20
+ && git config --global user.email "titanbench@opentitan.org" \
21
+ && git config --global user.name "TitanBench" \
22
+ && cd /home/dev/src \
23
+ && git init \
24
+ && git add -A \
25
+ && git commit -m "titanbench alert_handler-ping-timer-rtl base"
26
+
27
+ WORKDIR /home/dev/workspace/code
28
+ ENTRYPOINT []
29
+ CMD ["sh", "-c", "sleep infinity"]
images/rtl/alert_handler-ping-timer/scripts/setup_workspace.sh ADDED
@@ -0,0 +1,200 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Copyright lowRISC contributors (OpenTitan project).
3
+ # Licensed under the Apache License, Version 2.0, see LICENSE for details.
4
+ # SPDX-License-Identifier: Apache-2.0
5
+ #
6
+ # Populates the ALERT_HANDLER-PING-TIMER-RTL workspace with infrastructure + oracle RTL for every
7
+ # module except alert_handler_ping_timer.sv (overlaid as a stub by the environment Dockerfile).
8
+
9
+ set -euo pipefail
10
+
11
+ REPO_TOP="/home/dev/src"
12
+ WS="/home/dev/workspace/code"
13
+ AH_RTL="$REPO_TOP/hw/top_earlgrey/ip_autogen/alert_handler/rtl"
14
+ AH_DATA="$REPO_TOP/hw/top_earlgrey/ip_autogen/alert_handler/data"
15
+ AH_DOC="$REPO_TOP/hw/top_earlgrey/ip_autogen/alert_handler/doc"
16
+
17
+ echo "=== TitanBench: Populating ALERT_HANDLER-PING-TIMER-RTL workspace ==="
18
+
19
+ mkdir -p "$WS"/{prim,tlul,pkg,spec,run,rtl}
20
+
21
+ echo "[1/6] Copying prim modules..."
22
+ PRIM_SRC="$REPO_TOP/hw/ip/prim/rtl"
23
+ PRIM_GEN_SRC="$REPO_TOP/hw/ip/prim_generic/rtl"
24
+
25
+ PRIM_FILES=(
26
+ prim_alert_pkg.sv prim_esc_pkg.sv prim_mubi_pkg.sv prim_secded_pkg.sv
27
+ prim_subreg_pkg.sv prim_util_pkg.sv prim_count_pkg.sv
28
+ prim_assert.sv prim_assert_sec_cm.svh prim_assert_standard_macros.svh
29
+ prim_flop_macros.sv prim_cdc_rand_delay.sv
30
+ prim_onehot_enc.sv prim_onehot_check.sv
31
+ prim_subreg.sv prim_subreg_arb.sv prim_subreg_ext.sv prim_subreg_shadow.sv
32
+ prim_reg_we_check.sv
33
+ prim_sec_anchor_buf.sv prim_sec_anchor_flop.sv
34
+ prim_alert_sender.sv prim_alert_receiver.sv prim_esc_sender.sv
35
+ prim_intr_hw.sv prim_edn_req.sv
36
+ prim_lc_sync.sv prim_edge_detector.sv prim_pulse_sync.sv prim_sync_reqack.sv
37
+ prim_mubi4_sync.sv
38
+ prim_count.sv prim_sparse_fsm_flop.sv prim_double_lfsr.sv prim_lfsr.sv
39
+ prim_reg_cdc.sv prim_reg_cdc_arb.sv
40
+ prim_packer_fifo.sv prim_fifo_sync.sv prim_max_tree.sv prim_diff_decode.sv
41
+ prim_secded_inv_22_16_dec.sv prim_secded_inv_22_16_enc.sv
42
+ prim_secded_inv_28_22_dec.sv prim_secded_inv_28_22_enc.sv
43
+ prim_secded_inv_39_32_dec.sv prim_secded_inv_39_32_enc.sv
44
+ prim_secded_inv_64_57_dec.sv prim_secded_inv_64_57_enc.sv
45
+ prim_secded_inv_72_64_dec.sv prim_secded_inv_72_64_enc.sv
46
+ prim_secded_inv_hamming_22_16_dec.sv prim_secded_inv_hamming_22_16_enc.sv
47
+ prim_secded_inv_hamming_39_32_dec.sv prim_secded_inv_hamming_39_32_enc.sv
48
+ prim_secded_inv_hamming_72_64_dec.sv prim_secded_inv_hamming_72_64_enc.sv
49
+ prim_secded_inv_hamming_76_68_dec.sv prim_secded_inv_hamming_76_68_enc.sv
50
+ prim_util_memload.svh
51
+ )
52
+ PRIM_GENERIC_FILES=( prim_buf.sv prim_flop.sv prim_flop_2sync.sv prim_xnor2.sv )
53
+ for f in "${PRIM_FILES[@]}"; do cp "$PRIM_SRC/$f" "$WS/prim/" 2>/dev/null || echo " missing $f"; done
54
+ for f in "${PRIM_GENERIC_FILES[@]}"; do cp "$PRIM_GEN_SRC/$f" "$WS/prim/"; done
55
+ echo " Copied prims"
56
+
57
+ echo "[2/6] Copying TLUL modules..."
58
+ TLUL_SRC="$REPO_TOP/hw/ip/tlul/rtl"
59
+ for f in tlul_pkg.sv tlul_adapter_reg.sv tlul_adapter_reg_shadowed.sv tlul_cmd_intg_chk.sv tlul_data_integ_dec.sv tlul_data_integ_enc.sv tlul_err.sv tlul_rsp_intg_gen.sv; do
60
+ cp "$TLUL_SRC/$f" "$WS/tlul/" 2>/dev/null || echo " missing $f"
61
+ done
62
+
63
+ echo "[3/6] Copying package files..."
64
+ cp "$AH_RTL/alert_handler_reg_pkg.sv" "$WS/pkg/"
65
+ cp "$AH_RTL/alert_handler_pkg.sv" "$WS/pkg/"
66
+ cp "$REPO_TOP/hw/top_earlgrey/rtl/top_pkg.sv" "$WS/pkg/"
67
+ cp "$REPO_TOP/hw/top_earlgrey/rtl/autogen/top_racl_pkg.sv" "$WS/pkg/"
68
+ cp "$REPO_TOP/hw/ip/lc_ctrl/rtl/lc_ctrl_pkg.sv" "$WS/pkg/"
69
+ cp "$REPO_TOP/hw/ip/lc_ctrl/rtl/lc_ctrl_reg_pkg.sv" "$WS/pkg/"
70
+ cp "$REPO_TOP/hw/ip/lc_ctrl/rtl/lc_ctrl_state_pkg.sv" "$WS/pkg/"
71
+ cp "$REPO_TOP/hw/ip/edn/rtl/edn_pkg.sv" "$WS/pkg/"
72
+
73
+ echo "[4/6] Copying spec documentation..."
74
+ cp "$AH_DOC/theory_of_operation.md" "$WS/spec/"
75
+ cp "$AH_DOC/programmers_guide.md" "$WS/spec/"
76
+ cp "$AH_DOC/alert_handler_alert_rxtx.svg" "$WS/spec/" 2>/dev/null || true
77
+ cp "$AH_DOC/alert_handler_block_diagram.svg" "$WS/spec/" 2>/dev/null || true
78
+ cp "$AH_DOC/alert_handler_escalation_rxtx.svg" "$WS/spec/" 2>/dev/null || true
79
+ cp "$AH_DOC/alert_handler_lpg_ctrl.svg" "$WS/spec/" 2>/dev/null || true
80
+ cp "$AH_DOC/alert_handler_lp_overview.svg" "$WS/spec/" 2>/dev/null || true
81
+ cp "$AH_DOC/alert_handler_receiver_fsm.svg" "$WS/spec/" 2>/dev/null || true
82
+ cp "$AH_DATA/alert_handler_testplan.hjson" "$WS/spec/" 2>/dev/null || true
83
+ cp "$AH_DATA/alert_handler.hjson" "$WS/spec/" 2>/dev/null || true
84
+ cp "$AH_DATA/alert_handler_sec_cm_testplan.hjson" "$WS/spec/" 2>/dev/null || true
85
+ cp "$AH_DOC/checklist.md" "$WS/spec/" 2>/dev/null || true
86
+
87
+ cp "$AH_RTL/../README.md" "$WS/spec/alert_handler_README.md" 2>/dev/null || true
88
+
89
+ echo "[5/6] Copying RTL (all except alert_handler_ping_timer.sv)..."
90
+ for f in alert_handler.sv alert_handler_reg_top.sv alert_handler_reg_wrap.sv \
91
+ alert_handler_accu.sv alert_handler_class.sv alert_handler_esc_timer.sv \
92
+ alert_handler_lpg_ctrl.sv alert_handler_ping_timer.sv; do
93
+ if [ "$f" = "alert_handler_ping_timer.sv" ]; then
94
+ echo " skipping $f (agent stub)"
95
+ continue
96
+ fi
97
+ cp "$AH_RTL/$f" "$WS/rtl/"
98
+ done
99
+
100
+ echo "[6/6] Creating run directory..."
101
+ cat > "$WS/run/filelist.f" << 'FILELIST'
102
+ +incdir+../prim
103
+ ../prim/prim_assert.sv
104
+ ../prim/prim_util_pkg.sv
105
+ ../prim/prim_mubi_pkg.sv
106
+ ../prim/prim_alert_pkg.sv
107
+ ../prim/prim_esc_pkg.sv
108
+ ../prim/prim_subreg_pkg.sv
109
+ ../prim/prim_secded_pkg.sv
110
+ ../prim/prim_count_pkg.sv
111
+ ../pkg/top_pkg.sv
112
+ ../tlul/tlul_pkg.sv
113
+ ../pkg/lc_ctrl_state_pkg.sv
114
+ ../pkg/lc_ctrl_reg_pkg.sv
115
+ ../pkg/lc_ctrl_pkg.sv
116
+ ../pkg/top_racl_pkg.sv
117
+ ../pkg/edn_pkg.sv
118
+ ../pkg/alert_handler_reg_pkg.sv
119
+ ../pkg/alert_handler_pkg.sv
120
+
121
+ ../prim/prim_secded_inv_64_57_enc.sv
122
+ ../prim/prim_secded_inv_64_57_dec.sv
123
+ ../prim/prim_secded_inv_39_32_enc.sv
124
+ ../prim/prim_secded_inv_39_32_dec.sv
125
+
126
+ ../tlul/tlul_err.sv
127
+ ../tlul/tlul_cmd_intg_chk.sv
128
+ ../tlul/tlul_rsp_intg_gen.sv
129
+ ../tlul/tlul_data_integ_dec.sv
130
+ ../tlul/tlul_data_integ_enc.sv
131
+ ../tlul/tlul_adapter_reg.sv
132
+ ../tlul/tlul_adapter_reg_shadowed.sv
133
+
134
+ ../prim/prim_buf.sv
135
+ ../prim/prim_xnor2.sv
136
+ ../prim/prim_flop.sv
137
+ ../prim/prim_cdc_rand_delay.sv
138
+ ../prim/prim_flop_2sync.sv
139
+ ../prim/prim_mubi4_sync.sv
140
+ ../prim/prim_onehot_enc.sv
141
+ ../prim/prim_onehot_check.sv
142
+ ../prim/prim_subreg_arb.sv
143
+ ../prim/prim_subreg.sv
144
+ ../prim/prim_subreg_ext.sv
145
+ ../prim/prim_subreg_shadow.sv
146
+ ../prim/prim_reg_we_check.sv
147
+ ../prim/prim_sec_anchor_buf.sv
148
+ ../prim/prim_sec_anchor_flop.sv
149
+ ../prim/prim_alert_sender.sv
150
+ ../prim/prim_alert_receiver.sv
151
+ ../prim/prim_esc_sender.sv
152
+ ../prim/prim_intr_hw.sv
153
+ ../prim/prim_lc_sync.sv
154
+ ../prim/prim_edge_detector.sv
155
+ ../prim/prim_pulse_sync.sv
156
+ ../prim/prim_sync_reqack.sv
157
+ ../prim/prim_fifo_sync.sv
158
+ ../prim/prim_packer_fifo.sv
159
+ ../prim/prim_max_tree.sv
160
+ ../prim/prim_diff_decode.sv
161
+ ../prim/prim_edn_req.sv
162
+ ../prim/prim_count.sv
163
+ ../prim/prim_sparse_fsm_flop.sv
164
+ ../prim/prim_lfsr.sv
165
+ ../prim/prim_double_lfsr.sv
166
+ ../prim/prim_reg_cdc_arb.sv
167
+ ../prim/prim_reg_cdc.sv
168
+
169
+ ../rtl/alert_handler_reg_top.sv
170
+ ../rtl/alert_handler_reg_wrap.sv
171
+ ../rtl/alert_handler_accu.sv
172
+ ../rtl/alert_handler_class.sv
173
+ ../rtl/alert_handler_lpg_ctrl.sv
174
+ ../rtl/alert_handler_esc_timer.sv
175
+ ../rtl/alert_handler_ping_timer.sv
176
+ ../rtl/alert_handler.sv
177
+ FILELIST
178
+
179
+ cat > "$WS/run/Makefile" << 'MAKEFILE'
180
+ .PHONY: compile clean
181
+
182
+ compile:
183
+ @mkdir -p compile_log
184
+ xrun -c -64 -sv -access +rwc -elaborate \
185
+ -f filelist.f \
186
+ -timescale 1ns/1ps \
187
+ -l compile_log/compile.log 2>&1 || true
188
+ @echo "Check compile_log/compile.log"
189
+
190
+ clean:
191
+ rm -rf xcelium.d compile_log
192
+ MAKEFILE
193
+
194
+ echo ""
195
+ echo "[verify] Workspace contents:"
196
+ for d in prim tlul pkg spec rtl run; do
197
+ echo " $d/: $(find $WS/$d -type f 2>/dev/null | wc -l) files"
198
+ done
199
+ echo ""
200
+ echo "=== Workspace populated. alert_handler_ping_timer.sv stub added by environment Dockerfile. ==="
images/rtl/alert_handler/Dockerfile ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TitanBench ALERT_HANDLER-RTL — extends titanbench-base with OpenTitan infrastructure.
2
+ #
3
+ # Uses two build contexts:
4
+ # - default context (.) = OpenTitan repo root
5
+ # - titanbench = titanbench repo root
6
+ #
7
+ # Usage:
8
+ # docker build -f images/rtl/alert_handler/image/Dockerfile \
9
+ # --build-context titanbench=/path/to/titanbench \
10
+ # -t titanbench-alert_handler-rtl /path/to/opentitan
11
+
12
+ FROM titanbench-base:latest
13
+
14
+ # Copy the OpenTitan repo
15
+ COPY --chown=dev:dev . /home/dev/src/
16
+
17
+ # Restore top_englishbreakfast autogen files that the OpenTitan .dockerignore
18
+ # excludes but alert_handler DV still references during setup.
19
+ COPY --from=titanbench opentitan/hw/top_englishbreakfast/ /home/dev/src/hw/top_englishbreakfast/
20
+
21
+ # Copy the setup script from the titanbench repo
22
+ COPY --from=titanbench tasks_missing_rtl/alert_handler-rtl/scripts/setup_workspace.sh /home/dev/scripts/setup_workspace.sh
23
+ RUN chmod +x /home/dev/scripts/setup_workspace.sh \
24
+ && bash /home/dev/scripts/setup_workspace.sh
25
+
26
+ # Git setup — dvsim requires a git repo with at least one commit
27
+ RUN git config --global --add safe.directory /home/dev/src \
28
+ && git config --global user.email "titanbench@opentitan.org" \
29
+ && git config --global user.name "TitanBench" \
30
+ && cd /home/dev/src \
31
+ && git init \
32
+ && git add -A \
33
+ && git commit -m "titanbench alert_handler-rtl base"
34
+
35
+ WORKDIR /home/dev/workspace/code
36
+ ENTRYPOINT []
37
+ CMD ["sh", "-c", "sleep infinity"]
images/rtl/alert_handler/scripts/setup_workspace.sh ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ REPO_TOP="/home/dev/src"
4
+ WS="/home/dev/workspace/code"
5
+ AH_RTL="$REPO_TOP/hw/top_earlgrey/ip_autogen/alert_handler/rtl"
6
+ AH_DATA="$REPO_TOP/hw/top_earlgrey/ip_autogen/alert_handler/data"
7
+ AH_DOC="$REPO_TOP/hw/top_earlgrey/ip_autogen/alert_handler/doc"
8
+ mkdir -p "$WS"/{prim,tlul,pkg,spec,run,rtl}
9
+ PRIM_SRC="$REPO_TOP/hw/ip/prim/rtl"
10
+ PRIM_GEN_SRC="$REPO_TOP/hw/ip/prim_generic/rtl"
11
+ PRIM_FILES=(
12
+ prim_alert_pkg.sv prim_esc_pkg.sv prim_mubi_pkg.sv prim_secded_pkg.sv prim_subreg_pkg.sv prim_util_pkg.sv prim_count_pkg.sv
13
+ prim_assert.sv prim_assert_sec_cm.svh prim_assert_standard_macros.svh prim_flop_macros.sv prim_cdc_rand_delay.sv
14
+ prim_onehot_enc.sv prim_onehot_check.sv prim_subreg.sv prim_subreg_arb.sv prim_subreg_ext.sv prim_subreg_shadow.sv prim_reg_we_check.sv
15
+ prim_sec_anchor_buf.sv prim_sec_anchor_flop.sv prim_alert_sender.sv prim_alert_receiver.sv prim_esc_sender.sv prim_intr_hw.sv prim_edn_req.sv
16
+ prim_lc_sync.sv prim_edge_detector.sv prim_pulse_sync.sv prim_sync_reqack.sv prim_mubi4_sync.sv prim_count.sv prim_sparse_fsm_flop.sv prim_double_lfsr.sv prim_lfsr.sv prim_reg_cdc.sv prim_reg_cdc_arb.sv prim_packer_fifo.sv prim_fifo_sync.sv prim_max_tree.sv prim_diff_decode.sv
17
+ prim_secded_inv_22_16_dec.sv prim_secded_inv_22_16_enc.sv prim_secded_inv_28_22_dec.sv prim_secded_inv_28_22_enc.sv prim_secded_inv_39_32_dec.sv prim_secded_inv_39_32_enc.sv prim_secded_inv_64_57_dec.sv prim_secded_inv_64_57_enc.sv prim_secded_inv_72_64_dec.sv prim_secded_inv_72_64_enc.sv prim_secded_inv_hamming_22_16_dec.sv prim_secded_inv_hamming_22_16_enc.sv prim_secded_inv_hamming_39_32_dec.sv prim_secded_inv_hamming_39_32_enc.sv prim_secded_inv_hamming_72_64_dec.sv prim_secded_inv_hamming_72_64_enc.sv prim_secded_inv_hamming_76_68_dec.sv prim_secded_inv_hamming_76_68_enc.sv prim_util_memload.svh
18
+ )
19
+ PRIM_GENERIC_FILES=(prim_buf.sv prim_flop.sv prim_flop_2sync.sv prim_xnor2.sv)
20
+ for f in "${PRIM_FILES[@]}"; do cp "$PRIM_SRC/$f" "$WS/prim/" 2>/dev/null || true; done
21
+ for f in "${PRIM_GENERIC_FILES[@]}"; do cp "$PRIM_GEN_SRC/$f" "$WS/prim/"; done
22
+ TLUL_SRC="$REPO_TOP/hw/ip/tlul/rtl"
23
+ for f in tlul_pkg.sv tlul_adapter_reg.sv tlul_adapter_reg_shadowed.sv tlul_cmd_intg_chk.sv tlul_data_integ_dec.sv tlul_data_integ_enc.sv tlul_err.sv tlul_rsp_intg_gen.sv; do cp "$TLUL_SRC/$f" "$WS/tlul/" 2>/dev/null || true; done
24
+ cp "$AH_RTL/alert_handler_reg_pkg.sv" "$WS/pkg/"
25
+ cp "$AH_RTL/alert_handler_pkg.sv" "$WS/pkg/"
26
+ cp "$REPO_TOP/hw/top_earlgrey/rtl/top_pkg.sv" "$WS/pkg/"
27
+ cp "$REPO_TOP/hw/top_earlgrey/rtl/autogen/top_racl_pkg.sv" "$WS/pkg/"
28
+ cp "$REPO_TOP/hw/ip/lc_ctrl/rtl/lc_ctrl_pkg.sv" "$WS/pkg/"
29
+ cp "$REPO_TOP/hw/ip/lc_ctrl/rtl/lc_ctrl_reg_pkg.sv" "$WS/pkg/"
30
+ cp "$REPO_TOP/hw/ip/lc_ctrl/rtl/lc_ctrl_state_pkg.sv" "$WS/pkg/"
31
+ cp "$REPO_TOP/hw/ip/edn/rtl/edn_pkg.sv" "$WS/pkg/"
32
+ for f in theory_of_operation.md programmers_guide.md checklist.md alert_handler_alert_rxtx.svg alert_handler_block_diagram.svg alert_handler_escalation_rxtx.svg alert_handler_lpg_ctrl.svg alert_handler_lp_overview.svg alert_handler_receiver_fsm.svg; do cp "$AH_DOC/$f" "$WS/spec/" 2>/dev/null || true; done
33
+ cp "$AH_DATA/alert_handler_testplan.hjson" "$WS/spec/" 2>/dev/null || true
34
+ cp "$AH_DATA/alert_handler.hjson" "$WS/spec/" 2>/dev/null || true
35
+ cp "$AH_DATA/alert_handler_sec_cm_testplan.hjson" "$WS/spec/" 2>/dev/null || true
36
+ cp "$AH_RTL/../README.md" "$WS/spec/alert_handler_README.md" 2>/dev/null || true
37
+ cp "$AH_RTL/alert_handler.sv" "$WS/rtl/"
38
+ cp "$AH_RTL/alert_handler_reg_top.sv" "$WS/rtl/"
39
+ cp "$AH_RTL/alert_handler_reg_wrap.sv" "$WS/rtl/"
40
+ cat > "$WS/run/filelist.f" <<'FILELIST'
41
+ +incdir+../prim
42
+ ../prim/prim_assert.sv
43
+ ../prim/prim_util_pkg.sv
44
+ ../prim/prim_mubi_pkg.sv
45
+ ../prim/prim_alert_pkg.sv
46
+ ../prim/prim_esc_pkg.sv
47
+ ../prim/prim_subreg_pkg.sv
48
+ ../prim/prim_secded_pkg.sv
49
+ ../prim/prim_count_pkg.sv
50
+ ../pkg/top_pkg.sv
51
+ ../tlul/tlul_pkg.sv
52
+ ../pkg/lc_ctrl_state_pkg.sv
53
+ ../pkg/lc_ctrl_reg_pkg.sv
54
+ ../pkg/lc_ctrl_pkg.sv
55
+ ../pkg/top_racl_pkg.sv
56
+ ../pkg/edn_pkg.sv
57
+ ../pkg/alert_handler_reg_pkg.sv
58
+ ../pkg/alert_handler_pkg.sv
59
+ ../prim/prim_secded_inv_64_57_enc.sv
60
+ ../prim/prim_secded_inv_64_57_dec.sv
61
+ ../prim/prim_secded_inv_39_32_enc.sv
62
+ ../prim/prim_secded_inv_39_32_dec.sv
63
+ ../tlul/tlul_err.sv
64
+ ../tlul/tlul_cmd_intg_chk.sv
65
+ ../tlul/tlul_rsp_intg_gen.sv
66
+ ../tlul/tlul_data_integ_dec.sv
67
+ ../tlul/tlul_data_integ_enc.sv
68
+ ../tlul/tlul_adapter_reg.sv
69
+ ../tlul/tlul_adapter_reg_shadowed.sv
70
+ ../prim/prim_buf.sv
71
+ ../prim/prim_xnor2.sv
72
+ ../prim/prim_flop.sv
73
+ ../prim/prim_cdc_rand_delay.sv
74
+ ../prim/prim_flop_2sync.sv
75
+ ../prim/prim_mubi4_sync.sv
76
+ ../prim/prim_onehot_enc.sv
77
+ ../prim/prim_onehot_check.sv
78
+ ../prim/prim_subreg_arb.sv
79
+ ../prim/prim_subreg.sv
80
+ ../prim/prim_subreg_ext.sv
81
+ ../prim/prim_subreg_shadow.sv
82
+ ../prim/prim_reg_we_check.sv
83
+ ../prim/prim_sec_anchor_buf.sv
84
+ ../prim/prim_sec_anchor_flop.sv
85
+ ../prim/prim_alert_sender.sv
86
+ ../prim/prim_alert_receiver.sv
87
+ ../prim/prim_esc_sender.sv
88
+ ../prim/prim_intr_hw.sv
89
+ ../prim/prim_lc_sync.sv
90
+ ../prim/prim_edge_detector.sv
91
+ ../prim/prim_pulse_sync.sv
92
+ ../prim/prim_sync_reqack.sv
93
+ ../prim/prim_fifo_sync.sv
94
+ ../prim/prim_packer_fifo.sv
95
+ ../prim/prim_max_tree.sv
96
+ ../prim/prim_diff_decode.sv
97
+ ../prim/prim_edn_req.sv
98
+ ../prim/prim_count.sv
99
+ ../prim/prim_sparse_fsm_flop.sv
100
+ ../prim/prim_lfsr.sv
101
+ ../prim/prim_double_lfsr.sv
102
+ ../prim/prim_reg_cdc_arb.sv
103
+ ../prim/prim_reg_cdc.sv
104
+ ../rtl/alert_handler_reg_top.sv
105
+ ../rtl/alert_handler_reg_wrap.sv
106
+ ../rtl/alert_handler_accu.sv
107
+ ../rtl/alert_handler_class.sv
108
+ ../rtl/alert_handler_lpg_ctrl.sv
109
+ ../rtl/alert_handler_esc_timer.sv
110
+ ../rtl/alert_handler_ping_timer.sv
111
+ ../rtl/alert_handler.sv
112
+ FILELIST
113
+ cat > "$WS/run/Makefile" <<'MAKEFILE'
114
+ .PHONY: compile clean
115
+ compile:
116
+ @mkdir -p compile_log
117
+ xrun -c -64 -sv -access +rwc -elaborate -f filelist.f -timescale 1ns/1ps -l compile_log/compile.log 2>&1 || true
118
+ @echo "Check compile_log/compile.log"
119
+ clean:
120
+ rm -rf xcelium.d compile_log
121
+ MAKEFILE
images/rtl/aon-timer/Dockerfile ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TitanBench AON-TIMER-RTL — extends titanbench-base with OpenTitan infrastructure.
2
+ #
3
+ # Uses two build contexts:
4
+ # - default context (.) = OpenTitan repo root
5
+ # - titanbench = titanbench repo root
6
+ #
7
+ # Usage:
8
+ # docker build -f images/rtl/aon-timer/image/Dockerfile \
9
+ # --build-context titanbench=/path/to/titanbench \
10
+ # -t titanbench-aon-timer-rtl /path/to/opentitan
11
+
12
+ FROM titanbench-base:latest
13
+
14
+ # Copy the OpenTitan repo
15
+ COPY --chown=dev:dev . /home/dev/src/
16
+
17
+ # Copy the setup script from the titanbench repo
18
+ COPY --from=titanbench images/rtl/aon-timer/scripts/setup_workspace.sh /home/dev/scripts/setup_workspace.sh
19
+ RUN chmod +x /home/dev/scripts/setup_workspace.sh \
20
+ && bash /home/dev/scripts/setup_workspace.sh
21
+
22
+ # Git setup — dvsim requires a git repo with at least one commit
23
+ RUN git config --global --add safe.directory /home/dev/src \
24
+ && git config --global user.email "titanbench@opentitan.org" \
25
+ && git config --global user.name "TitanBench" \
26
+ && cd /home/dev/src \
27
+ && git init \
28
+ && git add -A \
29
+ && git commit -m "titanbench aon-timer-rtl base"
30
+
31
+ WORKDIR /home/dev/workspace/code
32
+ ENTRYPOINT []
33
+ CMD ["sh", "-c", "sleep infinity"]
images/rtl/aon-timer/scripts/setup_workspace.sh ADDED
@@ -0,0 +1,237 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Copyright lowRISC contributors (OpenTitan project).
3
+ # Licensed under the Apache License, Version 2.0, see LICENSE for details.
4
+ # SPDX-License-Identifier: Apache-2.0
5
+ #
6
+ # Populates the AON-TIMER-RTL workspace with infrastructure files from OpenTitan.
7
+ # Copies prim, tlul, pkg, spec, and boilerplate RTL — but NOT the modules to be implemented.
8
+ #
9
+ # Run at image build time. Build context = OpenTitan repo root.
10
+
11
+ set -euo pipefail
12
+
13
+ REPO_TOP="/home/dev/src"
14
+ WS="/home/dev/workspace/code"
15
+
16
+ echo "=== TitanBench: Populating AON-TIMER-RTL workspace from OpenTitan ==="
17
+
18
+ # ── Create workspace directories ─────────────────────────────────────
19
+ mkdir -p "$WS"/{prim,tlul,pkg,spec,run,rtl}
20
+
21
+ # ── Prim modules (from hw/ip/prim/rtl/ and hw/ip/prim_generic/rtl/) ──
22
+ echo "[1/6] Copying prim modules..."
23
+ PRIM_SRC="$REPO_TOP/hw/ip/prim/rtl"
24
+ PRIM_GEN_SRC="$REPO_TOP/hw/ip/prim_generic/rtl"
25
+
26
+ PRIM_FILES=(
27
+ # Packages
28
+ prim_alert_pkg.sv
29
+ prim_mubi_pkg.sv
30
+ prim_secded_pkg.sv
31
+ prim_subreg_pkg.sv
32
+ prim_util_pkg.sv
33
+ # Assertion headers
34
+ prim_assert.sv
35
+ prim_assert_sec_cm.svh
36
+ prim_assert_standard_macros.svh
37
+ # Flops
38
+ prim_flop_macros.sv
39
+ prim_cdc_rand_delay.sv
40
+ # Combinational
41
+ prim_onehot_enc.sv
42
+ prim_onehot_check.sv
43
+ # Subreg
44
+ prim_subreg.sv
45
+ prim_subreg_arb.sv
46
+ prim_subreg_ext.sv
47
+ prim_reg_we_check.sv
48
+ # Security
49
+ prim_sec_anchor_buf.sv
50
+ prim_sec_anchor_flop.sv
51
+ prim_alert_sender.sv
52
+ prim_intr_hw.sv
53
+ # CDC and synchronization
54
+ prim_lc_sync.sv
55
+ prim_edge_detector.sv
56
+ prim_reg_cdc.sv
57
+ prim_reg_cdc_arb.sv
58
+ # SECDED (integrity — used by TLUL)
59
+ prim_secded_inv_22_16_dec.sv
60
+ prim_secded_inv_22_16_enc.sv
61
+ prim_secded_inv_28_22_dec.sv
62
+ prim_secded_inv_28_22_enc.sv
63
+ prim_secded_inv_39_32_dec.sv
64
+ prim_secded_inv_39_32_enc.sv
65
+ prim_secded_inv_64_57_dec.sv
66
+ prim_secded_inv_64_57_enc.sv
67
+ prim_secded_inv_72_64_dec.sv
68
+ prim_secded_inv_72_64_enc.sv
69
+ prim_secded_inv_hamming_22_16_dec.sv
70
+ prim_secded_inv_hamming_22_16_enc.sv
71
+ prim_secded_inv_hamming_39_32_dec.sv
72
+ prim_secded_inv_hamming_39_32_enc.sv
73
+ prim_secded_inv_hamming_72_64_dec.sv
74
+ prim_secded_inv_hamming_72_64_enc.sv
75
+ prim_secded_inv_hamming_76_68_dec.sv
76
+ prim_secded_inv_hamming_76_68_enc.sv
77
+ # Misc
78
+ prim_util_memload.svh
79
+ )
80
+
81
+ PRIM_GENERIC_FILES=(
82
+ prim_buf.sv
83
+ prim_flop.sv
84
+ prim_flop_2sync.sv
85
+ prim_xnor2.sv
86
+ )
87
+
88
+ for f in "${PRIM_FILES[@]}"; do
89
+ cp "$PRIM_SRC/$f" "$WS/prim/"
90
+ done
91
+ for f in "${PRIM_GENERIC_FILES[@]}"; do
92
+ cp "$PRIM_GEN_SRC/$f" "$WS/prim/"
93
+ done
94
+ echo " Copied $((${#PRIM_FILES[@]} + ${#PRIM_GENERIC_FILES[@]})) prim files"
95
+
96
+ # ── TLUL modules (from hw/ip/tlul/rtl/) ──────────────────────────────
97
+ echo "[2/6] Copying TLUL modules..."
98
+ TLUL_SRC="$REPO_TOP/hw/ip/tlul/rtl"
99
+
100
+ TLUL_FILES=(
101
+ tlul_pkg.sv
102
+ tlul_adapter_reg.sv
103
+ tlul_cmd_intg_chk.sv
104
+ tlul_data_integ_dec.sv
105
+ tlul_data_integ_enc.sv
106
+ tlul_err.sv
107
+ tlul_rsp_intg_gen.sv
108
+ )
109
+
110
+ for f in "${TLUL_FILES[@]}"; do
111
+ cp "$TLUL_SRC/$f" "$WS/tlul/"
112
+ done
113
+ echo " Copied ${#TLUL_FILES[@]} TLUL files"
114
+
115
+ # ── Package files ─────────────────────────────────────────────────────
116
+ echo "[3/6] Copying package files..."
117
+
118
+ cp "$REPO_TOP/hw/ip/aon_timer/rtl/aon_timer_reg_pkg.sv" "$WS/pkg/"
119
+ cp "$REPO_TOP/hw/top_earlgrey/rtl/top_pkg.sv" "$WS/pkg/"
120
+ cp "$REPO_TOP/hw/top_earlgrey/rtl/autogen/top_racl_pkg.sv" "$WS/pkg/"
121
+ cp "$REPO_TOP/hw/ip/lc_ctrl/rtl/lc_ctrl_pkg.sv" "$WS/pkg/"
122
+ cp "$REPO_TOP/hw/ip/lc_ctrl/rtl/lc_ctrl_reg_pkg.sv" "$WS/pkg/"
123
+ cp "$REPO_TOP/hw/ip/lc_ctrl/rtl/lc_ctrl_state_pkg.sv" "$WS/pkg/"
124
+
125
+ echo " Copied 6 package files"
126
+
127
+ # ── Spec documentation ────────────────────────────────────────────────
128
+ echo "[4/6] Copying spec documentation..."
129
+
130
+ cp "$REPO_TOP/hw/ip/aon_timer/doc/theory_of_operation.md" "$WS/spec/"
131
+ cp "$REPO_TOP/hw/ip/aon_timer/doc/registers.md" "$WS/spec/"
132
+ cp "$REPO_TOP/hw/ip/aon_timer/doc/interfaces.md" "$WS/spec/"
133
+ cp "$REPO_TOP/hw/ip/aon_timer/doc/programmers_guide.md" "$WS/spec/"
134
+ cp "$REPO_TOP/hw/ip/aon_timer/doc/aon_timer_block_diagram.svg" "$WS/spec/"
135
+ cp "$REPO_TOP/hw/ip/aon_timer/data/aon_timer_testplan.hjson" "$WS/spec/"
136
+
137
+ echo " Copied spec docs"
138
+
139
+ # ── Boilerplate RTL (provided complete — do not stub) ─────────────────
140
+ echo "[5/6] Copying boilerplate RTL..."
141
+
142
+ cp "$REPO_TOP/hw/ip/aon_timer/rtl/aon_timer_reg_top.sv" "$WS/rtl/"
143
+
144
+ echo " Copied aon_timer_reg_top.sv"
145
+
146
+ # ── Run directory (filelist + Makefile) ───────────────────────────────
147
+ echo "[6/6] Creating run directory..."
148
+
149
+ cat > "$WS/run/filelist.f" << 'FILELIST'
150
+ // Packages (order matters — dependencies first)
151
+ +incdir+../prim
152
+ ../prim/prim_assert.sv
153
+ ../prim/prim_util_pkg.sv
154
+ ../prim/prim_mubi_pkg.sv
155
+ ../prim/prim_alert_pkg.sv
156
+ ../prim/prim_subreg_pkg.sv
157
+ ../prim/prim_secded_pkg.sv
158
+ ../pkg/top_pkg.sv
159
+ ../tlul/tlul_pkg.sv
160
+ ../pkg/lc_ctrl_state_pkg.sv
161
+ ../pkg/lc_ctrl_reg_pkg.sv
162
+ ../pkg/lc_ctrl_pkg.sv
163
+ ../pkg/top_racl_pkg.sv
164
+ ../pkg/aon_timer_reg_pkg.sv
165
+
166
+ // SECDED encoder/decoder modules (used by TLUL integrity)
167
+ ../prim/prim_secded_inv_64_57_enc.sv
168
+ ../prim/prim_secded_inv_64_57_dec.sv
169
+ ../prim/prim_secded_inv_39_32_enc.sv
170
+ ../prim/prim_secded_inv_39_32_dec.sv
171
+
172
+ // TLUL modules
173
+ ../tlul/tlul_err.sv
174
+ ../tlul/tlul_cmd_intg_chk.sv
175
+ ../tlul/tlul_rsp_intg_gen.sv
176
+ ../tlul/tlul_data_integ_dec.sv
177
+ ../tlul/tlul_data_integ_enc.sv
178
+ ../tlul/tlul_adapter_reg.sv
179
+
180
+ // Prim modules (leaf first)
181
+ ../prim/prim_buf.sv
182
+ ../prim/prim_xnor2.sv
183
+ ../prim/prim_flop.sv
184
+ ../prim/prim_cdc_rand_delay.sv
185
+ ../prim/prim_flop_2sync.sv
186
+ ../prim/prim_onehot_enc.sv
187
+ ../prim/prim_onehot_check.sv
188
+ ../prim/prim_subreg_arb.sv
189
+ ../prim/prim_subreg.sv
190
+ ../prim/prim_subreg_ext.sv
191
+ ../prim/prim_reg_we_check.sv
192
+ ../prim/prim_sec_anchor_buf.sv
193
+ ../prim/prim_sec_anchor_flop.sv
194
+ ../prim/prim_alert_sender.sv
195
+ ../prim/prim_intr_hw.sv
196
+ ../prim/prim_lc_sync.sv
197
+ ../prim/prim_edge_detector.sv
198
+ ../prim/prim_reg_cdc_arb.sv
199
+ ../prim/prim_reg_cdc.sv
200
+
201
+ // AON_TIMER boilerplate (provided — do not modify)
202
+ ../rtl/aon_timer_reg_top.sv
203
+
204
+ // AON_TIMER core (agent-written — implement this)
205
+ ../rtl/aon_timer_core.sv
206
+
207
+ // AON_TIMER top (agent-written — implement this)
208
+ ../rtl/aon_timer.sv
209
+ FILELIST
210
+
211
+ cat > "$WS/run/Makefile" << 'MAKEFILE'
212
+ .PHONY: compile clean
213
+
214
+ compile:
215
+ @mkdir -p compile_log
216
+ xrun -c -64 -sv -access +rwc -elaborate \
217
+ -f filelist.f \
218
+ -timescale 1ns/1ps \
219
+ -l compile_log/compile.log 2>&1 || true
220
+ @echo "Check compile_log/compile.log"
221
+
222
+ clean:
223
+ rm -rf xcelium.d compile_log
224
+ MAKEFILE
225
+
226
+ echo " Created filelist.f and Makefile"
227
+
228
+ # ── Verify ────────────────────────────────────────────────────────────
229
+ echo ""
230
+ echo "[verify] Workspace contents:"
231
+ for d in prim tlul pkg spec rtl run; do
232
+ count=$(find "$WS/$d" -type f 2>/dev/null | wc -l)
233
+ echo " $d/: $count files"
234
+ done
235
+
236
+ echo ""
237
+ echo "=== Workspace populated. aon_timer_core.sv and aon_timer.sv stubs added by environment Dockerfile. ==="
images/rtl/csrng/Dockerfile ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TitanBench CSRNG-RTL — extends titanbench-base with OpenTitan infrastructure.
2
+ #
3
+ # Uses two build contexts:
4
+ # - default context (.) = OpenTitan repo root
5
+ # - titanbench = titanbench repo root
6
+ #
7
+ # Usage:
8
+ # docker build -f images/rtl/csrng/image/Dockerfile \
9
+ # --build-context titanbench=/path/to/titanbench \
10
+ # -t titanbench-csrng-rtl /path/to/opentitan
11
+
12
+ FROM titanbench-base:latest
13
+
14
+ # Copy the OpenTitan repo
15
+ COPY --chown=dev:dev . /home/dev/src/
16
+
17
+ # Copy the setup script from the titanbench repo
18
+ COPY --from=titanbench images/rtl/csrng/scripts/setup_workspace.sh /home/dev/scripts/setup_workspace.sh
19
+ RUN chmod +x /home/dev/scripts/setup_workspace.sh \
20
+ && bash /home/dev/scripts/setup_workspace.sh
21
+
22
+ # Git setup — dvsim requires a git repo with at least one commit
23
+ RUN git config --global --add safe.directory /home/dev/src \
24
+ && git config --global user.email "titanbench@opentitan.org" \
25
+ && git config --global user.name "TitanBench" \
26
+ && cd /home/dev/src \
27
+ && git init \
28
+ && git add -A \
29
+ && git commit -m "titanbench csrng-rtl base"
30
+
31
+ WORKDIR /home/dev/workspace/code
32
+ ENTRYPOINT []
33
+ CMD ["sh", "-c", "sleep infinity"]
images/rtl/csrng/scripts/setup_workspace.sh ADDED
@@ -0,0 +1,372 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Copyright lowRISC contributors (OpenTitan project).
3
+ # Licensed under the Apache License, Version 2.0, see LICENSE for details.
4
+ # SPDX-License-Identifier: Apache-2.0
5
+ #
6
+ # Populates the CSRNG-RTL workspace with infrastructure files from OpenTitan.
7
+ # Copies prim, tlul, aes, pkg, and spec docs — but NOT ground-truth CSRNG RTL.
8
+ #
9
+ # Run at image build time. Build context = OpenTitan repo root.
10
+
11
+ set -euo pipefail
12
+
13
+ REPO_TOP="/home/dev/src"
14
+ WS="/home/dev/workspace/code"
15
+
16
+ echo "=== TitanBench: Populating CSRNG-RTL workspace from OpenTitan ==="
17
+
18
+ # ── Create workspace directories ─────────────────────────────────────
19
+ mkdir -p "$WS"/{prim,tlul,aes,pkg,spec}
20
+
21
+ # ── Prim modules (from hw/ip/prim/rtl/) ─────────────────────────────
22
+ echo "[1/6] Copying prim modules..."
23
+ PRIM_SRC="$REPO_TOP/hw/ip/prim/rtl"
24
+ PRIM_GEN_SRC="$REPO_TOP/hw/ip/prim_generic/rtl"
25
+
26
+ PRIM_FILES=(
27
+ # Packages
28
+ prim_alert_pkg.sv
29
+ prim_cipher_pkg.sv
30
+ prim_count_pkg.sv
31
+ prim_mubi_pkg.sv
32
+ prim_secded_pkg.sv
33
+ prim_subreg_pkg.sv
34
+ prim_trivium_pkg.sv
35
+ prim_util_pkg.sv
36
+ # Assertion headers
37
+ prim_assert.sv
38
+ prim_assert_sec_cm.svh
39
+ prim_assert_standard_macros.svh
40
+ # FIFO / memory
41
+ prim_fifo_assert.svh
42
+ prim_fifo_sync.sv
43
+ prim_fifo_sync_cnt.sv
44
+ prim_packer_fifo.sv
45
+ prim_ram_1p_adv.sv
46
+ # Flops
47
+ prim_flop_macros.sv
48
+ prim_cdc_rand_delay.sv
49
+ prim_sparse_fsm_flop.sv
50
+ # Combinational
51
+ prim_onehot_enc.sv
52
+ prim_onehot_check.sv
53
+ prim_onehot_mux.sv
54
+ prim_count.sv
55
+ prim_diff_decode.sv
56
+ prim_blanker.sv
57
+ prim_edge_detector.sv
58
+ # Subreg
59
+ prim_subreg.sv
60
+ prim_subreg_arb.sv
61
+ prim_subreg_ext.sv
62
+ prim_subreg_shadow.sv
63
+ prim_reg_we_check.sv
64
+ # Security
65
+ prim_sec_anchor_buf.sv
66
+ prim_sec_anchor_const.sv
67
+ prim_sec_anchor_flop.sv
68
+ prim_alert_sender.sv
69
+ prim_intr_hw.sv
70
+ # Synchronization
71
+ prim_lc_dec.sv
72
+ prim_lc_sync.sv
73
+ prim_sync_reqack.sv
74
+ prim_sync_reqack_data.sv
75
+ prim_mubi4_dec.sv
76
+ prim_mubi4_sender.sv
77
+ prim_mubi4_sync.sv
78
+ prim_mubi8_dec.sv
79
+ prim_mubi8_sender.sv
80
+ prim_mubi8_sync.sv
81
+ # Crypto / LFSR
82
+ prim_dom_and_2share.sv
83
+ prim_double_lfsr.sv
84
+ prim_edn_req.sv
85
+ prim_gf_mult.sv
86
+ prim_lfsr.sv
87
+ prim_subst_perm.sv
88
+ prim_trivium.sv
89
+ # Arbitration
90
+ prim_arbiter_fixed.sv
91
+ prim_arbiter_ppc.sv
92
+ prim_arbiter_tree.sv
93
+ # SECDED (integrity)
94
+ prim_secded_inv_22_16_dec.sv
95
+ prim_secded_inv_22_16_enc.sv
96
+ prim_secded_inv_28_22_dec.sv
97
+ prim_secded_inv_28_22_enc.sv
98
+ prim_secded_inv_39_32_dec.sv
99
+ prim_secded_inv_39_32_enc.sv
100
+ prim_secded_inv_64_57_dec.sv
101
+ prim_secded_inv_64_57_enc.sv
102
+ prim_secded_inv_72_64_dec.sv
103
+ prim_secded_inv_72_64_enc.sv
104
+ prim_secded_inv_hamming_22_16_dec.sv
105
+ prim_secded_inv_hamming_22_16_enc.sv
106
+ prim_secded_inv_hamming_39_32_dec.sv
107
+ prim_secded_inv_hamming_39_32_enc.sv
108
+ prim_secded_inv_hamming_72_64_dec.sv
109
+ prim_secded_inv_hamming_72_64_enc.sv
110
+ prim_secded_inv_hamming_76_68_dec.sv
111
+ prim_secded_inv_hamming_76_68_enc.sv
112
+ # Misc headers
113
+ prim_util_memload.svh
114
+ )
115
+
116
+ PRIM_GENERIC_FILES=(
117
+ prim_and2.sv
118
+ prim_buf.sv
119
+ prim_flop.sv
120
+ prim_flop_2sync.sv
121
+ prim_flop_en.sv
122
+ prim_ram_1p.sv
123
+ prim_ram_1p_pkg.sv
124
+ prim_xnor2.sv
125
+ prim_xor2.sv
126
+ )
127
+
128
+ for f in "${PRIM_FILES[@]}"; do
129
+ cp "$PRIM_SRC/$f" "$WS/prim/"
130
+ done
131
+ for f in "${PRIM_GENERIC_FILES[@]}"; do
132
+ cp "$PRIM_GEN_SRC/$f" "$WS/prim/"
133
+ done
134
+ echo " Copied $((${#PRIM_FILES[@]} + ${#PRIM_GENERIC_FILES[@]})) prim files"
135
+
136
+ # ── TLUL modules (from hw/ip/tlul/rtl/) ─────────────────────────────
137
+ echo "[2/6] Copying TLUL modules..."
138
+ TLUL_SRC="$REPO_TOP/hw/ip/tlul/rtl"
139
+
140
+ TLUL_FILES=(
141
+ tlul_pkg.sv
142
+ tlul_adapter_reg.sv
143
+ tlul_cmd_intg_chk.sv
144
+ tlul_data_integ_dec.sv
145
+ tlul_data_integ_enc.sv
146
+ tlul_err.sv
147
+ tlul_rsp_intg_gen.sv
148
+ )
149
+
150
+ for f in "${TLUL_FILES[@]}"; do
151
+ cp "$TLUL_SRC/$f" "$WS/tlul/"
152
+ done
153
+ echo " Copied ${#TLUL_FILES[@]} TLUL files"
154
+
155
+ # ── AES cipher core modules (used by csrng_block_encrypt) ───────────
156
+ echo "[3/6] Copying AES cipher core modules..."
157
+ AES_SRC="$REPO_TOP/hw/ip/aes/rtl"
158
+
159
+ AES_FILES=(
160
+ aes_cipher_core.sv
161
+ aes_cipher_control.sv
162
+ aes_cipher_control_fsm.sv
163
+ aes_cipher_control_fsm_p.sv
164
+ aes_cipher_control_fsm_n.sv
165
+ aes_sub_bytes.sv
166
+ aes_sbox.sv
167
+ aes_sbox_lut.sv
168
+ aes_shift_rows.sv
169
+ aes_mix_columns.sv
170
+ aes_mix_single_column.sv
171
+ aes_key_expand.sv
172
+ aes_reduced_round.sv
173
+ aes_sel_buf_chk.sv
174
+ )
175
+
176
+ for f in "${AES_FILES[@]}"; do
177
+ cp "$AES_SRC/$f" "$WS/aes/"
178
+ done
179
+ echo " Copied ${#AES_FILES[@]} AES files"
180
+
181
+ # ── Package files (from various IPs) ────────────────────────────────
182
+ echo "[4/6] Copying package files..."
183
+
184
+ # AES packages (needed by csrng_block_encrypt and AES cipher core)
185
+ cp "$REPO_TOP/hw/ip/aes/rtl/aes_pkg.sv" "$WS/pkg/"
186
+ cp "$REPO_TOP/hw/ip/aes/rtl/aes_sbox_canright_pkg.sv" "$WS/pkg/"
187
+
188
+ # CSRNG packages
189
+ cp "$REPO_TOP/hw/ip/csrng/rtl/csrng_pkg.sv" "$WS/pkg/"
190
+ cp "$REPO_TOP/hw/ip/csrng/rtl/csrng_reg_pkg.sv" "$WS/pkg/"
191
+
192
+ # Entropy/EDN packages (CSRNG interfaces)
193
+ cp "$REPO_TOP/hw/ip/edn/rtl/edn_pkg.sv" "$WS/pkg/"
194
+ cp "$REPO_TOP/hw/ip/entropy_src/rtl/entropy_src_pkg.sv" "$WS/pkg/"
195
+
196
+ # Shared packages
197
+ cp "$REPO_TOP/hw/ip/lc_ctrl/rtl/lc_ctrl_pkg.sv" "$WS/pkg/"
198
+ cp "$REPO_TOP/hw/ip/lc_ctrl/rtl/lc_ctrl_reg_pkg.sv" "$WS/pkg/"
199
+ cp "$REPO_TOP/hw/ip/lc_ctrl/rtl/lc_ctrl_state_pkg.sv" "$WS/pkg/"
200
+ cp "$REPO_TOP/hw/top_earlgrey/rtl/top_pkg.sv" "$WS/pkg/"
201
+ cp "$REPO_TOP/hw/top_earlgrey/rtl/autogen/top_racl_pkg.sv" "$WS/pkg/"
202
+
203
+ echo " Copied 11 package files"
204
+
205
+ # ── Spec documentation ───────────────────────────────────────────────
206
+ echo "[5/6] Copying spec documentation..."
207
+
208
+ cp "$REPO_TOP/hw/ip/csrng/doc/theory_of_operation.md" "$WS/spec/"
209
+ cp "$REPO_TOP/hw/ip/csrng/doc/registers.md" "$WS/spec/"
210
+ cp "$REPO_TOP/hw/ip/csrng/doc/interfaces.md" "$WS/spec/"
211
+ cp "$REPO_TOP/hw/ip/csrng/doc/programmers_guide.md" "$WS/spec/"
212
+
213
+ # Testplan, register spec, and security countermeasures
214
+ cp "$REPO_TOP/hw/ip/csrng/data/csrng_testplan.hjson" "$WS/spec/"
215
+ cp "$REPO_TOP/hw/ip/csrng/data/csrng.hjson" "$WS/spec/"
216
+ cp "$REPO_TOP/hw/ip/csrng/data/csrng_sec_cm_testplan.hjson" "$WS/spec/"
217
+
218
+ # SVG diagrams
219
+ for svg in "$REPO_TOP/hw/ip/csrng/doc/"*.svg; do
220
+ [ -f "$svg" ] && cp "$svg" "$WS/spec/"
221
+ done
222
+
223
+ echo " Copied spec docs and diagrams"
224
+
225
+ # ── Run directory (filelist + Makefile) ──────────────────────────────
226
+ echo "[6/6] Creating run directory..."
227
+ mkdir -p "$WS/run"
228
+
229
+ cat > "$WS/run/filelist.f" << 'FILELIST'
230
+ // Packages (order matters - dependencies first)
231
+ +incdir+../prim
232
+ ../prim/prim_assert.sv
233
+ ../prim/prim_util_pkg.sv
234
+ ../prim/prim_mubi_pkg.sv
235
+ ../prim/prim_alert_pkg.sv
236
+ ../prim/prim_subreg_pkg.sv
237
+ ../prim/prim_secded_pkg.sv
238
+ ../prim/prim_count_pkg.sv
239
+ ../prim/prim_ram_1p_pkg.sv
240
+ ../prim/prim_cipher_pkg.sv
241
+ ../prim/prim_trivium_pkg.sv
242
+ ../pkg/top_pkg.sv
243
+ ../tlul/tlul_pkg.sv
244
+ ../pkg/lc_ctrl_state_pkg.sv
245
+ ../pkg/lc_ctrl_reg_pkg.sv
246
+ ../pkg/lc_ctrl_pkg.sv
247
+ ../pkg/top_racl_pkg.sv
248
+ ../pkg/entropy_src_pkg.sv
249
+ ../pkg/edn_pkg.sv
250
+ ../pkg/aes_sbox_canright_pkg.sv
251
+ ../pkg/aes_pkg.sv
252
+ ../pkg/csrng_reg_pkg.sv
253
+ ../pkg/csrng_pkg.sv
254
+
255
+ // SECDED encoder/decoder modules (used by TLUL integrity)
256
+ ../prim/prim_secded_inv_64_57_enc.sv
257
+ ../prim/prim_secded_inv_64_57_dec.sv
258
+ ../prim/prim_secded_inv_39_32_enc.sv
259
+ ../prim/prim_secded_inv_39_32_dec.sv
260
+
261
+ // TLUL modules
262
+ ../tlul/tlul_err.sv
263
+ ../tlul/tlul_cmd_intg_chk.sv
264
+ ../tlul/tlul_rsp_intg_gen.sv
265
+ ../tlul/tlul_data_integ_dec.sv
266
+ ../tlul/tlul_data_integ_enc.sv
267
+ ../tlul/tlul_adapter_reg.sv
268
+
269
+ // Prim modules (leaf first)
270
+ ../prim/prim_buf.sv
271
+ ../prim/prim_and2.sv
272
+ ../prim/prim_xor2.sv
273
+ ../prim/prim_xnor2.sv
274
+ ../prim/prim_flop.sv
275
+ ../prim/prim_flop_en.sv
276
+ ../prim/prim_cdc_rand_delay.sv
277
+ ../prim/prim_flop_2sync.sv
278
+ ../prim/prim_onehot_enc.sv
279
+ ../prim/prim_onehot_check.sv
280
+ ../prim/prim_onehot_mux.sv
281
+ ../prim/prim_count.sv
282
+ ../prim/prim_edge_detector.sv
283
+ ../prim/prim_fifo_sync_cnt.sv
284
+ ../prim/prim_fifo_sync.sv
285
+ ../prim/prim_packer_fifo.sv
286
+ ../prim/prim_subreg_arb.sv
287
+ ../prim/prim_subreg.sv
288
+ ../prim/prim_subreg_ext.sv
289
+ ../prim/prim_subreg_shadow.sv
290
+ ../prim/prim_reg_we_check.sv
291
+ ../prim/prim_sec_anchor_buf.sv
292
+ ../prim/prim_sec_anchor_flop.sv
293
+ ../prim/prim_sec_anchor_const.sv
294
+ ../prim/prim_diff_decode.sv
295
+ ../prim/prim_alert_sender.sv
296
+ ../prim/prim_lc_sync.sv
297
+ ../prim/prim_sync_reqack.sv
298
+ ../prim/prim_sync_reqack_data.sv
299
+ ../prim/prim_mubi4_sync.sv
300
+ ../prim/prim_mubi8_sync.sv
301
+ ../prim/prim_sparse_fsm_flop.sv
302
+ ../prim/prim_blanker.sv
303
+ ../prim/prim_gf_mult.sv
304
+ ../prim/prim_intr_hw.sv
305
+ ../prim/prim_arbiter_ppc.sv
306
+ ../prim/prim_arbiter_tree.sv
307
+ ../prim/prim_arbiter_fixed.sv
308
+
309
+ // AES cipher core modules (read-only, used by csrng_block_encrypt)
310
+ ../aes/aes_sel_buf_chk.sv
311
+ ../aes/aes_sbox_lut.sv
312
+ ../aes/aes_sbox.sv
313
+ ../aes/aes_sub_bytes.sv
314
+ ../aes/aes_shift_rows.sv
315
+ ../aes/aes_mix_single_column.sv
316
+ ../aes/aes_mix_columns.sv
317
+ ../aes/aes_key_expand.sv
318
+ ../aes/aes_reduced_round.sv
319
+ ../aes/aes_cipher_control_fsm_p.sv
320
+ ../aes/aes_cipher_control_fsm_n.sv
321
+ ../aes/aes_cipher_control_fsm.sv
322
+ ../aes/aes_cipher_control.sv
323
+ ../aes/aes_cipher_core.sv
324
+
325
+ // CSRNG RTL (boilerplate)
326
+ ../rtl/csrng_reg_top.sv
327
+
328
+ // CSRNG RTL (agent-written)
329
+ ../rtl/csrng_state_db.sv
330
+ ../rtl/csrng_main_sm.sv
331
+ ../rtl/csrng_block_encrypt.sv
332
+ ../rtl/csrng_cmd_stage.sv
333
+ ../rtl/csrng_ctr_drbg.sv
334
+ ../rtl/csrng_core.sv
335
+ ../rtl/csrng.sv
336
+ FILELIST
337
+
338
+ cat > "$WS/run/Makefile" << 'MAKEFILE'
339
+ .PHONY: compile clean
340
+
341
+ compile:
342
+ @mkdir -p compile_log
343
+ @xrun -c -64 -sv -access +rwc -elaborate \
344
+ -f filelist.f \
345
+ -timescale 1ns/1ps \
346
+ -l compile_log/compile.log 2>&1; \
347
+ STATUS=$$?; \
348
+ if [ $$STATUS -eq 0 ]; then \
349
+ echo "COMPILE PASSED"; \
350
+ else \
351
+ echo "COMPILE FAILED (see compile_log/compile.log)"; \
352
+ grep 'xmvlog: \*E\|xmelab: \*E' compile_log/compile.log 2>/dev/null; \
353
+ exit 1; \
354
+ fi
355
+
356
+ clean:
357
+ rm -rf xcelium.d compile_log
358
+ MAKEFILE
359
+
360
+ echo " Created filelist.f and Makefile"
361
+
362
+ # ── Verification ─────────────────────────────────────────────────────
363
+ echo "[7/7] Verifying workspace..."
364
+
365
+ EXPECTED_DIRS=(prim tlul aes pkg spec run)
366
+ for d in "${EXPECTED_DIRS[@]}"; do
367
+ count=$(find "$WS/$d" -type f | wc -l)
368
+ echo " $d/: $count files"
369
+ done
370
+
371
+ echo ""
372
+ echo "=== Workspace populated. Agent stubs and run/ added by environment Dockerfile. ==="
images/rtl/dma/Dockerfile ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TitanBench DMA-RTL — extends titanbench-base with OpenTitan infrastructure.
2
+ #
3
+ # Uses two build contexts:
4
+ # - default context (.) = OpenTitan repo root
5
+ # - titanbench = titanbench repo root
6
+ #
7
+ # Usage:
8
+ # docker build -f images/rtl/dma/image/Dockerfile \
9
+ # --build-context titanbench=/path/to/titanbench \
10
+ # -t titanbench-dma-rtl /path/to/opentitan
11
+
12
+ FROM titanbench-base:latest
13
+
14
+ # Copy the OpenTitan repo
15
+ COPY --chown=dev:dev . /home/dev/src/
16
+
17
+ # Fix the RAL spec path in dma_sim_cfg.hjson: the upstream file references
18
+ # rvscs/rtl/ip/dma/data/dma.hjson which is a product-specific path not present
19
+ # in the open-source repo. Redirect it to the canonical hw/ip path.
20
+ RUN sed -i 's|rvscs/rtl/ip/dma/data/dma.hjson|hw/ip/dma/data/dma.hjson|g' \
21
+ /home/dev/src/hw/ip/dma/dv/dma_sim_cfg.hjson
22
+
23
+ # Remove dma_cov_bind from sim_tops — it probes the internal `reg2hw` signal
24
+ # which will differ in agent implementations and cause elaboration failure.
25
+ RUN sed -i 's|sim_tops: \["dma_cov_bind", "dma_bind"\]|sim_tops: ["dma_bind"]|g' \
26
+ /home/dev/src/hw/ip/dma/dv/dma_sim_cfg.hjson
27
+
28
+ # Disable the 'did-you-bind-your-alert?' self-check present in five prim
29
+ # modules (prim_onehot_check, prim_sparse_fsm_flop, prim_count, prim_double_lfsr,
30
+ # prim_fifo_sync). Each has an ASSERT_INIT_NET(AssertConnected_A, ...) that
31
+ # fires at t=1ps unless the user instantiates ASSERT_PRIM_*_ERROR_TRIGGER_ALERT
32
+ # at the top level. That is a testbench-bookkeeping requirement, not an RTL
33
+ # correctness property, so we comment out the assertion lines entirely.
34
+ RUN for f in prim_onehot_check.sv prim_sparse_fsm_flop.sv prim_count.sv \
35
+ prim_double_lfsr.sv prim_fifo_sync.sv; do \
36
+ sed -i '/ASSERT_INIT_NET(AssertConnected_A/d' \
37
+ /home/dev/src/hw/ip/prim/rtl/$f; \
38
+ done
39
+
40
+ # Copy the setup script from the titanbench repo
41
+ COPY --from=titanbench images/rtl/dma/scripts/setup_workspace.sh /home/dev/scripts/setup_workspace.sh
42
+ RUN chmod +x /home/dev/scripts/setup_workspace.sh \
43
+ && bash /home/dev/scripts/setup_workspace.sh
44
+
45
+ # Git setup — dvsim requires a git repo with at least one commit
46
+ RUN git config --global --add safe.directory /home/dev/src \
47
+ && git config --global user.email "titanbench@opentitan.org" \
48
+ && git config --global user.name "TitanBench" \
49
+ && cd /home/dev/src \
50
+ && git init \
51
+ && git add -A \
52
+ && git commit -m "titanbench dma-rtl base"
53
+
54
+ WORKDIR /home/dev/workspace/code
55
+ ENTRYPOINT []
56
+ CMD ["sh", "-c", "sleep infinity"]
images/rtl/dma/scripts/setup_workspace.sh ADDED
@@ -0,0 +1,311 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Copyright lowRISC contributors (OpenTitan project).
3
+ # Licensed under the Apache License, Version 2.0, see LICENSE for details.
4
+ # SPDX-License-Identifier: Apache-2.0
5
+ #
6
+ # Populates the DMA-RTL workspace with infrastructure files from OpenTitan.
7
+ # Copies prim, tlul, pkg, and spec docs — but NOT ground-truth RTL.
8
+ #
9
+ # Run at image build time. Build context = OpenTitan repo root.
10
+
11
+ set -euo pipefail
12
+
13
+ REPO_TOP="/home/dev/src"
14
+ WS="/home/dev/workspace/code"
15
+
16
+ echo "=== TitanBench: Populating DMA-RTL workspace from OpenTitan ==="
17
+
18
+ # ── Create workspace directories ─────────────────────────────────────
19
+ mkdir -p "$WS"/{prim,tlul,pkg,spec,run,rtl}
20
+
21
+ # ── Prim modules (from hw/ip/prim/rtl/) ─────────────────────────────
22
+ echo "[1/6] Copying prim modules..."
23
+ PRIM_SRC="$REPO_TOP/hw/ip/prim/rtl"
24
+ PRIM_GEN_SRC="$REPO_TOP/hw/ip/prim_generic/rtl"
25
+
26
+ PRIM_FILES=(
27
+ # Packages
28
+ prim_alert_pkg.sv
29
+ prim_cipher_pkg.sv
30
+ prim_count_pkg.sv
31
+ prim_mubi_pkg.sv
32
+ prim_secded_pkg.sv
33
+ prim_sha2_pkg.sv
34
+ prim_subreg_pkg.sv
35
+ prim_util_pkg.sv
36
+ # Assertion headers
37
+ prim_assert.sv
38
+ prim_assert_sec_cm.svh
39
+ prim_assert_standard_macros.svh
40
+ # Flops / macros
41
+ prim_flop_macros.sv
42
+ prim_cdc_rand_delay.sv
43
+ prim_sparse_fsm_flop.sv
44
+ # Combinational
45
+ prim_onehot_enc.sv
46
+ prim_onehot_check.sv
47
+ prim_onehot_mux.sv
48
+ prim_diff_decode.sv
49
+ prim_blanker.sv
50
+ # Subreg
51
+ prim_subreg.sv
52
+ prim_subreg_arb.sv
53
+ prim_subreg_ext.sv
54
+ prim_subreg_shadow.sv
55
+ prim_reg_we_check.sv
56
+ # Security / alerts / interrupts
57
+ prim_sec_anchor_buf.sv
58
+ prim_sec_anchor_flop.sv
59
+ prim_sec_anchor_const.sv
60
+ prim_alert_sender.sv
61
+ prim_intr_hw.sv
62
+ # Synchronization
63
+ prim_lc_sync.sv
64
+ prim_sync_reqack.sv
65
+ prim_sync_reqack_data.sv
66
+ prim_mubi4_dec.sv
67
+ prim_mubi4_sender.sv
68
+ prim_mubi4_sync.sv
69
+ # SHA-2 engine
70
+ prim_sha2_pad.sv
71
+ prim_sha2.sv
72
+ prim_sha2_32.sv
73
+ # SECDED (integrity — used by TLUL)
74
+ prim_secded_inv_22_16_dec.sv
75
+ prim_secded_inv_22_16_enc.sv
76
+ prim_secded_inv_28_22_dec.sv
77
+ prim_secded_inv_28_22_enc.sv
78
+ prim_secded_inv_39_32_dec.sv
79
+ prim_secded_inv_39_32_enc.sv
80
+ prim_secded_inv_64_57_dec.sv
81
+ prim_secded_inv_64_57_enc.sv
82
+ prim_secded_inv_72_64_dec.sv
83
+ prim_secded_inv_72_64_enc.sv
84
+ prim_secded_inv_hamming_22_16_dec.sv
85
+ prim_secded_inv_hamming_22_16_enc.sv
86
+ prim_secded_inv_hamming_39_32_dec.sv
87
+ prim_secded_inv_hamming_39_32_enc.sv
88
+ prim_secded_inv_hamming_72_64_dec.sv
89
+ prim_secded_inv_hamming_72_64_enc.sv
90
+ prim_secded_inv_hamming_76_68_dec.sv
91
+ prim_secded_inv_hamming_76_68_enc.sv
92
+ # Misc
93
+ prim_util_memload.svh
94
+ prim_count.sv
95
+ prim_lfsr.sv
96
+ prim_packer_fifo.sv
97
+ prim_fifo_sync.sv
98
+ prim_fifo_sync_cnt.sv
99
+ prim_fifo_assert.svh
100
+ )
101
+
102
+ # Files from hw/ip/prim_generic/rtl/ (technology-independent implementations)
103
+ PRIM_GENERIC_FILES=(
104
+ prim_buf.sv
105
+ prim_and2.sv
106
+ prim_const_sec.sv
107
+ prim_flop.sv
108
+ prim_flop_2sync.sv
109
+ prim_flop_en.sv
110
+ prim_clock_gating.sv
111
+ prim_xnor2.sv
112
+ prim_xor2.sv
113
+ )
114
+
115
+ for f in "${PRIM_FILES[@]}"; do
116
+ cp "$PRIM_SRC/$f" "$WS/prim/"
117
+ done
118
+ for f in "${PRIM_GENERIC_FILES[@]}"; do
119
+ cp "$PRIM_GEN_SRC/$f" "$WS/prim/"
120
+ done
121
+ echo " Copied $((${#PRIM_FILES[@]} + ${#PRIM_GENERIC_FILES[@]})) prim files"
122
+
123
+ # ── TLUL modules (from hw/ip/tlul/rtl/) ─────────────────────────────
124
+ echo "[2/6] Copying TLUL modules..."
125
+ TLUL_SRC="$REPO_TOP/hw/ip/tlul/rtl"
126
+
127
+ TLUL_FILES=(
128
+ tlul_pkg.sv
129
+ tlul_adapter_reg.sv
130
+ tlul_adapter_host.sv
131
+ tlul_cmd_intg_chk.sv
132
+ tlul_cmd_intg_gen.sv
133
+ tlul_data_integ_dec.sv
134
+ tlul_data_integ_enc.sv
135
+ tlul_err.sv
136
+ tlul_rsp_intg_chk.sv
137
+ tlul_rsp_intg_gen.sv
138
+ )
139
+
140
+ for f in "${TLUL_FILES[@]}"; do
141
+ cp "$TLUL_SRC/$f" "$WS/tlul/"
142
+ done
143
+ echo " Copied ${#TLUL_FILES[@]} TLUL files"
144
+
145
+ # ── Package files ─────────────────────────────────────────────────────
146
+ echo "[3/6] Copying package files..."
147
+
148
+ cp "$REPO_TOP/hw/ip/dma/rtl/dma_pkg.sv" "$WS/pkg/"
149
+ cp "$REPO_TOP/hw/ip/dma/rtl/dma_reg_pkg.sv" "$WS/pkg/"
150
+ cp "$REPO_TOP/hw/ip/lc_ctrl/rtl/lc_ctrl_pkg.sv" "$WS/pkg/"
151
+ cp "$REPO_TOP/hw/ip/lc_ctrl/rtl/lc_ctrl_reg_pkg.sv" "$WS/pkg/"
152
+ cp "$REPO_TOP/hw/ip/lc_ctrl/rtl/lc_ctrl_state_pkg.sv" "$WS/pkg/"
153
+ cp "$REPO_TOP/hw/top_earlgrey/rtl/top_pkg.sv" "$WS/pkg/"
154
+ cp "$REPO_TOP/hw/top_earlgrey/rtl/autogen/top_racl_pkg.sv" "$WS/pkg/"
155
+
156
+ echo " Copied 7 package files"
157
+
158
+ # ── Boilerplate RTL (fully implemented — provided to agent) ───────────
159
+ echo "[4/6] Copying boilerplate RTL..."
160
+
161
+ # dma_reg_top.sv is auto-generated; agent must not implement it
162
+ cp "$REPO_TOP/hw/ip/dma/rtl/dma_reg_top.sv" "$WS/rtl/"
163
+
164
+ echo " Copied dma_reg_top.sv"
165
+
166
+ # ── Spec documentation ─────────────────────────��──────────────────────
167
+ echo "[5/6] Copying spec documentation..."
168
+
169
+ cp "$REPO_TOP/hw/ip/dma/doc/theory_of_operation.md" "$WS/spec/"
170
+ cp "$REPO_TOP/hw/ip/dma/doc/registers.md" "$WS/spec/"
171
+ cp "$REPO_TOP/hw/ip/dma/doc/interfaces.md" "$WS/spec/"
172
+ cp "$REPO_TOP/hw/ip/dma/doc/programmers_guide.md" "$WS/spec/"
173
+ cp "$REPO_TOP/hw/ip/dma/data/dma_testplan.hjson" "$WS/spec/"
174
+ cp "$REPO_TOP/hw/ip/dma/data/dma.hjson" "$WS/spec/"
175
+ # SVG diagrams
176
+ for svg in "$REPO_TOP/hw/ip/dma/doc/"*.svg; do
177
+ [ -f "$svg" ] && cp "$svg" "$WS/spec/" || true
178
+ done
179
+
180
+ echo " Copied spec docs"
181
+
182
+ # ── Run directory (filelist + Makefile) ───────────────────────────────
183
+ echo "[6/6] Creating run directory..."
184
+ mkdir -p "$WS/run"
185
+
186
+ cat > "$WS/run/filelist.f" << 'FILELIST'
187
+ // Packages (order matters — dependencies first)
188
+ +incdir+../prim
189
+ ../prim/prim_assert.sv
190
+ ../prim/prim_util_pkg.sv
191
+ ../prim/prim_mubi_pkg.sv
192
+ ../prim/prim_alert_pkg.sv
193
+ ../prim/prim_subreg_pkg.sv
194
+ ../prim/prim_secded_pkg.sv
195
+ ../prim/prim_count_pkg.sv
196
+ ../prim/prim_cipher_pkg.sv
197
+ ../prim/prim_sha2_pkg.sv
198
+ ../pkg/top_pkg.sv
199
+ ../tlul/tlul_pkg.sv
200
+ ../pkg/lc_ctrl_state_pkg.sv
201
+ ../pkg/lc_ctrl_reg_pkg.sv
202
+ ../pkg/lc_ctrl_pkg.sv
203
+ ../pkg/top_racl_pkg.sv
204
+ ../pkg/dma_reg_pkg.sv
205
+ ../pkg/dma_pkg.sv
206
+
207
+ // SECDED encoder/decoder modules (used by TLUL integrity)
208
+ ../prim/prim_secded_inv_64_57_enc.sv
209
+ ../prim/prim_secded_inv_64_57_dec.sv
210
+ ../prim/prim_secded_inv_39_32_enc.sv
211
+ ../prim/prim_secded_inv_39_32_dec.sv
212
+ ../prim/prim_secded_inv_72_64_enc.sv
213
+ ../prim/prim_secded_inv_72_64_dec.sv
214
+
215
+ // TLUL modules
216
+ ../tlul/tlul_err.sv
217
+ ../tlul/tlul_cmd_intg_chk.sv
218
+ ../tlul/tlul_cmd_intg_gen.sv
219
+ ../tlul/tlul_rsp_intg_gen.sv
220
+ ../tlul/tlul_rsp_intg_chk.sv
221
+ ../tlul/tlul_data_integ_dec.sv
222
+ ../tlul/tlul_data_integ_enc.sv
223
+ ../tlul/tlul_adapter_reg.sv
224
+ ../tlul/tlul_adapter_host.sv
225
+
226
+ // Prim leaf modules (no cross-dependencies)
227
+ ../prim/prim_buf.sv
228
+ ../prim/prim_and2.sv
229
+ ../prim/prim_const_sec.sv
230
+ ../prim/prim_xor2.sv
231
+ ../prim/prim_xnor2.sv
232
+ ../prim/prim_flop.sv
233
+ ../prim/prim_flop_en.sv
234
+ ../prim/prim_clock_gating.sv
235
+ ../prim/prim_cdc_rand_delay.sv
236
+ ../prim/prim_flop_2sync.sv
237
+ ../prim/prim_onehot_enc.sv
238
+ ../prim/prim_onehot_check.sv
239
+ ../prim/prim_onehot_mux.sv
240
+ ../prim/prim_count.sv
241
+ ../prim/prim_diff_decode.sv
242
+ ../prim/prim_blanker.sv
243
+ ../prim/prim_sparse_fsm_flop.sv
244
+ ../prim/prim_subreg_arb.sv
245
+ ../prim/prim_subreg.sv
246
+ ../prim/prim_subreg_ext.sv
247
+ ../prim/prim_subreg_shadow.sv
248
+ ../prim/prim_reg_we_check.sv
249
+ ../prim/prim_sec_anchor_buf.sv
250
+ ../prim/prim_sec_anchor_flop.sv
251
+ ../prim/prim_sec_anchor_const.sv
252
+ ../prim/prim_alert_sender.sv
253
+ ../prim/prim_mubi4_dec.sv
254
+ ../prim/prim_mubi4_sender.sv
255
+ ../prim/prim_mubi4_sync.sv
256
+ ../prim/prim_lc_sync.sv
257
+ ../prim/prim_sync_reqack.sv
258
+ ../prim/prim_sync_reqack_data.sv
259
+ ../prim/prim_intr_hw.sv
260
+ ../prim/prim_lfsr.sv
261
+ ../prim/prim_packer_fifo.sv
262
+ ../prim/prim_fifo_sync.sv
263
+ ../prim/prim_fifo_sync_cnt.sv
264
+
265
+ // SHA-2 engine
266
+ ../prim/prim_sha2_pad.sv
267
+ ../prim/prim_sha2.sv
268
+ ../prim/prim_sha2_32.sv
269
+
270
+ // DMA boilerplate (provided, fully implemented)
271
+ ../rtl/dma_reg_top.sv
272
+
273
+ // DMA RTL (agent-written)
274
+ ../rtl/dma.sv
275
+ FILELIST
276
+
277
+ cat > "$WS/run/Makefile" << 'MAKEFILE'
278
+ .PHONY: compile clean
279
+
280
+ compile:
281
+ @mkdir -p compile_log
282
+ @xrun -c -64 -sv -access +rwc -elaborate \
283
+ -f filelist.f \
284
+ -timescale 1ns/1ps \
285
+ -l compile_log/compile.log 2>&1; \
286
+ STATUS=$$?; \
287
+ if [ $$STATUS -eq 0 ]; then \
288
+ echo "COMPILE PASSED"; \
289
+ else \
290
+ echo "COMPILE FAILED (see compile_log/compile.log)"; \
291
+ grep 'xmvlog: \*E\|xmelab: \*E' compile_log/compile.log 2>/dev/null; \
292
+ exit 1; \
293
+ fi
294
+
295
+ clean:
296
+ rm -rf xcelium.d compile_log
297
+ MAKEFILE
298
+
299
+ echo " Created filelist.f and Makefile"
300
+
301
+ # ── Verification ──────────────────────────────────────────────────────
302
+ echo "[done] Verifying workspace..."
303
+
304
+ EXPECTED_DIRS=(prim tlul pkg spec run rtl)
305
+ for d in "${EXPECTED_DIRS[@]}"; do
306
+ count=$(find "$WS/$d" -type f | wc -l)
307
+ echo " $d/: $count files"
308
+ done
309
+
310
+ echo ""
311
+ echo "=== Workspace populated. Agent stub added by environment Dockerfile. ==="
images/rtl/gpio/Dockerfile ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TitanBench GPIO-RTL — extends titanbench-base with OpenTitan infrastructure.
2
+ #
3
+ # Uses two build contexts:
4
+ # - default context (.) = OpenTitan repo root
5
+ # - titanbench = titanbench repo root
6
+ #
7
+ # Usage:
8
+ # docker build -f images/rtl/gpio/image/Dockerfile \
9
+ # --build-context titanbench=/path/to/titanbench \
10
+ # -t titanbench-gpio-rtl /path/to/opentitan
11
+
12
+ FROM titanbench-base:latest
13
+
14
+ # Copy the OpenTitan repo
15
+ COPY --chown=dev:dev . /home/dev/src/
16
+
17
+ # Remove prim_filter_ctr: forces the agent to implement their own input-debounce
18
+ # filter rather than delegating to the OpenTitan primitive. The spec describes
19
+ # the filter behaviour without naming the module, so removing it does not
20
+ # invalidate any spec references. GPIO is the only consumer of prim_filter_ctr.
21
+ RUN rm -f /home/dev/src/hw/ip/prim/rtl/prim_filter_ctr.sv \
22
+ && sed -i '/rtl\/prim_filter_ctr\.sv/d' /home/dev/src/hw/ip/prim/prim.core
23
+
24
+ # Remove coverage exclusion file that probes internal signal names; these names
25
+ # will differ in agent implementations.
26
+ RUN rm -f /home/dev/src/hw/top_earlgrey/ip_autogen/gpio/dv/cov/gpio_cov_excl.el
27
+
28
+ # Disable the 'did-you-bind-your-alert?' self-check in prim_onehot_check.
29
+ # The assertion (AssertConnected_A at t=1ps) fires unless the user wraps
30
+ # every prim_onehot_check instance with ASSERT_PRIM_REG_WE_ONEHOT_ERROR_TRIGGER_ALERT.
31
+ # That is a testbench-bookkeeping requirement, not an RTL correctness property,
32
+ # so we flip the parameter default to 0 to let agents focus on functional logic.
33
+ RUN sed -i 's/parameter bit EnableAlertTriggerSVA = 1/parameter bit EnableAlertTriggerSVA = 0/' \
34
+ /home/dev/src/hw/ip/prim/rtl/prim_onehot_check.sv
35
+
36
+ # Copy the setup script from the titanbench repo
37
+ COPY --from=titanbench images/rtl/gpio/scripts/setup_workspace.sh /home/dev/scripts/setup_workspace.sh
38
+ RUN chmod +x /home/dev/scripts/setup_workspace.sh \
39
+ && bash /home/dev/scripts/setup_workspace.sh
40
+
41
+ # Git setup — dvsim requires a git repo with at least one commit
42
+ RUN git config --global --add safe.directory /home/dev/src \
43
+ && git config --global user.email "titanbench@opentitan.org" \
44
+ && git config --global user.name "TitanBench" \
45
+ && cd /home/dev/src \
46
+ && git init \
47
+ && git add -A \
48
+ && git commit -m "titanbench gpio-rtl base"
49
+
50
+ WORKDIR /home/dev/workspace/code
51
+ ENTRYPOINT []
52
+ CMD ["sh", "-c", "sleep infinity"]
images/rtl/gpio/scripts/setup_workspace.sh ADDED
@@ -0,0 +1,250 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Copyright lowRISC contributors (OpenTitan project).
3
+ # Licensed under the Apache License, Version 2.0, see LICENSE for details.
4
+ # SPDX-License-Identifier: Apache-2.0
5
+ #
6
+ # Populates the GPIO-RTL workspace with infrastructure files from OpenTitan.
7
+ # Copies prim, tlul, pkg, and spec docs — but NOT ground-truth RTL.
8
+ #
9
+ # Run at image build time. Build context = OpenTitan repo root.
10
+
11
+ set -euo pipefail
12
+
13
+ REPO_TOP="/home/dev/src"
14
+ WS="/home/dev/workspace/code"
15
+ GPIO_SRC="$REPO_TOP/hw/top_earlgrey/ip_autogen/gpio"
16
+
17
+ echo "=== TitanBench: Populating GPIO-RTL workspace from OpenTitan ==="
18
+
19
+ mkdir -p "$WS"/{prim,tlul,pkg,spec,run,rtl}
20
+
21
+ # ── Prim modules ─────────────────────────────────────────────────────
22
+ echo "[1/6] Copying prim modules..."
23
+ PRIM_SRC="$REPO_TOP/hw/ip/prim/rtl"
24
+ PRIM_GEN_SRC="$REPO_TOP/hw/ip/prim_generic/rtl"
25
+
26
+ PRIM_FILES=(
27
+ # Packages
28
+ prim_alert_pkg.sv
29
+ prim_count_pkg.sv
30
+ prim_mubi_pkg.sv
31
+ prim_secded_pkg.sv
32
+ prim_subreg_pkg.sv
33
+ prim_util_pkg.sv
34
+ # Assertion headers
35
+ prim_assert.sv
36
+ prim_assert_sec_cm.svh
37
+ prim_assert_standard_macros.svh
38
+ # Flops / macros
39
+ prim_flop_macros.sv
40
+ prim_cdc_rand_delay.sv
41
+ prim_sparse_fsm_flop.sv
42
+ # Combinational
43
+ prim_onehot_enc.sv
44
+ prim_onehot_check.sv
45
+ prim_onehot_mux.sv
46
+ prim_diff_decode.sv
47
+ # Subreg
48
+ prim_subreg.sv
49
+ prim_subreg_arb.sv
50
+ prim_subreg_ext.sv
51
+ prim_subreg_shadow.sv
52
+ prim_reg_we_check.sv
53
+ # Security / alerts / interrupts
54
+ prim_sec_anchor_buf.sv
55
+ prim_sec_anchor_flop.sv
56
+ prim_sec_anchor_const.sv
57
+ prim_alert_sender.sv
58
+ prim_intr_hw.sv
59
+ # Synchronization
60
+ prim_lc_sync.sv
61
+ prim_mubi4_dec.sv
62
+ prim_mubi4_sender.sv
63
+ prim_mubi4_sync.sv
64
+ # SECDED (used by TLUL integrity)
65
+ prim_secded_inv_39_32_dec.sv
66
+ prim_secded_inv_39_32_enc.sv
67
+ prim_secded_inv_64_57_dec.sv
68
+ prim_secded_inv_64_57_enc.sv
69
+ prim_secded_inv_72_64_dec.sv
70
+ prim_secded_inv_72_64_enc.sv
71
+ # Misc
72
+ prim_count.sv
73
+ )
74
+
75
+ PRIM_GENERIC_FILES=(
76
+ prim_buf.sv
77
+ prim_and2.sv
78
+ prim_flop.sv
79
+ prim_flop_2sync.sv
80
+ prim_flop_en.sv
81
+ prim_xnor2.sv
82
+ prim_xor2.sv
83
+ )
84
+
85
+ for f in "${PRIM_FILES[@]}"; do
86
+ cp "$PRIM_SRC/$f" "$WS/prim/"
87
+ done
88
+ for f in "${PRIM_GENERIC_FILES[@]}"; do
89
+ cp "$PRIM_GEN_SRC/$f" "$WS/prim/"
90
+ done
91
+ echo " Copied $((${#PRIM_FILES[@]} + ${#PRIM_GENERIC_FILES[@]})) prim files"
92
+
93
+ # ── TLUL modules ─────────────────────────────────────────────────────
94
+ echo "[2/6] Copying TLUL modules..."
95
+ TLUL_SRC="$REPO_TOP/hw/ip/tlul/rtl"
96
+
97
+ TLUL_FILES=(
98
+ tlul_pkg.sv
99
+ tlul_adapter_reg.sv
100
+ tlul_cmd_intg_chk.sv
101
+ tlul_data_integ_dec.sv
102
+ tlul_data_integ_enc.sv
103
+ tlul_err.sv
104
+ tlul_rsp_intg_gen.sv
105
+ )
106
+
107
+ for f in "${TLUL_FILES[@]}"; do
108
+ cp "$TLUL_SRC/$f" "$WS/tlul/"
109
+ done
110
+ echo " Copied ${#TLUL_FILES[@]} TLUL files"
111
+
112
+ # ── Package files ─────────────────────────────────────────────────────
113
+ echo "[3/6] Copying package files..."
114
+
115
+ cp "$GPIO_SRC/rtl/gpio_pkg.sv" "$WS/pkg/"
116
+ cp "$GPIO_SRC/rtl/gpio_reg_pkg.sv" "$WS/pkg/"
117
+ cp "$REPO_TOP/hw/top_earlgrey/rtl/top_pkg.sv" "$WS/pkg/"
118
+ cp "$REPO_TOP/hw/top_earlgrey/rtl/autogen/top_racl_pkg.sv" "$WS/pkg/"
119
+
120
+ echo " Copied 4 package files"
121
+
122
+ # ── Boilerplate RTL (fully implemented — provided to agent) ───────────
123
+ echo "[4/6] Copying boilerplate RTL..."
124
+
125
+ # gpio_reg_top.sv is auto-generated; agent must not implement it
126
+ cp "$GPIO_SRC/rtl/gpio_reg_top.sv" "$WS/rtl/"
127
+
128
+ echo " Copied gpio_reg_top.sv"
129
+
130
+ # ── Spec documentation ────────────────────────────────────────────────
131
+ echo "[5/6] Copying spec documentation..."
132
+
133
+ cp "$GPIO_SRC/doc/theory_of_operation.md" "$WS/spec/"
134
+ cp "$GPIO_SRC/doc/registers.md" "$WS/spec/"
135
+ cp "$GPIO_SRC/doc/interfaces.md" "$WS/spec/"
136
+ cp "$GPIO_SRC/doc/programmers_guide.md" "$WS/spec/"
137
+ # SVG diagrams
138
+ for svg in "$GPIO_SRC/doc/"*.svg; do
139
+ [ -f "$svg" ] && cp "$svg" "$WS/spec/" || true
140
+ done
141
+ # Testplan if present
142
+ [ -f "$GPIO_SRC/data/gpio_testplan.hjson" ] && cp "$GPIO_SRC/data/gpio_testplan.hjson" "$WS/spec/" || true
143
+
144
+ echo " Copied spec docs"
145
+
146
+ # ── Run directory (filelist + Makefile) ───────────────────────────────
147
+ echo "[6/6] Creating run directory..."
148
+
149
+ cat > "$WS/run/filelist.f" << 'FILELIST'
150
+ // Packages (order matters — dependencies first)
151
+ +incdir+../prim
152
+ ../prim/prim_assert.sv
153
+ ../prim/prim_util_pkg.sv
154
+ ../prim/prim_mubi_pkg.sv
155
+ ../prim/prim_alert_pkg.sv
156
+ ../prim/prim_subreg_pkg.sv
157
+ ../prim/prim_secded_pkg.sv
158
+ ../prim/prim_count_pkg.sv
159
+ ../pkg/top_pkg.sv
160
+ ../tlul/tlul_pkg.sv
161
+ ../pkg/top_racl_pkg.sv
162
+ ../pkg/gpio_reg_pkg.sv
163
+ ../pkg/gpio_pkg.sv
164
+
165
+ // SECDED encoder/decoder modules (used by TLUL integrity)
166
+ ../prim/prim_secded_inv_64_57_enc.sv
167
+ ../prim/prim_secded_inv_64_57_dec.sv
168
+ ../prim/prim_secded_inv_39_32_enc.sv
169
+ ../prim/prim_secded_inv_39_32_dec.sv
170
+ ../prim/prim_secded_inv_72_64_enc.sv
171
+ ../prim/prim_secded_inv_72_64_dec.sv
172
+
173
+ // TLUL modules
174
+ ../tlul/tlul_err.sv
175
+ ../tlul/tlul_cmd_intg_chk.sv
176
+ ../tlul/tlul_rsp_intg_gen.sv
177
+ ../tlul/tlul_data_integ_dec.sv
178
+ ../tlul/tlul_data_integ_enc.sv
179
+ ../tlul/tlul_adapter_reg.sv
180
+
181
+ // Prim leaf modules
182
+ ../prim/prim_buf.sv
183
+ ../prim/prim_and2.sv
184
+ ../prim/prim_xor2.sv
185
+ ../prim/prim_xnor2.sv
186
+ ../prim/prim_flop.sv
187
+ ../prim/prim_flop_en.sv
188
+ ../prim/prim_flop_2sync.sv
189
+ ../prim/prim_cdc_rand_delay.sv
190
+ ../prim/prim_onehot_enc.sv
191
+ ../prim/prim_onehot_check.sv
192
+ ../prim/prim_onehot_mux.sv
193
+ ../prim/prim_count.sv
194
+ ../prim/prim_diff_decode.sv
195
+ ../prim/prim_sparse_fsm_flop.sv
196
+ ../prim/prim_subreg_arb.sv
197
+ ../prim/prim_subreg.sv
198
+ ../prim/prim_subreg_ext.sv
199
+ ../prim/prim_subreg_shadow.sv
200
+ ../prim/prim_reg_we_check.sv
201
+ ../prim/prim_sec_anchor_buf.sv
202
+ ../prim/prim_sec_anchor_flop.sv
203
+ ../prim/prim_sec_anchor_const.sv
204
+ ../prim/prim_alert_sender.sv
205
+ ../prim/prim_mubi4_dec.sv
206
+ ../prim/prim_mubi4_sender.sv
207
+ ../prim/prim_mubi4_sync.sv
208
+ ../prim/prim_lc_sync.sv
209
+ ../prim/prim_intr_hw.sv
210
+
211
+ // GPIO boilerplate (provided, fully implemented)
212
+ ../rtl/gpio_reg_top.sv
213
+
214
+ // GPIO RTL (agent-written)
215
+ ../rtl/gpio.sv
216
+ FILELIST
217
+
218
+ cat > "$WS/run/Makefile" << 'MAKEFILE'
219
+ .PHONY: compile clean
220
+
221
+ compile:
222
+ @mkdir -p compile_log
223
+ @xrun -c -64 -sv -access +rwc -elaborate \
224
+ -f filelist.f \
225
+ -timescale 1ns/1ps \
226
+ -l compile_log/compile.log 2>&1; \
227
+ STATUS=$$?; \
228
+ if [ $$STATUS -eq 0 ]; then \
229
+ echo "COMPILE PASSED"; \
230
+ else \
231
+ echo "COMPILE FAILED (see compile_log/compile.log)"; \
232
+ grep 'xmvlog: \*E\|xmelab: \*E' compile_log/compile.log 2>/dev/null; \
233
+ exit 1; \
234
+ fi
235
+
236
+ clean:
237
+ rm -rf xcelium.d compile_log
238
+ MAKEFILE
239
+
240
+ echo " Created filelist.f and Makefile"
241
+
242
+ # ── Verification ──────────────────────────────────────────────────────
243
+ echo "[done] Verifying workspace..."
244
+ for d in prim tlul pkg spec run rtl; do
245
+ count=$(find "$WS/$d" -type f | wc -l)
246
+ echo " $d/: $count files"
247
+ done
248
+
249
+ echo ""
250
+ echo "=== Workspace populated. Agent stub added by environment Dockerfile. ==="
images/rtl/hmac/Dockerfile ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TitanBench HMAC-RTL — extends titanbench-base with OpenTitan infrastructure.
2
+ #
3
+ # Uses two build contexts:
4
+ # - default context (.) = OpenTitan repo root
5
+ # - titanbench = titanbench repo root
6
+ #
7
+ # Usage:
8
+ # docker build -f images/rtl/hmac/image/Dockerfile \
9
+ # --build-context titanbench=/path/to/titanbench \
10
+ # -t titanbench-hmac-rtl /path/to/opentitan
11
+
12
+ FROM titanbench-base:latest
13
+
14
+ # Copy the OpenTitan repo
15
+ COPY --chown=dev:dev . /home/dev/src/
16
+
17
+ # Copy the setup script from the titanbench repo
18
+ COPY --from=titanbench images/rtl/hmac/scripts/setup_workspace.sh /home/dev/scripts/setup_workspace.sh
19
+ RUN chmod +x /home/dev/scripts/setup_workspace.sh \
20
+ && bash /home/dev/scripts/setup_workspace.sh
21
+
22
+ # Git setup — dvsim requires a git repo with at least one commit
23
+ RUN git config --global --add safe.directory /home/dev/src \
24
+ && git config --global user.email "titanbench@opentitan.org" \
25
+ && git config --global user.name "TitanBench" \
26
+ && cd /home/dev/src \
27
+ && git init \
28
+ && git add -A \
29
+ && git commit -m "titanbench hmac-rtl base"
30
+
31
+ WORKDIR /home/dev/workspace/code
32
+ ENTRYPOINT []
33
+ CMD ["sh", "-c", "sleep infinity"]
images/rtl/hmac/scripts/setup_workspace.sh ADDED
@@ -0,0 +1,260 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Copyright lowRISC contributors (OpenTitan project).
3
+ # Licensed under the Apache License, Version 2.0, see LICENSE for details.
4
+ # SPDX-License-Identifier: Apache-2.0
5
+ #
6
+ # Populates the HMAC-RTL workspace with infrastructure files from OpenTitan.
7
+ # Copies prim, tlul, pkg, and spec docs — but NOT ground-truth RTL.
8
+ #
9
+ # Run at image build time. Build context = OpenTitan repo root.
10
+
11
+ set -euo pipefail
12
+
13
+ REPO_TOP="/home/dev/src"
14
+ WS="/home/dev/workspace/code"
15
+
16
+ echo "=== TitanBench: Populating HMAC-RTL workspace from OpenTitan ==="
17
+
18
+ # ── Create workspace directories ─────────────────────────────────────
19
+ mkdir -p "$WS"/{prim,tlul,pkg,spec}
20
+
21
+ # ── Prim modules (from hw/ip/prim/rtl/) ─────────────────────────────
22
+ echo "[1/5] Copying prim modules..."
23
+ PRIM_SRC="$REPO_TOP/hw/ip/prim/rtl"
24
+ PRIM_GEN_SRC="$REPO_TOP/hw/ip/prim_generic/rtl"
25
+
26
+ PRIM_FILES=(
27
+ # Packages
28
+ prim_alert_pkg.sv
29
+ prim_count_pkg.sv
30
+ prim_mubi_pkg.sv
31
+ prim_secded_pkg.sv
32
+ prim_sha2_pkg.sv
33
+ prim_subreg_pkg.sv
34
+ prim_util_pkg.sv
35
+ # Assertion headers
36
+ prim_assert.sv
37
+ prim_assert_sec_cm.svh
38
+ prim_assert_standard_macros.svh
39
+ # FIFO
40
+ prim_fifo_assert.svh
41
+ prim_fifo_sync.sv
42
+ prim_fifo_sync_cnt.sv
43
+ # Flops
44
+ prim_flop_macros.sv
45
+ prim_cdc_rand_delay.sv
46
+ # Combinational / counters
47
+ prim_count.sv
48
+ prim_diff_decode.sv
49
+ prim_onehot_check.sv
50
+ prim_onehot_enc.sv
51
+ # Subreg
52
+ prim_reg_we_check.sv
53
+ prim_subreg.sv
54
+ prim_subreg_arb.sv
55
+ prim_subreg_ext.sv
56
+ # Packer
57
+ prim_packer.sv
58
+ # SHA-2
59
+ prim_sha2.sv
60
+ prim_sha2_32.sv
61
+ prim_sha2_pad.sv
62
+ # Interrupts / alerts
63
+ prim_alert_sender.sv
64
+ prim_intr_hw.sv
65
+ prim_sec_anchor_buf.sv
66
+ prim_sec_anchor_flop.sv
67
+ # SECDED (for TLUL integrity)
68
+ prim_secded_inv_22_16_dec.sv
69
+ prim_secded_inv_22_16_enc.sv
70
+ prim_secded_inv_28_22_dec.sv
71
+ prim_secded_inv_28_22_enc.sv
72
+ prim_secded_inv_39_32_dec.sv
73
+ prim_secded_inv_39_32_enc.sv
74
+ prim_secded_inv_64_57_dec.sv
75
+ prim_secded_inv_64_57_enc.sv
76
+ prim_secded_inv_72_64_dec.sv
77
+ prim_secded_inv_72_64_enc.sv
78
+ prim_secded_inv_hamming_22_16_dec.sv
79
+ prim_secded_inv_hamming_22_16_enc.sv
80
+ prim_secded_inv_hamming_39_32_dec.sv
81
+ prim_secded_inv_hamming_39_32_enc.sv
82
+ prim_secded_inv_hamming_72_64_dec.sv
83
+ prim_secded_inv_hamming_72_64_enc.sv
84
+ prim_secded_inv_hamming_76_68_dec.sv
85
+ prim_secded_inv_hamming_76_68_enc.sv
86
+ # Misc
87
+ prim_util_memload.svh
88
+ )
89
+
90
+ PRIM_GENERIC_FILES=(
91
+ prim_buf.sv
92
+ prim_flop.sv
93
+ prim_flop_2sync.sv
94
+ prim_xnor2.sv
95
+ )
96
+
97
+ for f in "${PRIM_FILES[@]}"; do
98
+ cp "$PRIM_SRC/$f" "$WS/prim/"
99
+ done
100
+ for f in "${PRIM_GENERIC_FILES[@]}"; do
101
+ cp "$PRIM_GEN_SRC/$f" "$WS/prim/"
102
+ done
103
+ echo " Copied $((${#PRIM_FILES[@]} + ${#PRIM_GENERIC_FILES[@]})) prim files"
104
+
105
+ # ── TLUL modules (from hw/ip/tlul/rtl/) ─────────────────────────────
106
+ echo "[2/5] Copying TLUL modules..."
107
+ TLUL_SRC="$REPO_TOP/hw/ip/tlul/rtl"
108
+
109
+ TLUL_FILES=(
110
+ tlul_pkg.sv
111
+ tlul_adapter_reg.sv
112
+ tlul_adapter_sram.sv
113
+ tlul_cmd_intg_chk.sv
114
+ tlul_data_integ_dec.sv
115
+ tlul_data_integ_enc.sv
116
+ tlul_err.sv
117
+ tlul_err_resp.sv
118
+ tlul_fifo_sync.sv
119
+ tlul_rsp_intg_gen.sv
120
+ tlul_socket_1n.sv
121
+ tlul_sram_byte.sv
122
+ )
123
+
124
+ for f in "${TLUL_FILES[@]}"; do
125
+ cp "$TLUL_SRC/$f" "$WS/tlul/"
126
+ done
127
+ echo " Copied ${#TLUL_FILES[@]} TLUL files"
128
+
129
+ # ── Package files ────────────────────────────────────────────────────
130
+ echo "[3/5] Copying package files..."
131
+
132
+ cp "$REPO_TOP/hw/ip/hmac/rtl/hmac_reg_pkg.sv" "$WS/pkg/"
133
+ cp "$REPO_TOP/hw/top_earlgrey/rtl/top_pkg.sv" "$WS/pkg/"
134
+
135
+ echo " Copied 2 package files"
136
+
137
+ # ── Spec documentation ───────────────────────────────────────────────
138
+ echo "[4/5] Copying spec documentation..."
139
+
140
+ cp "$REPO_TOP/hw/ip/hmac/doc/theory_of_operation.md" "$WS/spec/"
141
+ cp "$REPO_TOP/hw/ip/hmac/doc/registers.md" "$WS/spec/"
142
+ cp "$REPO_TOP/hw/ip/hmac/doc/interfaces.md" "$WS/spec/"
143
+ cp "$REPO_TOP/hw/ip/hmac/doc/programmers_guide.md" "$WS/spec/"
144
+ cp "$REPO_TOP/hw/ip/hmac/data/hmac_testplan.hjson" "$WS/spec/"
145
+ cp "$REPO_TOP/hw/ip/hmac/data/hmac.hjson" "$WS/spec/"
146
+
147
+ # SVG diagrams (copy all that exist)
148
+ for svg in "$REPO_TOP/hw/ip/hmac/doc/"*.svg; do
149
+ [ -f "$svg" ] && cp "$svg" "$WS/spec/"
150
+ done
151
+
152
+ echo " Copied spec docs and diagrams"
153
+
154
+ # ── Run directory (filelist + Makefile) ──────────────────────────────
155
+ echo "[5/5] Creating run directory..."
156
+ mkdir -p "$WS/run"
157
+
158
+ cat > "$WS/run/filelist.f" << 'FILELIST'
159
+ // Packages (order matters - dependencies first)
160
+ +incdir+../prim
161
+ ../prim/prim_assert.sv
162
+ ../prim/prim_util_pkg.sv
163
+ ../prim/prim_mubi_pkg.sv
164
+ ../prim/prim_alert_pkg.sv
165
+ ../prim/prim_subreg_pkg.sv
166
+ ../prim/prim_secded_pkg.sv
167
+ ../prim/prim_count_pkg.sv
168
+ ../prim/prim_sha2_pkg.sv
169
+ ../pkg/top_pkg.sv
170
+ ../tlul/tlul_pkg.sv
171
+ ../pkg/hmac_reg_pkg.sv
172
+
173
+ // SECDED encoder/decoder modules (used by TLUL integrity)
174
+ ../prim/prim_secded_inv_64_57_enc.sv
175
+ ../prim/prim_secded_inv_64_57_dec.sv
176
+ ../prim/prim_secded_inv_39_32_enc.sv
177
+ ../prim/prim_secded_inv_39_32_dec.sv
178
+
179
+ // TLUL modules
180
+ ../tlul/tlul_err.sv
181
+ ../tlul/tlul_err_resp.sv
182
+ ../tlul/tlul_cmd_intg_chk.sv
183
+ ../tlul/tlul_rsp_intg_gen.sv
184
+ ../tlul/tlul_data_integ_dec.sv
185
+ ../tlul/tlul_data_integ_enc.sv
186
+ ../tlul/tlul_adapter_reg.sv
187
+ ../tlul/tlul_fifo_sync.sv
188
+ ../tlul/tlul_socket_1n.sv
189
+
190
+ // Prim modules (leaf first)
191
+ ../prim/prim_buf.sv
192
+ ../prim/prim_xnor2.sv
193
+ ../prim/prim_flop.sv
194
+ ../prim/prim_cdc_rand_delay.sv
195
+ ../prim/prim_flop_2sync.sv
196
+ ../prim/prim_onehot_enc.sv
197
+ ../prim/prim_onehot_check.sv
198
+ ../prim/prim_count.sv
199
+ ../prim/prim_fifo_sync_cnt.sv
200
+ ../prim/prim_fifo_sync.sv
201
+ ../prim/prim_subreg_arb.sv
202
+ ../prim/prim_subreg.sv
203
+ ../prim/prim_subreg_ext.sv
204
+ ../prim/prim_reg_we_check.sv
205
+ ../prim/prim_sec_anchor_buf.sv
206
+ ../prim/prim_sec_anchor_flop.sv
207
+ ../prim/prim_diff_decode.sv
208
+ ../prim/prim_alert_sender.sv
209
+ ../prim/prim_intr_hw.sv
210
+ ../prim/prim_packer.sv
211
+ ../prim/prim_sha2_pad.sv
212
+ ../prim/prim_sha2.sv
213
+ ../prim/prim_sha2_32.sv
214
+
215
+ // TLUL adapter SRAM (used by hmac top for MSG_FIFO window)
216
+ ../tlul/tlul_sram_byte.sv
217
+ ../tlul/tlul_adapter_sram.sv
218
+
219
+ // HMAC RTL (boilerplate - auto-generated register top)
220
+ ../rtl/hmac_reg_top.sv
221
+
222
+ // HMAC RTL (agent-written)
223
+ ../rtl/hmac_core.sv
224
+ ../rtl/hmac.sv
225
+ FILELIST
226
+
227
+ cat > "$WS/run/Makefile" << 'MAKEFILE'
228
+ .PHONY: compile clean
229
+
230
+ compile:
231
+ @mkdir -p compile_log
232
+ @xrun -c -64 -sv -access +rwc -elaborate \
233
+ -f filelist.f \
234
+ -timescale 1ns/1ps \
235
+ -l compile_log/compile.log 2>&1; \
236
+ STATUS=$$?; \
237
+ if [ $$STATUS -eq 0 ]; then \
238
+ echo "COMPILE PASSED"; \
239
+ else \
240
+ echo "COMPILE FAILED (see compile_log/compile.log)"; \
241
+ grep 'xmvlog: \*E\|xmelab: \*E' compile_log/compile.log 2>/dev/null; \
242
+ exit 1; \
243
+ fi
244
+
245
+ clean:
246
+ rm -rf xcelium.d compile_log
247
+ MAKEFILE
248
+
249
+ echo " Created filelist.f and Makefile"
250
+
251
+ # ── Verification ─────────────────────────────────────────────────────
252
+ echo ""
253
+ echo "[verify] Workspace contents:"
254
+ for d in prim tlul pkg spec run; do
255
+ count=$(find "$WS/$d" -type f 2>/dev/null | wc -l)
256
+ echo " $d/: $count files"
257
+ done
258
+
259
+ echo ""
260
+ echo "=== Workspace populated. Agent stubs and boilerplate RTL added by environment Dockerfile. ==="
images/rtl/i2c/Dockerfile ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TitanBench I2C-RTL — extends titanbench-base with OpenTitan infrastructure.
2
+ #
3
+ # Uses two build contexts:
4
+ # - default context (.) = OpenTitan repo root
5
+ # - titanbench = titanbench repo root
6
+ #
7
+ # Usage:
8
+ # docker build -f images/rtl/i2c/image/Dockerfile \
9
+ # --build-context titanbench=/path/to/titanbench \
10
+ # -t titanbench-i2c-rtl /path/to/opentitan
11
+
12
+ FROM titanbench-base:latest
13
+
14
+ # Copy the OpenTitan repo
15
+ COPY --chown=dev:dev . /home/dev/src/
16
+
17
+ # Copy the setup script from the titanbench repo
18
+ COPY --from=titanbench images/rtl/i2c/scripts/setup_workspace.sh /home/dev/scripts/setup_workspace.sh
19
+ RUN chmod +x /home/dev/scripts/setup_workspace.sh \
20
+ && bash /home/dev/scripts/setup_workspace.sh
21
+
22
+ # Git setup — dvsim requires a git repo with at least one commit
23
+ RUN git config --global --add safe.directory /home/dev/src \
24
+ && git config --global user.email "titanbench@opentitan.org" \
25
+ && git config --global user.name "TitanBench" \
26
+ && cd /home/dev/src \
27
+ && git init \
28
+ && git add -A \
29
+ && git commit -m "titanbench i2c-rtl base"
30
+
31
+ WORKDIR /home/dev/workspace/code
32
+ ENTRYPOINT []
33
+ CMD ["sh", "-c", "sleep infinity"]
images/rtl/i2c/scripts/setup_workspace.sh ADDED
@@ -0,0 +1,265 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Copyright lowRISC contributors (OpenTitan project).
3
+ # Licensed under the Apache License, Version 2.0, see LICENSE for details.
4
+ # SPDX-License-Identifier: Apache-2.0
5
+ #
6
+ # Populates the I2C-RTL workspace with infrastructure files from OpenTitan.
7
+ # Copies prim, tlul, pkg, and spec docs — but NOT ground-truth RTL.
8
+ #
9
+ # Run at image build time. Build context = OpenTitan repo root.
10
+
11
+ set -euo pipefail
12
+
13
+ REPO_TOP="/home/dev/src"
14
+ WS="/home/dev/workspace/code"
15
+
16
+ echo "=== TitanBench: Populating I2C-RTL workspace from OpenTitan ==="
17
+
18
+ # ── Create workspace directories ─────────────────────────────────────
19
+ mkdir -p "$WS"/{prim,tlul,pkg,spec}
20
+
21
+ # ── Prim modules (from hw/ip/prim/rtl/) ─────────────────────────────
22
+ echo "[1/5] Copying prim modules..."
23
+ PRIM_SRC="$REPO_TOP/hw/ip/prim/rtl"
24
+ PRIM_GEN_SRC="$REPO_TOP/hw/ip/prim_generic/rtl"
25
+
26
+ # Files from hw/ip/prim/rtl/
27
+ PRIM_FILES=(
28
+ # Packages
29
+ prim_alert_pkg.sv
30
+ prim_count_pkg.sv
31
+ prim_mubi_pkg.sv
32
+ prim_secded_pkg.sv
33
+ prim_subreg_pkg.sv
34
+ prim_util_pkg.sv
35
+ # Assertion headers
36
+ prim_assert.sv
37
+ prim_assert_sec_cm.svh
38
+ prim_assert_standard_macros.svh
39
+ # FIFO / memory
40
+ prim_fifo_assert.svh
41
+ prim_fifo_sync.sv
42
+ prim_fifo_sync_cnt.sv
43
+ prim_ram_1p_adv.sv
44
+ # Flops
45
+ prim_flop_macros.sv
46
+ prim_cdc_rand_delay.sv
47
+ # Combinational
48
+ prim_onehot_enc.sv
49
+ prim_onehot_check.sv
50
+ prim_count.sv
51
+ prim_diff_decode.sv
52
+ # Subreg
53
+ prim_subreg.sv
54
+ prim_subreg_arb.sv
55
+ prim_subreg_ext.sv
56
+ prim_reg_we_check.sv
57
+ # Security
58
+ prim_sec_anchor_buf.sv
59
+ prim_sec_anchor_flop.sv
60
+ prim_alert_sender.sv
61
+ prim_intr_hw.sv
62
+ # Arbitration
63
+ prim_arbiter_fixed.sv
64
+ prim_arbiter_tree.sv
65
+ # SECDED (integrity)
66
+ prim_secded_inv_22_16_dec.sv
67
+ prim_secded_inv_22_16_enc.sv
68
+ prim_secded_inv_28_22_dec.sv
69
+ prim_secded_inv_28_22_enc.sv
70
+ prim_secded_inv_39_32_dec.sv
71
+ prim_secded_inv_39_32_enc.sv
72
+ prim_secded_inv_64_57_dec.sv
73
+ prim_secded_inv_64_57_enc.sv
74
+ prim_secded_inv_72_64_dec.sv
75
+ prim_secded_inv_72_64_enc.sv
76
+ prim_secded_inv_hamming_22_16_dec.sv
77
+ prim_secded_inv_hamming_22_16_enc.sv
78
+ prim_secded_inv_hamming_39_32_dec.sv
79
+ prim_secded_inv_hamming_39_32_enc.sv
80
+ prim_secded_inv_hamming_72_64_dec.sv
81
+ prim_secded_inv_hamming_72_64_enc.sv
82
+ prim_secded_inv_hamming_76_68_dec.sv
83
+ prim_secded_inv_hamming_76_68_enc.sv
84
+ # Misc headers
85
+ prim_util_memload.svh
86
+ )
87
+
88
+ # Files from hw/ip/prim_generic/rtl/ (technology-independent implementations)
89
+ PRIM_GENERIC_FILES=(
90
+ prim_buf.sv
91
+ prim_flop.sv
92
+ prim_flop_2sync.sv
93
+ prim_ram_1p.sv
94
+ prim_ram_1p_pkg.sv
95
+ prim_xnor2.sv
96
+ )
97
+
98
+ for f in "${PRIM_FILES[@]}"; do
99
+ cp "$PRIM_SRC/$f" "$WS/prim/"
100
+ done
101
+ for f in "${PRIM_GENERIC_FILES[@]}"; do
102
+ cp "$PRIM_GEN_SRC/$f" "$WS/prim/"
103
+ done
104
+ echo " Copied $((${#PRIM_FILES[@]} + ${#PRIM_GENERIC_FILES[@]})) prim files"
105
+
106
+ # ── TLUL modules (from hw/ip/tlul/rtl/) ─────────────────────────────
107
+ echo "[2/5] Copying TLUL modules..."
108
+ TLUL_SRC="$REPO_TOP/hw/ip/tlul/rtl"
109
+
110
+ TLUL_FILES=(
111
+ tlul_pkg.sv
112
+ tlul_adapter_reg.sv
113
+ tlul_cmd_intg_chk.sv
114
+ tlul_data_integ_dec.sv
115
+ tlul_data_integ_enc.sv
116
+ tlul_err.sv
117
+ tlul_rsp_intg_gen.sv
118
+ )
119
+
120
+ for f in "${TLUL_FILES[@]}"; do
121
+ cp "$TLUL_SRC/$f" "$WS/tlul/"
122
+ done
123
+ echo " Copied ${#TLUL_FILES[@]} TLUL files"
124
+
125
+ # ── Package files (from various IPs) ────────────────────────────────
126
+ echo "[3/5] Copying package files..."
127
+
128
+ cp "$REPO_TOP/hw/ip/i2c/rtl/i2c_pkg.sv" "$WS/pkg/"
129
+ cp "$REPO_TOP/hw/ip/i2c/rtl/i2c_reg_pkg.sv" "$WS/pkg/"
130
+ cp "$REPO_TOP/hw/ip/lc_ctrl/rtl/lc_ctrl_pkg.sv" "$WS/pkg/"
131
+ cp "$REPO_TOP/hw/ip/lc_ctrl/rtl/lc_ctrl_reg_pkg.sv" "$WS/pkg/"
132
+ cp "$REPO_TOP/hw/ip/lc_ctrl/rtl/lc_ctrl_state_pkg.sv" "$WS/pkg/"
133
+ cp "$REPO_TOP/hw/top_earlgrey/rtl/top_pkg.sv" "$WS/pkg/"
134
+ cp "$REPO_TOP/hw/top_earlgrey/rtl/autogen/top_racl_pkg.sv" "$WS/pkg/"
135
+
136
+ echo " Copied 7 package files"
137
+
138
+ # ── Spec documentation (from hw/ip/i2c/doc/ and data/) ──────────────
139
+ echo "[4/5] Copying spec documentation..."
140
+
141
+ cp "$REPO_TOP/hw/ip/i2c/doc/theory_of_operation.md" "$WS/spec/"
142
+ cp "$REPO_TOP/hw/ip/i2c/doc/registers.md" "$WS/spec/"
143
+ cp "$REPO_TOP/hw/ip/i2c/doc/interfaces.md" "$WS/spec/"
144
+ cp "$REPO_TOP/hw/ip/i2c/data/i2c_testplan.hjson" "$WS/spec/"
145
+ cp "$REPO_TOP/hw/ip/i2c/data/i2c.hjson" "$WS/spec/"
146
+ cp "$REPO_TOP/hw/ip/i2c/data/i2c_sec_cm_testplan.hjson" "$WS/spec/" 2>/dev/null || true
147
+
148
+ # SVG diagrams (copy all that exist)
149
+ for svg in "$REPO_TOP/hw/ip/i2c/doc/"*.svg; do
150
+ [ -f "$svg" ] && cp "$svg" "$WS/spec/"
151
+ done
152
+
153
+ echo " Copied spec docs and diagrams"
154
+
155
+ # ── Run directory (filelist + Makefile) ──────────────────────────────
156
+ echo "[5/6] Creating run directory..."
157
+ mkdir -p "$WS/run"
158
+
159
+ cat > "$WS/run/filelist.f" << 'FILELIST'
160
+ // Packages (order matters - dependencies first)
161
+ +incdir+../prim
162
+ ../prim/prim_assert.sv
163
+ ../prim/prim_util_pkg.sv
164
+ ../prim/prim_mubi_pkg.sv
165
+ ../prim/prim_alert_pkg.sv
166
+ ../prim/prim_subreg_pkg.sv
167
+ ../prim/prim_secded_pkg.sv
168
+ ../prim/prim_count_pkg.sv
169
+ ../prim/prim_ram_1p_pkg.sv
170
+ ../pkg/top_pkg.sv
171
+ ../tlul/tlul_pkg.sv
172
+ ../pkg/lc_ctrl_state_pkg.sv
173
+ ../pkg/lc_ctrl_reg_pkg.sv
174
+ ../pkg/lc_ctrl_pkg.sv
175
+ ../pkg/top_racl_pkg.sv
176
+ ../pkg/i2c_pkg.sv
177
+ ../pkg/i2c_reg_pkg.sv
178
+
179
+ // SECDED encoder/decoder modules (used by TLUL integrity)
180
+ ../prim/prim_secded_inv_64_57_enc.sv
181
+ ../prim/prim_secded_inv_64_57_dec.sv
182
+ ../prim/prim_secded_inv_39_32_enc.sv
183
+ ../prim/prim_secded_inv_39_32_dec.sv
184
+
185
+ // TLUL modules
186
+ ../tlul/tlul_err.sv
187
+ ../tlul/tlul_cmd_intg_chk.sv
188
+ ../tlul/tlul_rsp_intg_gen.sv
189
+ ../tlul/tlul_data_integ_dec.sv
190
+ ../tlul/tlul_data_integ_enc.sv
191
+ ../tlul/tlul_adapter_reg.sv
192
+
193
+ // Prim modules (leaf first)
194
+ ../prim/prim_buf.sv
195
+ ../prim/prim_xnor2.sv
196
+ ../prim/prim_flop.sv
197
+ ../prim/prim_cdc_rand_delay.sv
198
+ ../prim/prim_flop_2sync.sv
199
+ ../prim/prim_onehot_enc.sv
200
+ ../prim/prim_onehot_check.sv
201
+ ../prim/prim_count.sv
202
+ ../prim/prim_fifo_sync_cnt.sv
203
+ ../prim/prim_fifo_sync.sv
204
+ ../prim/prim_subreg_arb.sv
205
+ ../prim/prim_subreg.sv
206
+ ../prim/prim_subreg_ext.sv
207
+ ../prim/prim_reg_we_check.sv
208
+ ../prim/prim_sec_anchor_buf.sv
209
+ ../prim/prim_sec_anchor_flop.sv
210
+ ../prim/prim_diff_decode.sv
211
+ ../prim/prim_alert_sender.sv
212
+ ../prim/prim_intr_hw.sv
213
+ ../prim/prim_ram_1p.sv
214
+ ../prim/prim_ram_1p_adv.sv
215
+ ../prim/prim_arbiter_tree.sv
216
+ ../prim/prim_arbiter_fixed.sv
217
+
218
+ // I2C RTL (boilerplate)
219
+ ../rtl/i2c_reg_top.sv
220
+
221
+ // I2C RTL (agent-written)
222
+ ../rtl/i2c_bus_monitor.sv
223
+ ../rtl/i2c_fifo_sync_sram_adapter.sv
224
+ ../rtl/i2c_fifos.sv
225
+ ../rtl/i2c_controller_fsm.sv
226
+ ../rtl/i2c_target_fsm.sv
227
+ ../rtl/i2c_core.sv
228
+ ../rtl/i2c.sv
229
+ FILELIST
230
+
231
+ cat > "$WS/run/Makefile" << 'MAKEFILE'
232
+ .PHONY: compile clean
233
+
234
+ compile:
235
+ @mkdir -p compile_log
236
+ @xrun -c -64 -sv -access +rwc -elaborate \
237
+ -f filelist.f \
238
+ -timescale 1ns/1ps \
239
+ -l compile_log/compile.log 2>&1; \
240
+ STATUS=$$?; \
241
+ if [ $$STATUS -eq 0 ]; then \
242
+ echo "COMPILE PASSED"; \
243
+ else \
244
+ echo "COMPILE FAILED (see compile_log/compile.log)"; \
245
+ grep 'xmvlog: \*E\|xmelab: \*E' compile_log/compile.log 2>/dev/null; \
246
+ exit 1; \
247
+ fi
248
+
249
+ clean:
250
+ rm -rf xcelium.d compile_log
251
+ MAKEFILE
252
+
253
+ echo " Created filelist.f and Makefile"
254
+
255
+ # ── Verification ─────────────────────────────────────────────────────
256
+ echo "[6/6] Verifying workspace..."
257
+
258
+ EXPECTED_DIRS=(prim tlul pkg spec run)
259
+ for d in "${EXPECTED_DIRS[@]}"; do
260
+ count=$(find "$WS/$d" -type f | wc -l)
261
+ echo " $d/: $count files"
262
+ done
263
+
264
+ echo ""
265
+ echo "=== Workspace populated. Agent stubs, PDFs, and run/ added by environment Dockerfile. ==="
images/rtl/keymgr-ctrl/Dockerfile ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TitanBench KEYMGR-CTRL-RTL — extends titanbench-base with OpenTitan infrastructure.
2
+ #
3
+ # Uses two build contexts:
4
+ # - default context (.) = OpenTitan repo root
5
+ # - titanbench = titanbench repo root
6
+ #
7
+ # Usage:
8
+ # docker build -f images/rtl/keymgr-ctrl/image/Dockerfile \
9
+ # --build-context titanbench=/path/to/titanbench \
10
+ # -t titanbench-keymgr-ctrl-rtl /path/to/opentitan
11
+
12
+ FROM titanbench-base:latest
13
+
14
+ # Copy the OpenTitan repo
15
+ COPY --chown=dev:dev . /home/dev/src/
16
+
17
+ # Copy the setup script from the titanbench repo
18
+ COPY --from=titanbench images/rtl/keymgr-ctrl/scripts/setup_workspace.sh /home/dev/scripts/setup_workspace.sh
19
+ RUN chmod +x /home/dev/scripts/setup_workspace.sh \
20
+ && bash /home/dev/scripts/setup_workspace.sh
21
+
22
+ # Git setup — dvsim requires a git repo with at least one commit
23
+ RUN git config --global --add safe.directory /home/dev/src \
24
+ && git config --global user.email "titanbench@opentitan.org" \
25
+ && git config --global user.name "TitanBench" \
26
+ && cd /home/dev/src \
27
+ && git init \
28
+ && git add -A \
29
+ && git commit -m "titanbench keymgr-ctrl-rtl base"
30
+
31
+ WORKDIR /home/dev/workspace/code
32
+ ENTRYPOINT []
33
+ CMD ["sh", "-c", "sleep infinity"]
images/rtl/keymgr-ctrl/scripts/setup_workspace.sh ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+
4
+ REPO_TOP="/home/dev/src"
5
+ WS="/home/dev/workspace/code"
6
+
7
+ echo "=== TitanBench: Populating KEYMGR-CTRL-RTL workspace from OpenTitan ==="
8
+
9
+ mkdir -p "$WS"/{prim,pkg,spec,run,rtl}
10
+
11
+ echo "[1/6] Copying prim modules..."
12
+ PRIM_SRC="$REPO_TOP/hw/ip/prim/rtl"
13
+ PRIM_GEN_SRC="$REPO_TOP/hw/ip/prim_generic/rtl"
14
+
15
+ for f in prim_assert.sv prim_util_pkg.sv prim_mubi_pkg.sv prim_secded_pkg.sv \
16
+ prim_count_pkg.sv \
17
+ prim_assert_sec_cm.svh prim_assert_standard_macros.svh \
18
+ prim_flop_macros.sv \
19
+ prim_cdc_rand_delay.sv prim_sec_anchor_buf.sv prim_sec_anchor_flop.sv \
20
+ prim_count.sv prim_mubi4_sender.sv \
21
+ prim_secded_inv_72_64_enc.sv prim_secded_inv_72_64_dec.sv; do
22
+ cp "$PRIM_SRC/$f" "$WS/prim/"
23
+ done
24
+
25
+ # prim_flop_2sync lives in prim_generic
26
+ cp "$PRIM_GEN_SRC/prim_flop_2sync.sv" "$WS/prim/"
27
+
28
+ # These may be in prim_generic or prim
29
+ for f in prim_buf.sv prim_flop.sv prim_xnor2.sv; do
30
+ cp "$PRIM_GEN_SRC/$f" "$WS/prim/"
31
+ done
32
+
33
+ echo "[2/6] Copying package files..."
34
+ cp "$REPO_TOP/hw/ip/otp_ctrl/rtl/otp_ctrl_pkg.sv" "$WS/pkg/"
35
+ cp "$REPO_TOP/hw/ip/keymgr/rtl/keymgr_reg_pkg.sv" "$WS/pkg/"
36
+ cp "$REPO_TOP/hw/ip/keymgr/rtl/keymgr_pkg.sv" "$WS/pkg/"
37
+
38
+ echo "[3/6] Copying boilerplate RTL modules..."
39
+ cp "$REPO_TOP/hw/ip/keymgr/rtl/keymgr_op_state_ctrl.sv" "$WS/rtl/"
40
+ cp "$REPO_TOP/hw/ip/keymgr/rtl/keymgr_data_en_state.sv" "$WS/rtl/"
41
+ cp "$REPO_TOP/hw/ip/keymgr/rtl/keymgr_err.sv" "$WS/rtl/"
42
+ cp "$REPO_TOP/hw/ip/keymgr/rtl/keymgr_reseed_ctrl.sv" "$WS/rtl/"
43
+
44
+ echo "[4/6] Copying spec documentation..."
45
+ for f in theory_of_operation.md registers.md interfaces.md; do
46
+ cp "$REPO_TOP/hw/ip/keymgr/doc/$f" "$WS/spec/" 2>/dev/null || true
47
+ done
48
+ cp "$REPO_TOP/hw/ip/keymgr/data/keymgr_testplan.hjson" "$WS/spec/" 2>/dev/null || true
49
+
50
+ echo "[5/6] Creating run directory..."
51
+ cat > "$WS/run/filelist.f" << 'FILELIST'
52
+ +incdir+../prim
53
+ ../prim/prim_assert.sv
54
+ ../prim/prim_util_pkg.sv
55
+ ../prim/prim_mubi_pkg.sv
56
+ ../prim/prim_secded_pkg.sv
57
+ ../prim/prim_count_pkg.sv
58
+ ../prim/prim_flop_macros.sv
59
+ ../prim/prim_buf.sv
60
+ ../prim/prim_xnor2.sv
61
+ ../prim/prim_flop.sv
62
+ ../prim/prim_flop_2sync.sv
63
+ ../prim/prim_cdc_rand_delay.sv
64
+ ../prim/prim_sec_anchor_buf.sv
65
+ ../prim/prim_sec_anchor_flop.sv
66
+ ../prim/prim_mubi4_sender.sv
67
+ ../prim/prim_count.sv
68
+ ../prim/prim_secded_inv_72_64_enc.sv
69
+ ../prim/prim_secded_inv_72_64_dec.sv
70
+ ../pkg/otp_ctrl_pkg.sv
71
+ ../pkg/keymgr_reg_pkg.sv
72
+ ../pkg/keymgr_pkg.sv
73
+ ../rtl/keymgr_err.sv
74
+ ../rtl/keymgr_data_en_state.sv
75
+ ../rtl/keymgr_op_state_ctrl.sv
76
+ ../rtl/keymgr_reseed_ctrl.sv
77
+ ../rtl/keymgr_ctrl.sv
78
+ FILELIST
79
+
80
+ cat > "$WS/run/Makefile" << 'MAKEFILE'
81
+ .PHONY: compile clean
82
+
83
+ compile:
84
+ @mkdir -p compile_log
85
+ xrun -c -64 -sv -access +rwc -elaborate \
86
+ -f filelist.f \
87
+ -timescale 1ns/1ps \
88
+ -l compile_log/compile.log 2>&1 || true
89
+ @echo "Check compile_log/compile.log"
90
+
91
+ clean:
92
+ rm -rf xcelium.d compile_log
93
+ MAKEFILE
94
+
95
+ echo "[6/6] Workspace populated."
images/rtl/keymgr-err/Dockerfile ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TitanBench KEYMGR-ERR-RTL — extends titanbench-base with OpenTitan infrastructure.
2
+ #
3
+ # Uses two build contexts:
4
+ # - default context (.) = OpenTitan repo root
5
+ # - titanbench = titanbench repo root
6
+ #
7
+ # Usage:
8
+ # docker build -f images/rtl/keymgr-err/image/Dockerfile \
9
+ # --build-context titanbench=/path/to/titanbench \
10
+ # -t titanbench-keymgr-err-rtl /path/to/opentitan
11
+
12
+ FROM titanbench-base:latest
13
+
14
+ # Copy the OpenTitan repo
15
+ COPY --chown=dev:dev . /home/dev/src/
16
+
17
+ # Copy the setup script from the titanbench repo
18
+ COPY --from=titanbench images/rtl/keymgr-err/scripts/setup_workspace.sh /home/dev/scripts/setup_workspace.sh
19
+ RUN chmod +x /home/dev/scripts/setup_workspace.sh \
20
+ && bash /home/dev/scripts/setup_workspace.sh
21
+
22
+ # Git setup — dvsim requires a git repo with at least one commit
23
+ RUN git config --global --add safe.directory /home/dev/src \
24
+ && git config --global user.email "titanbench@opentitan.org" \
25
+ && git config --global user.name "TitanBench" \
26
+ && cd /home/dev/src \
27
+ && git init \
28
+ && git add -A \
29
+ && git commit -m "titanbench keymgr-err-rtl base"
30
+
31
+ WORKDIR /home/dev/workspace/code
32
+ ENTRYPOINT []
33
+ CMD ["sh", "-c", "sleep infinity"]
images/rtl/keymgr-err/scripts/setup_workspace.sh ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+
4
+ REPO_TOP="/home/dev/src"
5
+ WS="/home/dev/workspace/code"
6
+
7
+ echo "=== TitanBench: Populating KEYMGR-ERR-RTL workspace from OpenTitan ==="
8
+
9
+ mkdir -p "$WS"/{prim,pkg,spec,run,rtl}
10
+
11
+ # Prim files (minimal set needed)
12
+ echo "[1/5] Copying prim modules..."
13
+ PRIM_SRC="$REPO_TOP/hw/ip/prim/rtl"
14
+ PRIM_GEN_SRC="$REPO_TOP/hw/ip/prim_generic/rtl"
15
+
16
+ for f in prim_assert.sv prim_util_pkg.sv prim_mubi_pkg.sv prim_secded_pkg.sv \
17
+ prim_assert_sec_cm.svh prim_assert_standard_macros.svh \
18
+ prim_flop_macros.sv; do
19
+ cp "$PRIM_SRC/$f" "$WS/prim/"
20
+ done
21
+ cp "$PRIM_GEN_SRC/prim_buf.sv" "$WS/prim/"
22
+
23
+ echo "[2/5] Copying package files..."
24
+ cp "$REPO_TOP/hw/ip/keymgr/rtl/keymgr_reg_pkg.sv" "$WS/pkg/"
25
+ cp "$REPO_TOP/hw/ip/keymgr/rtl/keymgr_pkg.sv" "$WS/pkg/"
26
+
27
+ echo "[3/5] Copying spec documentation..."
28
+ mkdir -p "$WS/spec"
29
+ for f in theory_of_operation.md registers.md interfaces.md; do
30
+ cp "$REPO_TOP/hw/ip/keymgr/doc/$f" "$WS/spec/" 2>/dev/null || true
31
+ done
32
+ cp "$REPO_TOP/hw/ip/keymgr/data/keymgr_testplan.hjson" "$WS/spec/" 2>/dev/null || true
33
+
34
+ echo "[4/5] Creating run directory..."
35
+ cat > "$WS/run/filelist.f" << 'FILELIST'
36
+ +incdir+../prim
37
+ ../prim/prim_assert.sv
38
+ ../prim/prim_util_pkg.sv
39
+ ../prim/prim_mubi_pkg.sv
40
+ ../prim/prim_secded_pkg.sv
41
+ ../prim/prim_flop_macros.sv
42
+ ../prim/prim_buf.sv
43
+ ../pkg/keymgr_reg_pkg.sv
44
+ ../pkg/keymgr_pkg.sv
45
+ ../rtl/keymgr_err.sv
46
+ FILELIST
47
+
48
+ cat > "$WS/run/Makefile" << 'MAKEFILE'
49
+ .PHONY: compile clean
50
+
51
+ compile:
52
+ @mkdir -p compile_log
53
+ xrun -c -64 -sv -access +rwc -elaborate \
54
+ -f filelist.f \
55
+ -timescale 1ns/1ps \
56
+ -l compile_log/compile.log 2>&1 || true
57
+ @echo "Check compile_log/compile.log"
58
+
59
+ clean:
60
+ rm -rf xcelium.d compile_log
61
+ MAKEFILE
62
+
63
+ echo "[5/5] Workspace populated."
images/rtl/keymgr-kmac-if/Dockerfile ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TitanBench KEYMGR-KMAC-IF-RTL — extends titanbench-base with OpenTitan infrastructure.
2
+ #
3
+ # Uses two build contexts:
4
+ # - default context (.) = OpenTitan repo root
5
+ # - titanbench = titanbench repo root
6
+ #
7
+ # Usage:
8
+ # docker build -f images/rtl/keymgr-kmac-if/image/Dockerfile \
9
+ # --build-context titanbench=/path/to/titanbench \
10
+ # -t titanbench-keymgr-kmac-if-rtl /path/to/opentitan
11
+
12
+ FROM titanbench-base:latest
13
+
14
+ # Copy the OpenTitan repo
15
+ COPY --chown=dev:dev . /home/dev/src/
16
+
17
+ # Copy the setup script from the titanbench repo
18
+ COPY --from=titanbench images/rtl/keymgr-kmac-if/scripts/setup_workspace.sh /home/dev/scripts/setup_workspace.sh
19
+ RUN chmod +x /home/dev/scripts/setup_workspace.sh \
20
+ && bash /home/dev/scripts/setup_workspace.sh
21
+
22
+ # Git setup — dvsim requires a git repo with at least one commit
23
+ RUN git config --global --add safe.directory /home/dev/src \
24
+ && git config --global user.email "titanbench@opentitan.org" \
25
+ && git config --global user.name "TitanBench" \
26
+ && cd /home/dev/src \
27
+ && git init \
28
+ && git add -A \
29
+ && git commit -m "titanbench keymgr-kmac-if-rtl base"
30
+
31
+ WORKDIR /home/dev/workspace/code
32
+ ENTRYPOINT []
33
+ CMD ["sh", "-c", "sleep infinity"]
images/rtl/keymgr-kmac-if/scripts/setup_workspace.sh ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+
4
+ REPO_TOP="/home/dev/src"
5
+ WS="/home/dev/workspace/code"
6
+
7
+ echo "=== TitanBench: Populating KEYMGR-KMAC-IF-RTL workspace from OpenTitan ==="
8
+
9
+ mkdir -p "$WS"/{prim,pkg,spec,run,rtl}
10
+
11
+ # Prim files
12
+ echo "[1/5] Copying prim modules..."
13
+ PRIM_SRC="$REPO_TOP/hw/ip/prim/rtl"
14
+ PRIM_GEN_SRC="$REPO_TOP/hw/ip/prim_generic/rtl"
15
+
16
+ for f in prim_assert.sv prim_util_pkg.sv prim_mubi_pkg.sv prim_secded_pkg.sv \
17
+ prim_count_pkg.sv \
18
+ prim_assert_sec_cm.svh prim_assert_standard_macros.svh \
19
+ prim_flop_macros.sv \
20
+ prim_cdc_rand_delay.sv prim_sec_anchor_buf.sv prim_sec_anchor_flop.sv \
21
+ prim_count.sv; do
22
+ cp "$PRIM_SRC/$f" "$WS/prim/"
23
+ done
24
+
25
+ for f in prim_flop.sv prim_buf.sv prim_xnor2.sv; do
26
+ cp "$PRIM_GEN_SRC/$f" "$WS/prim/"
27
+ done
28
+
29
+ echo "[2/5] Copying package files..."
30
+ cp "$REPO_TOP/hw/ip/kmac/rtl/sha3_pkg.sv" "$WS/pkg/"
31
+ cp "$REPO_TOP/hw/ip/kmac/rtl/kmac_pkg.sv" "$WS/pkg/"
32
+ cp "$REPO_TOP/hw/ip/keymgr/rtl/keymgr_reg_pkg.sv" "$WS/pkg/"
33
+ cp "$REPO_TOP/hw/ip/keymgr/rtl/keymgr_pkg.sv" "$WS/pkg/"
34
+
35
+ echo "[3/5] Copying spec documentation..."
36
+ mkdir -p "$WS/spec"
37
+ for f in theory_of_operation.md registers.md interfaces.md; do
38
+ cp "$REPO_TOP/hw/ip/keymgr/doc/$f" "$WS/spec/" 2>/dev/null || true
39
+ done
40
+ cp "$REPO_TOP/hw/ip/keymgr/data/keymgr_testplan.hjson" "$WS/spec/" 2>/dev/null || true
41
+
42
+ echo "[4/5] Creating run directory..."
43
+ cat > "$WS/run/filelist.f" << 'FILELIST'
44
+ +incdir+../prim
45
+ ../prim/prim_assert.sv
46
+ ../prim/prim_util_pkg.sv
47
+ ../prim/prim_mubi_pkg.sv
48
+ ../prim/prim_secded_pkg.sv
49
+ ../prim/prim_count_pkg.sv
50
+ ../prim/prim_flop_macros.sv
51
+ ../pkg/sha3_pkg.sv
52
+ ../pkg/kmac_pkg.sv
53
+ ../pkg/keymgr_pkg.sv
54
+ ../prim/prim_buf.sv
55
+ ../prim/prim_xnor2.sv
56
+ ../prim/prim_flop.sv
57
+ ../prim/prim_cdc_rand_delay.sv
58
+ ../prim/prim_sec_anchor_buf.sv
59
+ ../prim/prim_sec_anchor_flop.sv
60
+ ../prim/prim_count.sv
61
+ ../rtl/keymgr_kmac_if.sv
62
+ FILELIST
63
+
64
+ cat > "$WS/run/Makefile" << 'MAKEFILE'
65
+ .PHONY: compile clean
66
+
67
+ compile:
68
+ @mkdir -p compile_log
69
+ xrun -c -64 -sv -access +rwc -elaborate \
70
+ -f filelist.f \
71
+ -timescale 1ns/1ps \
72
+ -l compile_log/compile.log 2>&1 || true
73
+ @echo "Check compile_log/compile.log"
74
+
75
+ clean:
76
+ rm -rf xcelium.d compile_log
77
+ MAKEFILE
78
+
79
+ echo "[5/5] Workspace populated."
images/rtl/keymgr-sideload-key-ctrl/Dockerfile ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TitanBench KEYMGR-SIDELOAD-KEY-CTRL-RTL — extends titanbench-base with OpenTitan infrastructure.
2
+ #
3
+ # Uses two build contexts:
4
+ # - default context (.) = OpenTitan repo root
5
+ # - titanbench = titanbench repo root
6
+ #
7
+ # Usage:
8
+ # docker build -f images/rtl/keymgr-sideload-key-ctrl/image/Dockerfile \
9
+ # --build-context titanbench=/path/to/titanbench \
10
+ # -t titanbench-keymgr-sideload-key-ctrl-rtl /path/to/opentitan
11
+
12
+ FROM titanbench-base:latest
13
+
14
+ # Copy the OpenTitan repo
15
+ COPY --chown=dev:dev . /home/dev/src/
16
+
17
+ # Copy the setup script from the titanbench repo
18
+ COPY --from=titanbench images/rtl/keymgr-sideload-key-ctrl/scripts/setup_workspace.sh /home/dev/scripts/setup_workspace.sh
19
+ RUN chmod +x /home/dev/scripts/setup_workspace.sh \
20
+ && bash /home/dev/scripts/setup_workspace.sh
21
+
22
+ # Git setup — dvsim requires a git repo with at least one commit
23
+ RUN git config --global --add safe.directory /home/dev/src \
24
+ && git config --global user.email "titanbench@opentitan.org" \
25
+ && git config --global user.name "TitanBench" \
26
+ && cd /home/dev/src \
27
+ && git init \
28
+ && git add -A \
29
+ && git commit -m "titanbench keymgr-sideload-key-ctrl-rtl base"
30
+
31
+ WORKDIR /home/dev/workspace/code
32
+ ENTRYPOINT []
33
+ CMD ["sh", "-c", "sleep infinity"]
images/rtl/keymgr-sideload-key-ctrl/scripts/setup_workspace.sh ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+
4
+ REPO_TOP="/home/dev/src"
5
+ WS="/home/dev/workspace/code"
6
+
7
+ echo "=== TitanBench: Populating KEYMGR-SIDELOAD-KEY-CTRL-RTL workspace from OpenTitan ==="
8
+
9
+ mkdir -p "$WS"/{prim,pkg,spec,run,rtl}
10
+
11
+ echo "[1/5] Copying prim modules..."
12
+ PRIM_SRC="$REPO_TOP/hw/ip/prim/rtl"
13
+ PRIM_GEN_SRC="$REPO_TOP/hw/ip/prim_generic/rtl"
14
+
15
+ for f in prim_assert.sv prim_util_pkg.sv prim_mubi_pkg.sv prim_secded_pkg.sv \
16
+ prim_assert_sec_cm.svh prim_assert_standard_macros.svh \
17
+ prim_flop_macros.sv prim_mubi4_sync.sv; do
18
+ cp "$PRIM_SRC/$f" "$WS/prim/"
19
+ done
20
+ for f in prim_buf.sv prim_flop.sv prim_xnor2.sv prim_cdc_rand_delay.sv; do
21
+ cp "$PRIM_GEN_SRC/$f" "$WS/prim/" 2>/dev/null || cp "$PRIM_SRC/$f" "$WS/prim/" 2>/dev/null || true
22
+ done
23
+
24
+ echo "[2/5] Copying package files..."
25
+ cp "$REPO_TOP/hw/ip/keymgr/rtl/keymgr_pkg.sv" "$WS/pkg/"
26
+
27
+ echo "[3/5] Copying boilerplate RTL..."
28
+ cp "$REPO_TOP/hw/ip/keymgr/rtl/keymgr_sideload_key.sv" "$WS/rtl/"
29
+
30
+ echo "[4/5] Copying spec documentation..."
31
+ for f in theory_of_operation.md registers.md interfaces.md; do
32
+ cp "$REPO_TOP/hw/ip/keymgr/doc/$f" "$WS/spec/" 2>/dev/null || true
33
+ done
34
+ cp "$REPO_TOP/hw/ip/keymgr/data/keymgr_testplan.hjson" "$WS/spec/" 2>/dev/null || true
35
+
36
+ echo "[5/5] Creating run directory..."
37
+ cat > "$WS/run/filelist.f" << 'FILELIST'
38
+ +incdir+../prim
39
+ ../prim/prim_assert.sv
40
+ ../prim/prim_util_pkg.sv
41
+ ../prim/prim_mubi_pkg.sv
42
+ ../prim/prim_secded_pkg.sv
43
+ ../prim/prim_flop_macros.sv
44
+ ../prim/prim_buf.sv
45
+ ../prim/prim_xnor2.sv
46
+ ../prim/prim_flop.sv
47
+ ../prim/prim_mubi4_sync.sv
48
+ ../pkg/keymgr_pkg.sv
49
+ ../rtl/keymgr_sideload_key.sv
50
+ ../rtl/keymgr_sideload_key_ctrl.sv
51
+ FILELIST
52
+
53
+ cat > "$WS/run/Makefile" << 'MAKEFILE'
54
+ .PHONY: compile clean
55
+
56
+ compile:
57
+ @mkdir -p compile_log
58
+ xrun -c -64 -sv -access +rwc -elaborate \
59
+ -f filelist.f \
60
+ -timescale 1ns/1ps \
61
+ -l compile_log/compile.log 2>&1 || true
62
+ @echo "Check compile_log/compile.log"
63
+
64
+ clean:
65
+ rm -rf xcelium.d compile_log
66
+ MAKEFILE
67
+
68
+ echo "=== Workspace populated ==="
images/rtl/keymgr/Dockerfile ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TitanBench KEYMGR-RTL — extends titanbench-base with OpenTitan infrastructure.
2
+ #
3
+ # Uses two build contexts:
4
+ # - default context (.) = OpenTitan repo root
5
+ # - titanbench = titanbench repo root
6
+ #
7
+ # Usage:
8
+ # docker build -f images/rtl/keymgr/image/Dockerfile \
9
+ # --build-context titanbench=/path/to/titanbench \
10
+ # -t titanbench-keymgr-rtl /path/to/opentitan
11
+
12
+ FROM titanbench-base:latest
13
+
14
+ # Copy the OpenTitan repo
15
+ COPY --chown=dev:dev . /home/dev/src/
16
+
17
+ # Copy the setup script from the titanbench repo
18
+ COPY --from=titanbench tasks_missing_rtl/keymgr-rtl/scripts/setup_workspace.sh /home/dev/scripts/setup_workspace.sh
19
+ RUN chmod +x /home/dev/scripts/setup_workspace.sh \
20
+ && bash /home/dev/scripts/setup_workspace.sh
21
+
22
+ # Git setup — dvsim requires a git repo with at least one commit
23
+ RUN git config --global --add safe.directory /home/dev/src \
24
+ && git config --global user.email "titanbench@opentitan.org" \
25
+ && git config --global user.name "TitanBench" \
26
+ && cd /home/dev/src \
27
+ && git init \
28
+ && git add -A \
29
+ && git commit -m "titanbench keymgr-rtl base"
30
+
31
+ WORKDIR /home/dev/workspace/code
32
+ ENTRYPOINT []
33
+ CMD ["sh", "-c", "sleep infinity"]
images/rtl/keymgr/scripts/setup_workspace.sh ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ REPO_TOP="/home/dev/src"
4
+ WS="/home/dev/workspace/code"
5
+ KM_SRC="$REPO_TOP/hw/ip/keymgr"
6
+ mkdir -p "$WS"/{prim,tlul,pkg,spec,run,rtl}
7
+ PRIM_SRC="$REPO_TOP/hw/ip/prim/rtl"
8
+ PRIM_GEN_SRC="$REPO_TOP/hw/ip/prim_generic/rtl"
9
+ PRIM_FILES=(
10
+ prim_alert_pkg.sv prim_count_pkg.sv prim_mubi_pkg.sv prim_secded_pkg.sv prim_subreg_pkg.sv prim_util_pkg.sv
11
+ prim_assert.sv prim_assert_sec_cm.svh prim_assert_standard_macros.svh prim_flop_macros.sv prim_cdc_rand_delay.sv
12
+ prim_subreg.sv prim_subreg_ext.sv prim_subreg_shadow.sv prim_reg_we_check.sv prim_alert_sender.sv prim_intr_hw.sv
13
+ prim_lc_sync.sv prim_edn_req.sv prim_count.sv prim_lfsr.sv prim_sec_anchor_buf.sv prim_sec_anchor_const.sv
14
+ prim_mubi4_sender.sv prim_mubi4_sync.sv prim_secded_inv_72_64_dec.sv prim_secded_inv_72_64_enc.sv prim_util_memload.svh
15
+ )
16
+ PRIM_GENERIC_FILES=(prim_buf.sv prim_flop.sv prim_flop_2sync.sv prim_xnor2.sv prim_msb_extend.sv)
17
+ for f in "${PRIM_FILES[@]}"; do cp "$PRIM_SRC/$f" "$WS/prim/"; done
18
+ for f in "${PRIM_GENERIC_FILES[@]}"; do cp "$PRIM_GEN_SRC/$f" "$WS/prim/" 2>/dev/null || cp "$PRIM_SRC/$f" "$WS/prim/"; done
19
+ TLUL_SRC="$REPO_TOP/hw/ip/tlul/rtl"
20
+ for f in tlul_pkg.sv tlul_adapter_reg.sv tlul_cmd_intg_chk.sv tlul_data_integ_dec.sv tlul_data_integ_enc.sv tlul_err.sv tlul_rsp_intg_gen.sv; do cp "$TLUL_SRC/$f" "$WS/tlul/"; done
21
+ cp "$KM_SRC/rtl/keymgr_pkg.sv" "$WS/pkg/"
22
+ cp "$KM_SRC/rtl/keymgr_reg_pkg.sv" "$WS/pkg/"
23
+ cp "$REPO_TOP/hw/ip/kmac/rtl/kmac_pkg.sv" "$WS/pkg/"
24
+ cp "$REPO_TOP/hw/ip/otp_ctrl/rtl/otp_ctrl_pkg.sv" "$WS/pkg/"
25
+ cp "$REPO_TOP/hw/ip/flash_ctrl/rtl/flash_ctrl_pkg.sv" "$WS/pkg/"
26
+ cp "$REPO_TOP/hw/ip/rom_ctrl/rtl/rom_ctrl_pkg.sv" "$WS/pkg/"
27
+ cp "$REPO_TOP/hw/ip/edn/rtl/edn_pkg.sv" "$WS/pkg/"
28
+ cp "$REPO_TOP/hw/ip/lc_ctrl/rtl/lc_ctrl_pkg.sv" "$WS/pkg/"
29
+ cp "$REPO_TOP/hw/ip/lc_ctrl/rtl/lc_ctrl_reg_pkg.sv" "$WS/pkg/"
30
+ cp "$REPO_TOP/hw/ip/lc_ctrl/rtl/lc_ctrl_state_pkg.sv" "$WS/pkg/"
31
+ for f in theory_of_operation.md registers.md interfaces.md; do cp "$KM_SRC/doc/$f" "$WS/spec/" 2>/dev/null || true; done
32
+ cp "$KM_SRC/data/keymgr_testplan.hjson" "$WS/spec/" 2>/dev/null || true
33
+ cp "$KM_SRC/rtl/keymgr_reg_top.sv" "$WS/rtl/"
34
+ cp "$KM_SRC/rtl/keymgr_cfg_en.sv" "$WS/rtl/"
35
+ cp "$KM_SRC/rtl/keymgr_data_en_state.sv" "$WS/rtl/"
36
+ cp "$KM_SRC/rtl/keymgr_op_state_ctrl.sv" "$WS/rtl/"
37
+ cp "$KM_SRC/rtl/keymgr_reseed_ctrl.sv" "$WS/rtl/"
38
+ cp "$KM_SRC/rtl/keymgr_sideload_key.sv" "$WS/rtl/"
39
+ cat > "$WS/run/filelist.f" <<'FILELIST'
40
+ +incdir+../prim
41
+ ../prim/prim_assert.sv
42
+ ../prim/prim_util_pkg.sv
43
+ ../prim/prim_mubi_pkg.sv
44
+ ../prim/prim_alert_pkg.sv
45
+ ../prim/prim_subreg_pkg.sv
46
+ ../prim/prim_secded_pkg.sv
47
+ ../prim/prim_count_pkg.sv
48
+ ../tlul/tlul_pkg.sv
49
+ ../pkg/lc_ctrl_state_pkg.sv
50
+ ../pkg/lc_ctrl_reg_pkg.sv
51
+ ../pkg/lc_ctrl_pkg.sv
52
+ ../pkg/edn_pkg.sv
53
+ ../pkg/kmac_pkg.sv
54
+ ../pkg/otp_ctrl_pkg.sv
55
+ ../pkg/flash_ctrl_pkg.sv
56
+ ../pkg/rom_ctrl_pkg.sv
57
+ ../pkg/keymgr_reg_pkg.sv
58
+ ../pkg/keymgr_pkg.sv
59
+ ../prim/prim_secded_inv_72_64_enc.sv
60
+ ../prim/prim_secded_inv_72_64_dec.sv
61
+ ../tlul/tlul_err.sv
62
+ ../tlul/tlul_cmd_intg_chk.sv
63
+ ../tlul/tlul_rsp_intg_gen.sv
64
+ ../tlul/tlul_data_integ_dec.sv
65
+ ../tlul/tlul_data_integ_enc.sv
66
+ ../tlul/tlul_adapter_reg.sv
67
+ ../prim/prim_buf.sv
68
+ ../prim/prim_xnor2.sv
69
+ ../prim/prim_flop.sv
70
+ ../prim/prim_flop_2sync.sv
71
+ ../prim/prim_cdc_rand_delay.sv
72
+ ../prim/prim_subreg.sv
73
+ ../prim/prim_subreg_ext.sv
74
+ ../prim/prim_subreg_shadow.sv
75
+ ../prim/prim_reg_we_check.sv
76
+ ../prim/prim_alert_sender.sv
77
+ ../prim/prim_intr_hw.sv
78
+ ../prim/prim_lc_sync.sv
79
+ ../prim/prim_edn_req.sv
80
+ ../prim/prim_count.sv
81
+ ../prim/prim_lfsr.sv
82
+ ../prim/prim_sec_anchor_buf.sv
83
+ ../prim/prim_sec_anchor_const.sv
84
+ ../prim/prim_mubi4_sender.sv
85
+ ../prim/prim_mubi4_sync.sv
86
+ ../prim/prim_msb_extend.sv
87
+ ../rtl/keymgr_reg_top.sv
88
+ ../rtl/keymgr_cfg_en.sv
89
+ ../rtl/keymgr_data_en_state.sv
90
+ ../rtl/keymgr_op_state_ctrl.sv
91
+ ../rtl/keymgr_reseed_ctrl.sv
92
+ ../rtl/keymgr_sideload_key.sv
93
+ ../rtl/keymgr_err.sv
94
+ ../rtl/keymgr_ctrl.sv
95
+ ../rtl/keymgr_input_checks.sv
96
+ ../rtl/keymgr_kmac_if.sv
97
+ ../rtl/keymgr_sideload_key_ctrl.sv
98
+ ../rtl/keymgr.sv
99
+ FILELIST
100
+ cat > "$WS/run/Makefile" <<'MAKEFILE'
101
+ .PHONY: compile clean
102
+ compile:
103
+ @mkdir -p compile_log
104
+ xrun -c -64 -sv -access +rwc -elaborate -f filelist.f -timescale 1ns/1ps -l compile_log/compile.log 2>&1 || true
105
+ @echo "Check compile_log/compile.log"
106
+ clean:
107
+ rm -rf xcelium.d compile_log
108
+ MAKEFILE
images/rtl/rv-timer-core/Dockerfile ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TitanBench RV-TIMER-RTL — extends titanbench-base with OpenTitan infrastructure.
2
+ #
3
+ # Uses two build contexts:
4
+ # - default context (.) = OpenTitan repo root
5
+ # - titanbench = titanbench repo root
6
+ #
7
+ # Usage:
8
+ # docker build -f images/rtl/rv-timer-core/image/Dockerfile \
9
+ # --build-context titanbench=/path/to/titanbench \
10
+ # -t titanbench-rv-timer-rtl /path/to/opentitan
11
+
12
+ FROM titanbench-base:latest
13
+
14
+ # Copy the OpenTitan repo
15
+ COPY --chown=dev:dev . /home/dev/src/
16
+
17
+ # Copy the setup script from the titanbench repo
18
+ COPY --from=titanbench images/rtl/rv-timer-core/scripts/setup_workspace.sh /home/dev/scripts/setup_workspace.sh
19
+ RUN chmod +x /home/dev/scripts/setup_workspace.sh \
20
+ && bash /home/dev/scripts/setup_workspace.sh
21
+
22
+ # Git setup — dvsim requires a git repo with at least one commit
23
+ RUN git config --global --add safe.directory /home/dev/src \
24
+ && git config --global user.email "titanbench@opentitan.org" \
25
+ && git config --global user.name "TitanBench" \
26
+ && cd /home/dev/src \
27
+ && git init \
28
+ && git add -A \
29
+ && git commit -m "titanbench rv-timer-rtl base"
30
+
31
+ WORKDIR /home/dev/workspace/code
32
+ ENTRYPOINT []
33
+ CMD ["sh", "-c", "sleep infinity"]
images/rtl/rv-timer-core/scripts/setup_workspace.sh ADDED
@@ -0,0 +1,229 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Copyright lowRISC contributors (OpenTitan project).
3
+ # Licensed under the Apache License, Version 2.0, see LICENSE for details.
4
+ # SPDX-License-Identifier: Apache-2.0
5
+ #
6
+ # Populates the RV-TIMER-RTL workspace with infrastructure files from OpenTitan.
7
+ # Copies prim, tlul, pkg, spec, and boilerplate RTL — but NOT timer_core.sv.
8
+ #
9
+ # Run at image build time. Build context = OpenTitan repo root.
10
+
11
+ set -euo pipefail
12
+
13
+ REPO_TOP="/home/dev/src"
14
+ WS="/home/dev/workspace/code"
15
+
16
+ echo "=== TitanBench: Populating RV-TIMER-RTL workspace from OpenTitan ==="
17
+
18
+ # ── Create workspace directories ─────────────────────────────────────
19
+ mkdir -p "$WS"/{prim,tlul,pkg,spec,run,rtl}
20
+
21
+ # ── Prim modules (from hw/ip/prim/rtl/) ──────────────────────────────
22
+ echo "[1/6] Copying prim modules..."
23
+ PRIM_SRC="$REPO_TOP/hw/ip/prim/rtl"
24
+ PRIM_GEN_SRC="$REPO_TOP/hw/ip/prim_generic/rtl"
25
+
26
+ PRIM_FILES=(
27
+ # Packages
28
+ prim_alert_pkg.sv
29
+ prim_mubi_pkg.sv
30
+ prim_secded_pkg.sv
31
+ prim_subreg_pkg.sv
32
+ prim_util_pkg.sv
33
+ # Assertion headers
34
+ prim_assert.sv
35
+ prim_assert_sec_cm.svh
36
+ prim_assert_standard_macros.svh
37
+ # Flops
38
+ prim_flop_macros.sv
39
+ prim_cdc_rand_delay.sv
40
+ # Combinational
41
+ prim_onehot_enc.sv
42
+ prim_onehot_check.sv
43
+ # Subreg
44
+ prim_subreg.sv
45
+ prim_subreg_arb.sv
46
+ prim_subreg_ext.sv
47
+ prim_reg_we_check.sv
48
+ # Security
49
+ prim_sec_anchor_buf.sv
50
+ prim_sec_anchor_flop.sv
51
+ prim_alert_sender.sv
52
+ prim_intr_hw.sv
53
+ # SECDED (integrity — used by TLUL)
54
+ prim_secded_inv_22_16_dec.sv
55
+ prim_secded_inv_22_16_enc.sv
56
+ prim_secded_inv_28_22_dec.sv
57
+ prim_secded_inv_28_22_enc.sv
58
+ prim_secded_inv_39_32_dec.sv
59
+ prim_secded_inv_39_32_enc.sv
60
+ prim_secded_inv_64_57_dec.sv
61
+ prim_secded_inv_64_57_enc.sv
62
+ prim_secded_inv_72_64_dec.sv
63
+ prim_secded_inv_72_64_enc.sv
64
+ prim_secded_inv_hamming_22_16_dec.sv
65
+ prim_secded_inv_hamming_22_16_enc.sv
66
+ prim_secded_inv_hamming_39_32_dec.sv
67
+ prim_secded_inv_hamming_39_32_enc.sv
68
+ prim_secded_inv_hamming_72_64_dec.sv
69
+ prim_secded_inv_hamming_72_64_enc.sv
70
+ prim_secded_inv_hamming_76_68_dec.sv
71
+ prim_secded_inv_hamming_76_68_enc.sv
72
+ # Misc
73
+ prim_util_memload.svh
74
+ )
75
+
76
+ PRIM_GENERIC_FILES=(
77
+ prim_buf.sv
78
+ prim_flop.sv
79
+ prim_flop_2sync.sv
80
+ prim_xnor2.sv
81
+ )
82
+
83
+ for f in "${PRIM_FILES[@]}"; do
84
+ cp "$PRIM_SRC/$f" "$WS/prim/"
85
+ done
86
+ for f in "${PRIM_GENERIC_FILES[@]}"; do
87
+ cp "$PRIM_GEN_SRC/$f" "$WS/prim/"
88
+ done
89
+ echo " Copied $((${#PRIM_FILES[@]} + ${#PRIM_GENERIC_FILES[@]})) prim files"
90
+
91
+ # ── TLUL modules (from hw/ip/tlul/rtl/) ──────────────────────────────
92
+ echo "[2/6] Copying TLUL modules..."
93
+ TLUL_SRC="$REPO_TOP/hw/ip/tlul/rtl"
94
+
95
+ TLUL_FILES=(
96
+ tlul_pkg.sv
97
+ tlul_adapter_reg.sv
98
+ tlul_cmd_intg_chk.sv
99
+ tlul_data_integ_dec.sv
100
+ tlul_data_integ_enc.sv
101
+ tlul_err.sv
102
+ tlul_rsp_intg_gen.sv
103
+ )
104
+
105
+ for f in "${TLUL_FILES[@]}"; do
106
+ cp "$TLUL_SRC/$f" "$WS/tlul/"
107
+ done
108
+ echo " Copied ${#TLUL_FILES[@]} TLUL files"
109
+
110
+ # ── Package files ─────────────────────────────────────────────────────
111
+ echo "[3/6] Copying package files..."
112
+
113
+ cp "$REPO_TOP/hw/ip/rv_timer/rtl/rv_timer_reg_pkg.sv" "$WS/pkg/"
114
+ cp "$REPO_TOP/hw/top_earlgrey/rtl/top_pkg.sv" "$WS/pkg/"
115
+ cp "$REPO_TOP/hw/top_earlgrey/rtl/autogen/top_racl_pkg.sv" "$WS/pkg/"
116
+ cp "$REPO_TOP/hw/ip/lc_ctrl/rtl/lc_ctrl_pkg.sv" "$WS/pkg/"
117
+ cp "$REPO_TOP/hw/ip/lc_ctrl/rtl/lc_ctrl_reg_pkg.sv" "$WS/pkg/"
118
+ cp "$REPO_TOP/hw/ip/lc_ctrl/rtl/lc_ctrl_state_pkg.sv" "$WS/pkg/"
119
+
120
+ echo " Copied 6 package files"
121
+
122
+ # ── Spec documentation ────────────────────────────────────────────────
123
+ echo "[4/6] Copying spec documentation..."
124
+
125
+ cp "$REPO_TOP/hw/ip/rv_timer/doc/theory_of_operation.md" "$WS/spec/"
126
+ cp "$REPO_TOP/hw/ip/rv_timer/doc/registers.md" "$WS/spec/"
127
+ cp "$REPO_TOP/hw/ip/rv_timer/doc/interfaces.md" "$WS/spec/"
128
+ cp "$REPO_TOP/hw/ip/rv_timer/doc/programmers_guide.md" "$WS/spec/"
129
+ cp "$REPO_TOP/hw/ip/rv_timer/doc/timer_block_diagram.svg" "$WS/spec/"
130
+ cp "$REPO_TOP/hw/ip/rv_timer/data/rv_timer_testplan.hjson" "$WS/spec/"
131
+
132
+ echo " Copied spec docs"
133
+
134
+ # ── Boilerplate RTL (provided complete — do not stub) ─────────────────
135
+ echo "[5/6] Copying boilerplate RTL..."
136
+
137
+ cp "$REPO_TOP/hw/ip/rv_timer/rtl/rv_timer_reg_top.sv" "$WS/rtl/"
138
+ cp "$REPO_TOP/hw/ip/rv_timer/rtl/rv_timer.sv" "$WS/rtl/"
139
+
140
+ echo " Copied rv_timer.sv and rv_timer_reg_top.sv"
141
+
142
+ # ── Run directory (filelist + Makefile) ───────────────────────────────
143
+ echo "[6/6] Creating run directory..."
144
+
145
+ cat > "$WS/run/filelist.f" << 'FILELIST'
146
+ // Packages (order matters — dependencies first)
147
+ +incdir+../prim
148
+ ../prim/prim_assert.sv
149
+ ../prim/prim_util_pkg.sv
150
+ ../prim/prim_mubi_pkg.sv
151
+ ../prim/prim_alert_pkg.sv
152
+ ../prim/prim_subreg_pkg.sv
153
+ ../prim/prim_secded_pkg.sv
154
+ ../pkg/top_pkg.sv
155
+ ../tlul/tlul_pkg.sv
156
+ ../pkg/lc_ctrl_state_pkg.sv
157
+ ../pkg/lc_ctrl_reg_pkg.sv
158
+ ../pkg/lc_ctrl_pkg.sv
159
+ ../pkg/top_racl_pkg.sv
160
+ ../pkg/rv_timer_reg_pkg.sv
161
+
162
+ // SECDED encoder/decoder modules (used by TLUL integrity)
163
+ ../prim/prim_secded_inv_64_57_enc.sv
164
+ ../prim/prim_secded_inv_64_57_dec.sv
165
+ ../prim/prim_secded_inv_39_32_enc.sv
166
+ ../prim/prim_secded_inv_39_32_dec.sv
167
+
168
+ // TLUL modules
169
+ ../tlul/tlul_err.sv
170
+ ../tlul/tlul_cmd_intg_chk.sv
171
+ ../tlul/tlul_rsp_intg_gen.sv
172
+ ../tlul/tlul_data_integ_dec.sv
173
+ ../tlul/tlul_data_integ_enc.sv
174
+ ../tlul/tlul_adapter_reg.sv
175
+
176
+ // Prim modules (leaf first)
177
+ ../prim/prim_buf.sv
178
+ ../prim/prim_xnor2.sv
179
+ ../prim/prim_flop.sv
180
+ ../prim/prim_cdc_rand_delay.sv
181
+ ../prim/prim_flop_2sync.sv
182
+ ../prim/prim_onehot_enc.sv
183
+ ../prim/prim_onehot_check.sv
184
+ ../prim/prim_subreg_arb.sv
185
+ ../prim/prim_subreg.sv
186
+ ../prim/prim_subreg_ext.sv
187
+ ../prim/prim_reg_we_check.sv
188
+ ../prim/prim_sec_anchor_buf.sv
189
+ ../prim/prim_sec_anchor_flop.sv
190
+ ../prim/prim_alert_sender.sv
191
+ ../prim/prim_intr_hw.sv
192
+
193
+ // RV_TIMER boilerplate (provided — do not modify)
194
+ ../rtl/rv_timer_reg_top.sv
195
+
196
+ // RV_TIMER core (agent-written — implement this)
197
+ ../rtl/timer_core.sv
198
+
199
+ // RV_TIMER top (provided — do not modify)
200
+ ../rtl/rv_timer.sv
201
+ FILELIST
202
+
203
+ cat > "$WS/run/Makefile" << 'MAKEFILE'
204
+ .PHONY: compile clean
205
+
206
+ compile:
207
+ @mkdir -p compile_log
208
+ xrun -c -64 -sv -access +rwc -elaborate \
209
+ -f filelist.f \
210
+ -timescale 1ns/1ps \
211
+ -l compile_log/compile.log 2>&1 || true
212
+ @echo "Check compile_log/compile.log"
213
+
214
+ clean:
215
+ rm -rf xcelium.d compile_log
216
+ MAKEFILE
217
+
218
+ echo " Created filelist.f and Makefile"
219
+
220
+ # ── Verify ────────────────────────────────────────────────────────────
221
+ echo ""
222
+ echo "[verify] Workspace contents:"
223
+ for d in prim tlul pkg spec rtl run; do
224
+ count=$(find "$WS/$d" -type f 2>/dev/null | wc -l)
225
+ echo " $d/: $count files"
226
+ done
227
+
228
+ echo ""
229
+ echo "=== Workspace populated. timer_core.sv stub added by environment Dockerfile. ==="
images/rtl/rv_timer/Dockerfile ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TitanBench RV_TIMER-RTL — extends titanbench-base with OpenTitan infrastructure.
2
+ #
3
+ # Uses two build contexts:
4
+ # - default context (.) = OpenTitan repo root
5
+ # - titanbench = titanbench repo root
6
+ #
7
+ # Usage:
8
+ # docker build -f images/rtl/rv_timer/image/Dockerfile \
9
+ # --build-context titanbench=/path/to/titanbench \
10
+ # -t titanbench-rv_timer-rtl /path/to/opentitan
11
+
12
+ FROM titanbench-base:latest
13
+
14
+ # Copy the OpenTitan repo
15
+ COPY --chown=dev:dev . /home/dev/src/
16
+
17
+ # Copy the setup script from the titanbench repo
18
+ COPY --from=titanbench tasks_missing_rtl/rv_timer-rtl/scripts/setup_workspace.sh /home/dev/scripts/setup_workspace.sh
19
+ RUN chmod +x /home/dev/scripts/setup_workspace.sh \
20
+ && bash /home/dev/scripts/setup_workspace.sh
21
+
22
+ # Git setup — dvsim requires a git repo with at least one commit
23
+ RUN git config --global --add safe.directory /home/dev/src \
24
+ && git config --global user.email "titanbench@opentitan.org" \
25
+ && git config --global user.name "TitanBench" \
26
+ && cd /home/dev/src \
27
+ && git init \
28
+ && git add -A \
29
+ && git commit -m "titanbench rv_timer-rtl base"
30
+
31
+ WORKDIR /home/dev/workspace/code
32
+ ENTRYPOINT []
33
+ CMD ["sh", "-c", "sleep infinity"]