Add Batch 3 with 10 repos
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +1 -0
- Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/LICENSE.md +196 -0
- Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_1/uvm_core_utilities/README.md +41 -0
- Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_1/uvm_core_utilities/run/vc_hdrs.h +81 -0
- Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_1/uvm_core_utilities/src/class.sv +129 -0
- Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_1/uvm_core_utilities/src/clone.sv +41 -0
- Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_1/uvm_core_utilities/src/compare2.sv +44 -0
- Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_1/uvm_core_utilities/src/compare_ex.sv +69 -0
- Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_1/uvm_core_utilities/src/completed_class.sv +140 -0
- Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_1/uvm_core_utilities/src/copy.sv +99 -0
- Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_1/uvm_core_utilities/src/copy_ex.sv +109 -0
- Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_1/uvm_core_utilities/src/copy_obj.sv +41 -0
- Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_1/uvm_core_utilities/src/listing_2.1.sv +17 -0
- Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_1/uvm_core_utilities/src/listing_2.10.sv +51 -0
- Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_1/uvm_core_utilities/src/listing_2.2.sv +22 -0
- Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_1/uvm_core_utilities/src/new_packer.sv +176 -0
- Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_1/uvm_core_utilities/src/print.sv +28 -0
- Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/README.md +64 -0
- Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/env/wb_env_env.sv +50 -0
- Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/env/wb_master_agent.sv +80 -0
- Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/env/wb_slave_agent.sv +67 -0
- Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/hdl/design.sv +71 -0
- Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/hdl/dut2.sv +27 -0
- Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/hdl/wb_env_top.sv +42 -0
- Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/include/wb_env.sv +25 -0
- Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/run/vc_hdrs.h +77 -0
- Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/src/mon_2cov.sv +21 -0
- Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/src/wb_config.sv +53 -0
- Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/src/wb_env_cfg.sv +30 -0
- Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/src/wb_env_cov.sv +41 -0
- Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/src/wb_master.sv +273 -0
- Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/src/wb_master_agent_sequence_library.sv +101 -0
- Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/src/wb_master_if.sv +102 -0
- Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/src/wb_master_mon.sv +192 -0
- Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/src/wb_master_seqr.sv +15 -0
- Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/src/wb_scoreboard.sv +64 -0
- Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/src/wb_slave.my.sv +220 -0
- Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/src/wb_slave.sv +188 -0
- Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/src/wb_slave_agent_sequence_library.sv +62 -0
- Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/src/wb_slave_if.sv +82 -0
- Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/src/wb_slave_mon.sv +185 -0
- Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/src/wb_slave_seqr.sv +51 -0
- Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/src/wb_transaction.sv +84 -0
- Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/src/wb_transaction_extended.sv +18 -0
- Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/tests/wb_env_base_test.sv +49 -0
- Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/tests/wb_env_tb_mod.sv +30 -0
- Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/tests/wb_env_test.sv +54 -0
- Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/tests/wb_env_test_extended.sv +16 -0
- Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_3_Stimulus_Generation/README.md +10 -0
- Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_3_Stimulus_Generation/grab.sv +16 -0
.gitattributes
CHANGED
|
@@ -1157,3 +1157,4 @@ openasic-org_xk265/sw/testVector/rec.yuv filter=lfs diff=lfs merge=lfs -text
|
|
| 1157 |
efabless_caravel_user_project/verilog/gl/user_proj_example.v filter=lfs diff=lfs merge=lfs -text
|
| 1158 |
soDLA-publishment_soDLA/sodla-wrapper/src/main/resources/SO_small.v filter=lfs diff=lfs merge=lfs -text
|
| 1159 |
soDLA-publishment_soDLA/sodla.v filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 1157 |
efabless_caravel_user_project/verilog/gl/user_proj_example.v filter=lfs diff=lfs merge=lfs -text
|
| 1158 |
soDLA-publishment_soDLA/sodla-wrapper/src/main/resources/SO_small.v filter=lfs diff=lfs merge=lfs -text
|
| 1159 |
soDLA-publishment_soDLA/sodla.v filter=lfs diff=lfs merge=lfs -text
|
| 1160 |
+
wuxx_icesugar-pro/src/litex_linux/top.json filter=lfs diff=lfs merge=lfs -text
|
Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/LICENSE.md
ADDED
|
@@ -0,0 +1,196 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Some of the files provided with the Opencores.org files contain thier own licenses.
|
| 2 |
+
Those licenses continue and you must respect them.
|
| 3 |
+
|
| 4 |
+
This license below is only for the files which are NOT covered by those licences.
|
| 5 |
+
IE : All the examples in the Book_EXAMPLES directory and sub directories
|
| 6 |
+
and all examples in the soc/tb/uvm/* directories.
|
| 7 |
+
|
| 8 |
+
Permission is granted as per the Apache license below With an Additional restriction. Please respect our copyrights and not
|
| 9 |
+
remove any notices or alter the copyright in any way. The examples are meant for your own
|
| 10 |
+
study and to further your knowledge of UVM.
|
| 11 |
+
|
| 12 |
+
Please DO NOT POST the contents of these examples on any other website.
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
(c) Srivatsa Vasudevan 2011-2016. All rights reserved.
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
Apache License
|
| 21 |
+
Version 2.0, January 2004
|
| 22 |
+
http://www.apache.org/licenses/
|
| 23 |
+
|
| 24 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
| 25 |
+
|
| 26 |
+
1. Definitions.
|
| 27 |
+
|
| 28 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
| 29 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
| 30 |
+
|
| 31 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
| 32 |
+
the copyright owner that is granting the License.
|
| 33 |
+
|
| 34 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
| 35 |
+
other entities that control, are controlled by, or are under common
|
| 36 |
+
control with that entity. For the purposes of this definition,
|
| 37 |
+
"control" means (i) the power, direct or indirect, to cause the
|
| 38 |
+
direction or management of such entity, whether by contract or
|
| 39 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
| 40 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
| 41 |
+
|
| 42 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
| 43 |
+
exercising permissions granted by this License.
|
| 44 |
+
|
| 45 |
+
"Source" form shall mean the preferred form for making modifications,
|
| 46 |
+
including but not limited to software source code, documentation
|
| 47 |
+
source, and configuration files.
|
| 48 |
+
|
| 49 |
+
"Object" form shall mean any form resulting from mechanical
|
| 50 |
+
transformation or translation of a Source form, including but
|
| 51 |
+
not limited to compiled object code, generated documentation,
|
| 52 |
+
and conversions to other media types.
|
| 53 |
+
|
| 54 |
+
"Work" shall mean the work of authorship, whether in Source or
|
| 55 |
+
Object form, made available under the License, as indicated by a
|
| 56 |
+
copyright notice that is included in or attached to the work
|
| 57 |
+
(an example is provided in the Appendix below).
|
| 58 |
+
|
| 59 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
| 60 |
+
form, that is based on (or derived from) the Work and for which the
|
| 61 |
+
editorial revisions, annotations, elaborations, or other modifications
|
| 62 |
+
represent, as a whole, an original work of authorship. For the purposes
|
| 63 |
+
of this License, Derivative Works shall not include works that remain
|
| 64 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
| 65 |
+
the Work and Derivative Works thereof.
|
| 66 |
+
|
| 67 |
+
"Contribution" shall mean any work of authorship, including
|
| 68 |
+
the original version of the Work and any modifications or additions
|
| 69 |
+
to that Work or Derivative Works thereof, that is intentionally
|
| 70 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
| 71 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
| 72 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
| 73 |
+
means any form of electronic, verbal, or written communication sent
|
| 74 |
+
to the Licensor or its representatives, including but not limited to
|
| 75 |
+
communication on electronic mailing lists, source code control systems,
|
| 76 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
| 77 |
+
Licensor for the purpose of discussing and improving the Work, but
|
| 78 |
+
excluding communication that is conspicuously marked or otherwise
|
| 79 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
| 80 |
+
|
| 81 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
| 82 |
+
on behalf of whom a Contribution has been received by Licensor and
|
| 83 |
+
subsequently incorporated within the Work.
|
| 84 |
+
|
| 85 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
| 86 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 87 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 88 |
+
copyright license to reproduce, prepare Derivative Works of,
|
| 89 |
+
publicly display, publicly perform, sublicense, and distribute the
|
| 90 |
+
Work and such Derivative Works in Source or Object form.
|
| 91 |
+
|
| 92 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
| 93 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 94 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 95 |
+
(except as stated in this section) patent license to make, have made,
|
| 96 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
| 97 |
+
where such license applies only to those patent claims licensable
|
| 98 |
+
by such Contributor that are necessarily infringed by their
|
| 99 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
| 100 |
+
with the Work to which such Contribution(s) was submitted. If You
|
| 101 |
+
institute patent litigation against any entity (including a
|
| 102 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
| 103 |
+
or a Contribution incorporated within the Work constitutes direct
|
| 104 |
+
or contributory patent infringement, then any patent licenses
|
| 105 |
+
granted to You under this License for that Work shall terminate
|
| 106 |
+
as of the date such litigation is filed.
|
| 107 |
+
|
| 108 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
| 109 |
+
Work or Derivative Works thereof in any medium, with or without
|
| 110 |
+
modifications, and in Source or Object form, provided that You
|
| 111 |
+
meet the following conditions:
|
| 112 |
+
|
| 113 |
+
(a) You must give any other recipients of the Work or
|
| 114 |
+
Derivative Works a copy of this License; and
|
| 115 |
+
|
| 116 |
+
(b) You must cause any modified files to carry prominent notices
|
| 117 |
+
stating that You changed the files; and
|
| 118 |
+
|
| 119 |
+
(c) You must retain, in the Source form of any Derivative Works
|
| 120 |
+
that You distribute, all copyright, patent, trademark, and
|
| 121 |
+
attribution notices from the Source form of the Work,
|
| 122 |
+
excluding those notices that do not pertain to any part of
|
| 123 |
+
the Derivative Works; and
|
| 124 |
+
|
| 125 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
| 126 |
+
distribution, then any Derivative Works that You distribute must
|
| 127 |
+
include a readable copy of the attribution notices contained
|
| 128 |
+
within such NOTICE file, excluding those notices that do not
|
| 129 |
+
pertain to any part of the Derivative Works, in at least one
|
| 130 |
+
of the following places: within a NOTICE text file distributed
|
| 131 |
+
as part of the Derivative Works; within the Source form or
|
| 132 |
+
documentation, if provided along with the Derivative Works; or,
|
| 133 |
+
within a display generated by the Derivative Works, if and
|
| 134 |
+
wherever such third-party notices normally appear. The contents
|
| 135 |
+
of the NOTICE file are for informational purposes only and
|
| 136 |
+
do not modify the License. You may add Your own attribution
|
| 137 |
+
notices within Derivative Works that You distribute, alongside
|
| 138 |
+
or as an addendum to the NOTICE text from the Work, provided
|
| 139 |
+
that such additional attribution notices cannot be construed
|
| 140 |
+
as modifying the License.
|
| 141 |
+
|
| 142 |
+
You may add Your own copyright statement to Your modifications and
|
| 143 |
+
may provide additional or different license terms and conditions
|
| 144 |
+
for use, reproduction, or distribution of Your modifications, or
|
| 145 |
+
for any such Derivative Works as a whole, provided Your use,
|
| 146 |
+
reproduction, and distribution of the Work otherwise complies with
|
| 147 |
+
the conditions stated in this License.
|
| 148 |
+
|
| 149 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
| 150 |
+
any Contribution intentionally submitted for inclusion in the Work
|
| 151 |
+
by You to the Licensor shall be under the terms and conditions of
|
| 152 |
+
this License, without any additional terms or conditions.
|
| 153 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
| 154 |
+
the terms of any separate license agreement you may have executed
|
| 155 |
+
with Licensor regarding such Contributions.
|
| 156 |
+
|
| 157 |
+
6. Trademarks. This License does not grant permission to use the trade
|
| 158 |
+
names, trademarks, service marks, or product names of the Licensor,
|
| 159 |
+
except as required for reasonable and customary use in describing the
|
| 160 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
| 161 |
+
|
| 162 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
| 163 |
+
agreed to in writing, Licensor provides the Work (and each
|
| 164 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
| 165 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
| 166 |
+
implied, including, without limitation, any warranties or conditions
|
| 167 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
| 168 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
| 169 |
+
appropriateness of using or redistributing the Work and assume any
|
| 170 |
+
risks associated with Your exercise of permissions under this License.
|
| 171 |
+
|
| 172 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
| 173 |
+
whether in tort (including negligence), contract, or otherwise,
|
| 174 |
+
unless required by applicable law (such as deliberate and grossly
|
| 175 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
| 176 |
+
liable to You for damages, including any direct, indirect, special,
|
| 177 |
+
incidental, or consequential damages of any character arising as a
|
| 178 |
+
result of this License or out of the use or inability to use the
|
| 179 |
+
Work (including but not limited to damages for loss of goodwill,
|
| 180 |
+
work stoppage, computer failure or malfunction, or any and all
|
| 181 |
+
other commercial damages or losses), even if such Contributor
|
| 182 |
+
has been advised of the possibility of such damages.
|
| 183 |
+
|
| 184 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
| 185 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
| 186 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
| 187 |
+
or other liability obligations and/or rights consistent with this
|
| 188 |
+
License. However, in accepting such obligations, You may act only
|
| 189 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
| 190 |
+
of any other Contributor, and only if You agree to indemnify,
|
| 191 |
+
defend, and hold each Contributor harmless for any liability
|
| 192 |
+
incurred by, or claims asserted against, such Contributor by reason
|
| 193 |
+
of your accepting any such warranty or additional liability.
|
| 194 |
+
|
| 195 |
+
END OF TERMS AND CONDITIONS
|
| 196 |
+
|
Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_1/uvm_core_utilities/README.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Note:
|
| 2 |
+
There were some typos in the code for the uvm_utilities in the BOOK print COPY.
|
| 3 |
+
These were actually fixed in the code. The wrong files got picked up.
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
------------------------------------
|
| 7 |
+
|
| 8 |
+
The examples for Part 1 of the book are in the subdirectories below this directory.
|
| 9 |
+
There are 3 makefiles in the run directory. One for each simulator.
|
| 10 |
+
|
| 11 |
+
Please note that I have not provided log files for the other two simulators in the run directory for a number of reasons.
|
| 12 |
+
The makefiles for the Questa and IUS simulators were provided by Srinivasan Venkataraman of CVC Bangalore. srini@cvcblr.com
|
| 13 |
+
I am grateful to him for making the contribution.
|
| 14 |
+
|
| 15 |
+
The make files for the VCS simulator have been validated and provided in the run directory along with log files.
|
| 16 |
+
|
| 17 |
+
I appeal to the community at large to run these examples, make any necessary tweaks for the other simulators and share thier log files.
|
| 18 |
+
The contribution of the log files will be gratefully appreciated.
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
Please note:
|
| 23 |
+
For IUS and Questa:
|
| 24 |
+
You may need to set the environment variable UVM_HOME to an area where you have the UVM tarball downloaded. That is NOT in the makefile
|
| 25 |
+
The simulator may provide a setting and I invite you to check on that in the documentation.
|
| 26 |
+
If you are not sure, you can download the tarball from: http://www.accellera.org/images/downloads/standards/uvm/uvm-1.2.tar.gz
|
| 27 |
+
explode it and set UVM_HOME to the location of the src/ subdirectory.
|
| 28 |
+
|
| 29 |
+
For the VCS simulator, it is set to the inbuilt copy of UVM bundled with VCS.
|
| 30 |
+
|
| 31 |
+
Please let me know of any problems with these files so that I can correct them.
|
| 32 |
+
if anything is wrong with these instructions for Questa and IUS, and you figure it out, please let me know what the changes are and I will incorporate them
|
| 33 |
+
into the main repository.
|
| 34 |
+
|
| 35 |
+
Thanks!
|
| 36 |
+
Srivatsa
|
| 37 |
+
July 2018
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
|
Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_1/uvm_core_utilities/run/vc_hdrs.h
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef _GNU_SOURCE
|
| 2 |
+
#define _GNU_SOURCE
|
| 3 |
+
#endif
|
| 4 |
+
#include <stdio.h>
|
| 5 |
+
#include <dlfcn.h>
|
| 6 |
+
#include "svdpi.h"
|
| 7 |
+
|
| 8 |
+
#ifdef __cplusplus
|
| 9 |
+
extern "C" {
|
| 10 |
+
#endif
|
| 11 |
+
|
| 12 |
+
#ifndef _VC_TYPES_
|
| 13 |
+
#define _VC_TYPES_
|
| 14 |
+
/* common definitions shared with DirectC.h */
|
| 15 |
+
|
| 16 |
+
typedef unsigned int U;
|
| 17 |
+
typedef unsigned char UB;
|
| 18 |
+
typedef unsigned char scalar;
|
| 19 |
+
typedef struct { U c; U d;} vec32;
|
| 20 |
+
|
| 21 |
+
#define scalar_0 0
|
| 22 |
+
#define scalar_1 1
|
| 23 |
+
#define scalar_z 2
|
| 24 |
+
#define scalar_x 3
|
| 25 |
+
|
| 26 |
+
extern long long int ConvUP2LLI(U* a);
|
| 27 |
+
extern void ConvLLI2UP(long long int a1, U* a2);
|
| 28 |
+
extern long long int GetLLIresult();
|
| 29 |
+
extern void StoreLLIresult(const unsigned int* data);
|
| 30 |
+
typedef struct VeriC_Descriptor *vc_handle;
|
| 31 |
+
|
| 32 |
+
#ifndef SV_3_COMPATIBILITY
|
| 33 |
+
#define SV_STRING const char*
|
| 34 |
+
#else
|
| 35 |
+
#define SV_STRING char*
|
| 36 |
+
#endif
|
| 37 |
+
|
| 38 |
+
#endif /* _VC_TYPES_ */
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
extern int uvm_hdl_check_path(/* INPUT */const char* path);
|
| 42 |
+
|
| 43 |
+
extern int uvm_hdl_deposit(/* INPUT */const char* path, const /* INPUT */svLogicVecVal *value);
|
| 44 |
+
|
| 45 |
+
extern int uvm_hdl_force(/* INPUT */const char* path, const /* INPUT */svLogicVecVal *value);
|
| 46 |
+
|
| 47 |
+
extern int uvm_hdl_release_and_read(/* INPUT */const char* path, /* INOUT */svLogicVecVal *value);
|
| 48 |
+
|
| 49 |
+
extern int uvm_hdl_release(/* INPUT */const char* path);
|
| 50 |
+
|
| 51 |
+
extern int uvm_hdl_read(/* INPUT */const char* path, /* OUTPUT */svLogicVecVal *value);
|
| 52 |
+
|
| 53 |
+
extern SV_STRING uvm_hdl_read_string(/* INPUT */const char* path);
|
| 54 |
+
|
| 55 |
+
extern int uvm_memory_load(/* INPUT */const char* nid, /* INPUT */const char* scope, /* INPUT */const char* fileName, /* INPUT */const char* radix, /* INPUT */const char* startaddr, /* INPUT */const char* endaddr, /* INPUT */const char* types);
|
| 56 |
+
|
| 57 |
+
extern SV_STRING uvm_dpi_get_next_arg_c(/* INPUT */int init);
|
| 58 |
+
|
| 59 |
+
extern SV_STRING uvm_dpi_get_tool_name_c();
|
| 60 |
+
|
| 61 |
+
extern SV_STRING uvm_dpi_get_tool_version_c();
|
| 62 |
+
|
| 63 |
+
extern void* uvm_dpi_regcomp(/* INPUT */const char* regex);
|
| 64 |
+
|
| 65 |
+
extern int uvm_dpi_regexec(/* INPUT */void* preg, /* INPUT */const char* str);
|
| 66 |
+
|
| 67 |
+
extern void uvm_dpi_regfree(/* INPUT */void* preg);
|
| 68 |
+
|
| 69 |
+
extern int uvm_re_match(/* INPUT */const char* re, /* INPUT */const char* str);
|
| 70 |
+
|
| 71 |
+
extern void uvm_dump_re_cache();
|
| 72 |
+
|
| 73 |
+
extern SV_STRING uvm_glob_to_re(/* INPUT */const char* glob);
|
| 74 |
+
|
| 75 |
+
extern void m__uvm_report_dpi(/* INPUT */int severity, /* INPUT */const char* id, /* INPUT */const char* message, /* INPUT */int verbosity, /* INPUT */const char* filename, /* INPUT */int line);
|
| 76 |
+
void SdisableFork();
|
| 77 |
+
|
| 78 |
+
#ifdef __cplusplus
|
| 79 |
+
}
|
| 80 |
+
#endif
|
| 81 |
+
|
Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_1/uvm_core_utilities/src/class.sv
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Class definition
|
| 2 |
+
class class_A extends uvm_object;
|
| 3 |
+
|
| 4 |
+
int cl_int;
|
| 5 |
+
string cl_string;
|
| 6 |
+
int cl_int_arr[];
|
| 7 |
+
longint unsigned logic_data[*];
|
| 8 |
+
|
| 9 |
+
`uvm_object_utils_begin(class_A)
|
| 10 |
+
`uvm_field_int(cl_int,UVM_ALL_ON)
|
| 11 |
+
`uvm_field_string(cl_string,UVM_ALL_ON)
|
| 12 |
+
`uvm_field_array_int(cl_int_arr,UVM_ALL_ON)
|
| 13 |
+
`uvm_field_aa_int_longint_unsigned(logic_data,UVM_ALL_ON)
|
| 14 |
+
`uvm_object_utils_end
|
| 15 |
+
|
| 16 |
+
function new(string name="");
|
| 17 |
+
int idx = 1;
|
| 18 |
+
super.new(name);
|
| 19 |
+
cl_string = name;
|
| 20 |
+
cl_int = 10;
|
| 21 |
+
cl_int_arr = new[cl_int];
|
| 22 |
+
for(int i = 0; i < cl_int; i++) begin
|
| 23 |
+
cl_int_arr[i] = i + 1;
|
| 24 |
+
end
|
| 25 |
+
repeat (16) begin
|
| 26 |
+
logic_data[idx] = idx;
|
| 27 |
+
idx = idx << 1;
|
| 28 |
+
end
|
| 29 |
+
endfunction
|
| 30 |
+
|
| 31 |
+
endclass
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
class class_P extends uvm_object;
|
| 35 |
+
|
| 36 |
+
// basic datatypes
|
| 37 |
+
rand int par_int;
|
| 38 |
+
rand byte par_address;
|
| 39 |
+
string par_string;
|
| 40 |
+
|
| 41 |
+
// Some objects to demonstrate the copy recursion policy
|
| 42 |
+
|
| 43 |
+
class_A cl1; // UVM_SHALLOW
|
| 44 |
+
class_A cl3; // UVM_DEEP
|
| 45 |
+
|
| 46 |
+
`uvm_object_utils_begin(class_P)
|
| 47 |
+
`uvm_field_int(par_int,UVM_ALL_ON)
|
| 48 |
+
`uvm_field_int(par_address,UVM_ALL_ON )
|
| 49 |
+
`uvm_field_string(par_string,UVM_NOCOPY)
|
| 50 |
+
`uvm_field_object(cl1,UVM_ALL_ON|UVM_NOCOPY)
|
| 51 |
+
`uvm_field_object(cl3,UVM_ALL_ON|UVM_REFERENCE)
|
| 52 |
+
`uvm_object_utils_end
|
| 53 |
+
|
| 54 |
+
function new(string name="");
|
| 55 |
+
super.new(name);
|
| 56 |
+
cl1 = new(name);
|
| 57 |
+
cl3 = new(name ) ;
|
| 58 |
+
par_string = name;
|
| 59 |
+
endfunction
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
function void do_copy(uvm_object rhs);
|
| 63 |
+
class_P rhs_;
|
| 64 |
+
super.do_copy(rhs);
|
| 65 |
+
$cast(rhs_,rhs);
|
| 66 |
+
cl1 = new rhs_.cl1;
|
| 67 |
+
cl3 = new rhs_.cl3;
|
| 68 |
+
endfunction
|
| 69 |
+
|
| 70 |
+
virtual function bit do_compare(uvm_object rhs, uvm_comparer comparer);
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
endfunction
|
| 74 |
+
endclass
|
| 75 |
+
|
| 76 |
+
class class_Pass2 extends uvm_object;
|
| 77 |
+
|
| 78 |
+
// basic datatypes
|
| 79 |
+
rand int par_int;
|
| 80 |
+
rand byte par_address;
|
| 81 |
+
string par_string;
|
| 82 |
+
|
| 83 |
+
// Some objects to demonstrate the copy recursion policy
|
| 84 |
+
|
| 85 |
+
class_A cl1; // UVM_SHALLOW
|
| 86 |
+
class_A cl3; // UVM_DEEP
|
| 87 |
+
|
| 88 |
+
`uvm_object_utils_begin(class_Pass2)
|
| 89 |
+
`uvm_field_int(par_int,UVM_ALL_ON)
|
| 90 |
+
`uvm_field_int(par_address,UVM_ALL_ON | UVM_NOCOPY)
|
| 91 |
+
`uvm_field_string(par_string,UVM_NOCOPY)
|
| 92 |
+
`uvm_field_object(cl1,UVM_ALL_ON)
|
| 93 |
+
`uvm_field_object(cl3,UVM_ALL_ON|UVM_SHALLOW)
|
| 94 |
+
`uvm_object_utils_end
|
| 95 |
+
|
| 96 |
+
function new(string name="");
|
| 97 |
+
super.new(name);
|
| 98 |
+
cl1 = new(name);
|
| 99 |
+
cl3 = new(name );
|
| 100 |
+
par_string = name;
|
| 101 |
+
endfunction
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
function void do_copy(uvm_object rhs);
|
| 105 |
+
class_Pass2 rhs_;
|
| 106 |
+
super.do_copy(rhs);
|
| 107 |
+
$cast(rhs_,rhs);
|
| 108 |
+
par_int = rhs_.par_int;
|
| 109 |
+
par_address = rhs_.par_address;
|
| 110 |
+
par_string = rhs_.par_string;
|
| 111 |
+
cl1 = new rhs_.cl1;
|
| 112 |
+
cl3 = new rhs_.cl3;
|
| 113 |
+
endfunction
|
| 114 |
+
|
| 115 |
+
virtual function bit do_compare(uvm_object rhs, uvm_comparer comparer);
|
| 116 |
+
class_P rhs_;
|
| 117 |
+
do_compare = super.do_compare(rhs,comparer);
|
| 118 |
+
$cast(rhs_,rhs);
|
| 119 |
+
do_compare &= comparer.compare_field_int("par_int",par_int,rhs_.par_int,32,UVM_NORADIX);
|
| 120 |
+
do_compare &= comparer.compare_field_int("par_address",par_int,rhs_.par_int,32,UVM_NORADIX);
|
| 121 |
+
do_compare &= comparer.compare_string("par_string",par_string,rhs_.par_string);
|
| 122 |
+
do_compare &= comparer.compare_object("cl1",cl1,rhs_.cl1);
|
| 123 |
+
do_compare &= comparer.compare_object("cl1",cl3,rhs_.cl3);
|
| 124 |
+
endfunction
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
endclass
|
| 128 |
+
|
| 129 |
+
|
Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_1/uvm_core_utilities/src/clone.sv
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
module top;
|
| 2 |
+
import uvm_pkg::*;
|
| 3 |
+
typedef class class_A;
|
| 4 |
+
|
| 5 |
+
// Class definition
|
| 6 |
+
class class_A extends uvm_object;
|
| 7 |
+
|
| 8 |
+
int cl_int;
|
| 9 |
+
string cl_string;
|
| 10 |
+
int cl_int_arr[];
|
| 11 |
+
`uvm_object_utils_begin(class_A)
|
| 12 |
+
`uvm_field_int(cl_int,UVM_ALL_ON);
|
| 13 |
+
`uvm_field_string(cl_string,UVM_ALL_ON);
|
| 14 |
+
`uvm_field_array_int(cl_int_arr,UVM_ALL_ON);
|
| 15 |
+
`uvm_object_utils_end
|
| 16 |
+
|
| 17 |
+
function new(string name="");
|
| 18 |
+
super.new(name);
|
| 19 |
+
cl_string = name;
|
| 20 |
+
cl_int = 11;
|
| 21 |
+
cl_int_arr = new[cl_int];
|
| 22 |
+
for(int i = 0; i < cl_int; i++) begin
|
| 23 |
+
cl_int_arr[i] = i + 1;
|
| 24 |
+
end
|
| 25 |
+
endfunction
|
| 26 |
+
|
| 27 |
+
endclass
|
| 28 |
+
|
| 29 |
+
class_A class_A_inst1;
|
| 30 |
+
class_A class_A_inst2;
|
| 31 |
+
initial begin
|
| 32 |
+
// free children
|
| 33 |
+
class_A_inst1 = new("child_inst1",1);
|
| 34 |
+
|
| 35 |
+
class_A_inst1.randomize();
|
| 36 |
+
class_A_inst1.print();
|
| 37 |
+
$cast(class_A_inst2,class_A_inst1.clone());
|
| 38 |
+
class_A_inst1.print();
|
| 39 |
+
|
| 40 |
+
end
|
| 41 |
+
endmodule
|
Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_1/uvm_core_utilities/src/compare2.sv
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
module top;
|
| 2 |
+
`include "uvm_macros.svh"
|
| 3 |
+
import uvm_pkg::*;
|
| 4 |
+
|
| 5 |
+
`include "class2_1.sv"
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
class_B class_B_inst1;
|
| 9 |
+
class_B class_B_inst2;
|
| 10 |
+
class_A class_A_inst1;
|
| 11 |
+
class_A class_A_inst2;
|
| 12 |
+
|
| 13 |
+
class custom_comparer extends uvm_comparer;
|
| 14 |
+
|
| 15 |
+
int unsigned show_max = 10;
|
| 16 |
+
int unsigned verbosity = UVM_WARNING;
|
| 17 |
+
string miscompares = "srivatsa %m";
|
| 18 |
+
|
| 19 |
+
endclass
|
| 20 |
+
|
| 21 |
+
custom_comparer c_comp = new();
|
| 22 |
+
initial begin
|
| 23 |
+
// free children
|
| 24 |
+
class_A_inst1 = new("A_inst1");
|
| 25 |
+
class_A_inst2 = new("A_inst2");
|
| 26 |
+
|
| 27 |
+
// Custom Comparison:
|
| 28 |
+
|
| 29 |
+
class_A_inst1.randomize();
|
| 30 |
+
|
| 31 |
+
class_A_inst2.randomize();
|
| 32 |
+
class_A_inst2.copy(class_A_inst1);
|
| 33 |
+
`uvm_info("Compare 1","comparison of identical classes",UVM_LOW)
|
| 34 |
+
class_A_inst1.compare(class_A_inst2, c_comp);
|
| 35 |
+
|
| 36 |
+
class_A_inst1.logic_data[16 ] = 2;
|
| 37 |
+
class_A_inst1.logic_data[32 ] = 2;
|
| 38 |
+
// class_A_inst1.logic_data[64] = 2;
|
| 39 |
+
class_A_inst1.logic_data[128] = 1;
|
| 40 |
+
`uvm_info("Compare 2","comparison of nonidentical classes",UVM_LOW)
|
| 41 |
+
class_A_inst1.compare(class_A_inst2, c_comp);
|
| 42 |
+
|
| 43 |
+
end
|
| 44 |
+
endmodule
|
Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_1/uvm_core_utilities/src/compare_ex.sv
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* This example illustrates a custom comparer
|
| 2 |
+
* and the copy operation
|
| 3 |
+
*/
|
| 4 |
+
|
| 5 |
+
module top;
|
| 6 |
+
`include "uvm_macros.svh"
|
| 7 |
+
import uvm_pkg::*;
|
| 8 |
+
|
| 9 |
+
// Class definition
|
| 10 |
+
class class_A extends uvm_object;
|
| 11 |
+
|
| 12 |
+
int cl_int;
|
| 13 |
+
string cl_string;
|
| 14 |
+
int cl_int_arr[];
|
| 15 |
+
longint unsigned logic_data[*];
|
| 16 |
+
|
| 17 |
+
`uvm_object_utils_begin(class_A)
|
| 18 |
+
`uvm_field_int(cl_int,UVM_ALL_ON)
|
| 19 |
+
`uvm_field_string(cl_string,UVM_ALL_ON)
|
| 20 |
+
`uvm_object_utils_end
|
| 21 |
+
|
| 22 |
+
function new(string name="");
|
| 23 |
+
int idx = 1;
|
| 24 |
+
super.new(name);
|
| 25 |
+
cl_string = name;
|
| 26 |
+
endfunction
|
| 27 |
+
|
| 28 |
+
endclass
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
class_A class_A_inst1;
|
| 33 |
+
class_A class_A_inst2;
|
| 34 |
+
|
| 35 |
+
class custom_comparer extends uvm_comparer;
|
| 36 |
+
|
| 37 |
+
int unsigned show_max = 10;
|
| 38 |
+
int unsigned verbosity = UVM_WARNING;
|
| 39 |
+
string miscompares = "srivatsa %m";
|
| 40 |
+
|
| 41 |
+
endclass
|
| 42 |
+
|
| 43 |
+
custom_comparer c_comp = new();
|
| 44 |
+
initial begin
|
| 45 |
+
// free children
|
| 46 |
+
//class_A_inst1 = new("child_inst1");
|
| 47 |
+
// class_A_inst2 = new("child_inst2");
|
| 48 |
+
|
| 49 |
+
class_A_inst1 = class_A::type_id::create("child_inst1");
|
| 50 |
+
class_A_inst2 = class_A::type_id::create("child_inst2");
|
| 51 |
+
// Custom Comparison:
|
| 52 |
+
|
| 53 |
+
class_A_inst1.randomize();
|
| 54 |
+
|
| 55 |
+
class_A_inst2.randomize();
|
| 56 |
+
class_A_inst2.copy(class_A_inst1);
|
| 57 |
+
|
| 58 |
+
class_A_inst1.logic_data[16 ] = 2;
|
| 59 |
+
class_A_inst1.logic_data[32 ] = 2;
|
| 60 |
+
class_A_inst1.logic_data[64] = 2;
|
| 61 |
+
class_A_inst1.logic_data[128] = 1;
|
| 62 |
+
class_A_inst1.print();
|
| 63 |
+
class_A_inst2.print();
|
| 64 |
+
class_A_inst1.compare(class_A_inst2, c_comp);
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
end
|
| 69 |
+
endmodule
|
Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_1/uvm_core_utilities/src/completed_class.sv
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
module top;
|
| 3 |
+
import uvm_pkg::*;
|
| 4 |
+
|
| 5 |
+
// Class definition
|
| 6 |
+
class class_A extends uvm_object;
|
| 7 |
+
|
| 8 |
+
int cl_int;
|
| 9 |
+
string cl_string;
|
| 10 |
+
int cl_int_arr[];
|
| 11 |
+
int logic_data[int];
|
| 12 |
+
|
| 13 |
+
`uvm_object_utils_begin(class_A)
|
| 14 |
+
`uvm_field_int(cl_int,UVM_ALL_ON)
|
| 15 |
+
`uvm_field_string(cl_string,UVM_ALL_ON)
|
| 16 |
+
`uvm_field_array_int(cl_int_arr,UVM_ALL_ON)
|
| 17 |
+
`uvm_field_aa_int_int(logic_data,UVM_ALL_ON)
|
| 18 |
+
`uvm_object_utils_end
|
| 19 |
+
|
| 20 |
+
function new(string name="");
|
| 21 |
+
int idx = 1;
|
| 22 |
+
super.new(name);
|
| 23 |
+
cl_string = name;
|
| 24 |
+
cl_int = 10;
|
| 25 |
+
cl_int_arr = new[cl_int];
|
| 26 |
+
for(int i = 0; i < cl_int; i++) begin
|
| 27 |
+
cl_int_arr[i] = i + 1;
|
| 28 |
+
end
|
| 29 |
+
repeat (16) begin
|
| 30 |
+
logic_data[idx] = idx;
|
| 31 |
+
idx = idx << 1;
|
| 32 |
+
end
|
| 33 |
+
endfunction
|
| 34 |
+
|
| 35 |
+
endclass
|
| 36 |
+
|
| 37 |
+
class class_B extends uvm_object;
|
| 38 |
+
|
| 39 |
+
// basic datatypes
|
| 40 |
+
rand int par_int; int inst_id = 10;
|
| 41 |
+
rand byte par_address;
|
| 42 |
+
string par_string;
|
| 43 |
+
logic [3:0] bits_field;
|
| 44 |
+
|
| 45 |
+
// Some objects to demonstrate the copy recursion policy
|
| 46 |
+
|
| 47 |
+
class_A cl1; // UVM_SHALLOW
|
| 48 |
+
class_A cl3; // UVM_DEEP
|
| 49 |
+
|
| 50 |
+
`uvm_object_utils_begin(class_B)
|
| 51 |
+
`uvm_field_int(par_int,UVM_ALL_ON|UVM_NOPACK)
|
| 52 |
+
`uvm_field_int(par_address,UVM_ALL_ON | UVM_NOCOPY|UVM_NOPACK)
|
| 53 |
+
`uvm_field_string(par_string,UVM_NOCOPY|UVM_NOPACK)
|
| 54 |
+
`uvm_field_object(cl1,UVM_ALL_ON|UVM_NOPACK)
|
| 55 |
+
`uvm_field_object(cl3,UVM_ALL_ON|UVM_SHALLOW|UVM_NOPACK)
|
| 56 |
+
`uvm_field_int(bits_field,UVM_ALL_ON|UVM_NOPACK)
|
| 57 |
+
`uvm_object_utils_end
|
| 58 |
+
|
| 59 |
+
function new(string name="");
|
| 60 |
+
super.new(name);
|
| 61 |
+
|
| 62 |
+
cl1 = new(name,10);
|
| 63 |
+
cl3 = new(name,11 ) ;
|
| 64 |
+
par_string = name;
|
| 65 |
+
bits_field = inst_id;
|
| 66 |
+
endfunction
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
function void do_copy(uvm_object rhs);
|
| 70 |
+
class_B rhs_;
|
| 71 |
+
super.do_copy(rhs);
|
| 72 |
+
$cast(rhs_,rhs);
|
| 73 |
+
par_int = rhs_.par_int;
|
| 74 |
+
par_address = rhs_.par_address;
|
| 75 |
+
par_string = rhs_.par_string;
|
| 76 |
+
cl1 = new rhs_.cl1;
|
| 77 |
+
cl3 = new rhs_.cl3;
|
| 78 |
+
bits_field = rhs_.bits_field;
|
| 79 |
+
endfunction
|
| 80 |
+
|
| 81 |
+
virtual function bit do_compare(uvm_object rhs, uvm_comparer comparer);
|
| 82 |
+
class_B rhs_;
|
| 83 |
+
do_compare = super.do_compare(rhs,comparer);
|
| 84 |
+
$cast(rhs_,rhs);
|
| 85 |
+
do_compare &= comparer.compare_field_int("par_int",par_int,rhs_.par_int,32,UVM_NORADIX);
|
| 86 |
+
do_compare &= comparer.compare_field_int("par_address",par_int,rhs_.par_int,32,UVM_NORADIX);
|
| 87 |
+
do_compare &= comparer.compare_string("par_string",par_string,rhs_.par_string);
|
| 88 |
+
do_compare &= comparer.compare_object("cl1",cl1,rhs_.cl1);
|
| 89 |
+
do_compare &= comparer.compare_object("cl1",cl3,rhs_.cl3);
|
| 90 |
+
do_compare &= comparer.compare_field("bits_field",bits_field,rhs_.bits_field,$bits(bits_field),UVM_NORADIX);
|
| 91 |
+
endfunction
|
| 92 |
+
|
| 93 |
+
function void do_pack (uvm_packer packer);
|
| 94 |
+
super.do_pack(packer);
|
| 95 |
+
packer.pack_field_int(par_int,32);
|
| 96 |
+
packer.pack_field_int(par_address,8);
|
| 97 |
+
packer.pack_string(par_string);
|
| 98 |
+
packer.pack_object(cl1);
|
| 99 |
+
packer.pack_object(cl3);
|
| 100 |
+
packer.pack_field(bits_field,$bits(bits_field));
|
| 101 |
+
endfunction
|
| 102 |
+
|
| 103 |
+
function void do_unpack (uvm_packer packer);
|
| 104 |
+
super.do_unpack(packer);
|
| 105 |
+
par_int = packer.unpack_field_int(32);
|
| 106 |
+
par_address = packer.unpack_field_int(8);
|
| 107 |
+
par_string = packer.unpack_string(-1);
|
| 108 |
+
packer.unpack_object(cl1);
|
| 109 |
+
packer.unpack_object(cl3);
|
| 110 |
+
bits_field = packer.unpack_field($bits(bits_field));
|
| 111 |
+
endfunction
|
| 112 |
+
endclass
|
| 113 |
+
|
| 114 |
+
bit pack_bytes[];
|
| 115 |
+
class_B class_B_inst1;
|
| 116 |
+
class_B class_B_inst2;
|
| 117 |
+
initial begin
|
| 118 |
+
// free children
|
| 119 |
+
|
| 120 |
+
class_B_inst1 = new("first_inst");
|
| 121 |
+
class_B_inst1.randomize();
|
| 122 |
+
`uvm_info("top", "Printing class_B_inst1",UVM_LOW)
|
| 123 |
+
class_B_inst1.print();
|
| 124 |
+
|
| 125 |
+
uvm_default_packer.use_metadata = 1;
|
| 126 |
+
class_B_inst1.pack(pack_bytes);
|
| 127 |
+
|
| 128 |
+
class_B_inst2 = new("second_inst");
|
| 129 |
+
// class_B_inst2.randomize();
|
| 130 |
+
`uvm_info("top", "Printing class_B_inst2",UVM_LOW)
|
| 131 |
+
class_B_inst2.print();
|
| 132 |
+
|
| 133 |
+
class_B_inst2.unpack(pack_bytes);
|
| 134 |
+
`uvm_info("top", "Printing class_B_inst2 after unpack",UVM_LOW)
|
| 135 |
+
class_B_inst2.print();
|
| 136 |
+
|
| 137 |
+
end
|
| 138 |
+
endmodule
|
| 139 |
+
|
| 140 |
+
|
Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_1/uvm_core_utilities/src/copy.sv
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
module top;
|
| 2 |
+
import uvm_pkg::*;
|
| 3 |
+
typedef class class_A;
|
| 4 |
+
|
| 5 |
+
// Class definition
|
| 6 |
+
class class_A extends uvm_object;
|
| 7 |
+
|
| 8 |
+
int cl_int;
|
| 9 |
+
string cl_string;
|
| 10 |
+
int cl_int_arr[];
|
| 11 |
+
`uvm_object_utils_begin(class_A)
|
| 12 |
+
`uvm_field_int(cl_int,UVM_ALL_ON);
|
| 13 |
+
`uvm_field_string(cl_string,UVM_ALL_ON);
|
| 14 |
+
`uvm_field_array_int(cl_int_arr,UVM_ALL_ON);
|
| 15 |
+
`uvm_object_utils_end
|
| 16 |
+
|
| 17 |
+
function new(string name="");
|
| 18 |
+
super.new(name);
|
| 19 |
+
cl_string = name;
|
| 20 |
+
cl_int = 10;
|
| 21 |
+
cl_int_arr = new[cl_int];
|
| 22 |
+
for(int i = 0; i < cl_int; i++) begin
|
| 23 |
+
cl_int_arr[i] = i + 1;
|
| 24 |
+
end
|
| 25 |
+
endfunction
|
| 26 |
+
|
| 27 |
+
endclass
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
class class_P extends uvm_object;
|
| 31 |
+
|
| 32 |
+
// basic datatypes
|
| 33 |
+
rand int par_int;
|
| 34 |
+
rand byte par_address;
|
| 35 |
+
string par_string;
|
| 36 |
+
|
| 37 |
+
// Some objects to demonstrate the copy recursion policy
|
| 38 |
+
|
| 39 |
+
class_A cl1; // UVM_SHALLOW
|
| 40 |
+
class_A cl3; // UVM_DEEP
|
| 41 |
+
|
| 42 |
+
`uvm_object_utils_begin(class_P)
|
| 43 |
+
`uvm_field_int(par_int,UVM_ALL_ON)
|
| 44 |
+
`uvm_field_int(par_address,UVM_ALL_ON | UVM_NOCOPY)
|
| 45 |
+
`uvm_field_string(par_string,UVM_NOCOPY)
|
| 46 |
+
`uvm_field_object(cl1,UVM_ALL_ON|UVM_NOCOPY)
|
| 47 |
+
`uvm_field_object(cl3,UVM_ALL_ON | UVM_NOCOPY)
|
| 48 |
+
`uvm_object_utils_end
|
| 49 |
+
|
| 50 |
+
function new(string name="");
|
| 51 |
+
super.new(name);
|
| 52 |
+
cl1 = new(name);
|
| 53 |
+
cl3 = new(name ) ;
|
| 54 |
+
par_string = name;
|
| 55 |
+
endfunction
|
| 56 |
+
|
| 57 |
+
function void do_copy(uvm_object rhs);
|
| 58 |
+
class_P rhs_;
|
| 59 |
+
super.do_copy(rhs);
|
| 60 |
+
$cast(rhs_,rhs);
|
| 61 |
+
par_int = rhs_.par_int;
|
| 62 |
+
par_address = rhs_.par_address;
|
| 63 |
+
par_string = rhs_.par_string;
|
| 64 |
+
cl1 = new rhs_.cl1;
|
| 65 |
+
cl3 = new rhs_.cl3;
|
| 66 |
+
cl1.copy(rhs_.cl1);
|
| 67 |
+
cl3.copy(rhs_.cl3);
|
| 68 |
+
endfunction
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
endclass
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
class_P class_P_inst1;
|
| 76 |
+
class_P class_P_inst2;
|
| 77 |
+
class_A class_A_inst1;
|
| 78 |
+
class_A class_A_inst2;
|
| 79 |
+
initial begin
|
| 80 |
+
// free children
|
| 81 |
+
class_A_inst1 = new("child_inst1");
|
| 82 |
+
class_A_inst2 = new("child_inst3");
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
class_P_inst1 = new("first_inst");
|
| 87 |
+
class_P_inst1.randomize();
|
| 88 |
+
class_P_inst1.print();
|
| 89 |
+
|
| 90 |
+
class_P_inst2 = new("second_inst");
|
| 91 |
+
class_P_inst2.randomize();
|
| 92 |
+
class_P_inst2.print();
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
class_P_inst2.copy(class_P_inst1);
|
| 96 |
+
class_P_inst2.print();
|
| 97 |
+
|
| 98 |
+
end
|
| 99 |
+
endmodule
|
Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_1/uvm_core_utilities/src/copy_ex.sv
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
module top;
|
| 2 |
+
`include "uvm_macros.svh"
|
| 3 |
+
import uvm_pkg::*;
|
| 4 |
+
typedef class class_A;
|
| 5 |
+
|
| 6 |
+
// Class definition
|
| 7 |
+
class class_A extends uvm_object;
|
| 8 |
+
|
| 9 |
+
int cl_int;
|
| 10 |
+
string cl_string;
|
| 11 |
+
int cl_int_arr[];
|
| 12 |
+
`uvm_object_utils_begin(class_A)
|
| 13 |
+
`uvm_field_int(cl_int,UVM_ALL_ON);
|
| 14 |
+
`uvm_field_string(cl_string,UVM_ALL_ON);
|
| 15 |
+
`uvm_field_array_int(cl_int_arr,UVM_ALL_ON);
|
| 16 |
+
`uvm_object_utils_end
|
| 17 |
+
|
| 18 |
+
function new(string name="");
|
| 19 |
+
super.new(name);
|
| 20 |
+
cl_string = name;
|
| 21 |
+
cl_int = 10;
|
| 22 |
+
cl_int_arr = new[cl_int];
|
| 23 |
+
for(int i = 0; i < cl_int; i++) begin
|
| 24 |
+
cl_int_arr[i] = i + 1;
|
| 25 |
+
end
|
| 26 |
+
endfunction
|
| 27 |
+
|
| 28 |
+
endclass
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
class class_P extends uvm_object;
|
| 32 |
+
|
| 33 |
+
// basic datatypes
|
| 34 |
+
rand int par_int;
|
| 35 |
+
rand byte par_address;
|
| 36 |
+
string par_string;
|
| 37 |
+
|
| 38 |
+
// Some objects to demonstrate the copy recursion policy
|
| 39 |
+
|
| 40 |
+
class_A cl1; // UVM_SHALLOW
|
| 41 |
+
class_A cl3; // UVM_DEEP
|
| 42 |
+
|
| 43 |
+
`uvm_object_utils_begin(class_P)
|
| 44 |
+
`uvm_field_int(par_int,UVM_ALL_ON)
|
| 45 |
+
`uvm_field_int(par_address,UVM_ALL_ON | UVM_NOCOPY)
|
| 46 |
+
`uvm_field_string(par_string,UVM_NOCOPY)
|
| 47 |
+
`uvm_field_object(cl1,UVM_ALL_ON|UVM_NOCOPY)
|
| 48 |
+
`uvm_field_object(cl3,UVM_ALL_ON | UVM_NOCOPY)
|
| 49 |
+
`uvm_object_utils_end
|
| 50 |
+
|
| 51 |
+
function new(string name="");
|
| 52 |
+
super.new(name);
|
| 53 |
+
cl1 = new(name);
|
| 54 |
+
cl3 = new(name);
|
| 55 |
+
par_string = name;
|
| 56 |
+
endfunction
|
| 57 |
+
|
| 58 |
+
function void do_copy(uvm_object rhs);
|
| 59 |
+
class_P rhs_;
|
| 60 |
+
super.do_copy(rhs);
|
| 61 |
+
$cast(rhs_,rhs);
|
| 62 |
+
par_int = rhs_.par_int;
|
| 63 |
+
par_address = rhs_.par_address;
|
| 64 |
+
par_string = rhs_.par_string;
|
| 65 |
+
cl1 = new rhs_.cl1;
|
| 66 |
+
cl3 = new rhs_.cl3;
|
| 67 |
+
cl1.copy(rhs_.cl1);
|
| 68 |
+
cl3.copy(rhs_.cl3);
|
| 69 |
+
endfunction
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
endclass
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
class_P class_P_inst1;
|
| 77 |
+
class_P class_P_inst2;
|
| 78 |
+
class_A class_A_inst1;
|
| 79 |
+
class_A class_A_inst2;
|
| 80 |
+
initial begin
|
| 81 |
+
// free children
|
| 82 |
+
class_A_inst1 = new("child_inst1");
|
| 83 |
+
class_A_inst2 = new("child_inst3");
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
class_P_inst1 = new("first_inst");
|
| 88 |
+
class_P_inst1.randomize();
|
| 89 |
+
class_P_inst1.print();
|
| 90 |
+
|
| 91 |
+
class_P_inst2 = new("second_inst");
|
| 92 |
+
class_P_inst2.randomize();
|
| 93 |
+
class_P_inst2.print();
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
class_P_inst2.copy(class_P_inst1);
|
| 97 |
+
class_P_inst2.print();
|
| 98 |
+
|
| 99 |
+
/*
|
| 100 |
+
class_A_inst1.randomize();
|
| 101 |
+
class_A_inst1.print();
|
| 102 |
+
class_A_inst2.randomize();
|
| 103 |
+
class_A_inst2.print();
|
| 104 |
+
class_A_inst2.copy(class_A_inst1);
|
| 105 |
+
class_A_inst1.print();
|
| 106 |
+
*/
|
| 107 |
+
|
| 108 |
+
end
|
| 109 |
+
endmodule
|
Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_1/uvm_core_utilities/src/copy_obj.sv
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
module top;
|
| 2 |
+
`include "uvm_macros.svh"
|
| 3 |
+
import uvm_pkg::*;
|
| 4 |
+
typedef class class_A;
|
| 5 |
+
|
| 6 |
+
`include "class4.sv"
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
class_P class_P_inst1;
|
| 10 |
+
class_P class_P_inst2;
|
| 11 |
+
class_A class_A_inst1;
|
| 12 |
+
class_A class_A_inst2;
|
| 13 |
+
|
| 14 |
+
class custom_comparer extends uvm_comparer;
|
| 15 |
+
|
| 16 |
+
int unsigned show_max = 10;
|
| 17 |
+
int unsigned verbosity = UVM_MEDIUM;
|
| 18 |
+
uvm_severity sev = UVM_FATAL;
|
| 19 |
+
string miscompares = " this is a extended miscompare:";
|
| 20 |
+
endclass
|
| 21 |
+
|
| 22 |
+
custom_comparer c_comp = new();
|
| 23 |
+
initial begin
|
| 24 |
+
// free children
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
class_P_inst1 = new ("class_Pass1",1);
|
| 28 |
+
class_P_inst2 = new ("class_Pass2",3);
|
| 29 |
+
|
| 30 |
+
// Custom Comparison:
|
| 31 |
+
|
| 32 |
+
class_P_inst1.randomize();
|
| 33 |
+
class_P_inst2.randomize();
|
| 34 |
+
|
| 35 |
+
class_P_inst2.copy(class_P_inst1);
|
| 36 |
+
|
| 37 |
+
class_P_inst2.compare(class_P_inst1);
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
end
|
| 41 |
+
endmodule
|
Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_1/uvm_core_utilities/src/listing_2.1.sv
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
class classA_cl extends uvm_object;
|
| 2 |
+
|
| 3 |
+
int addr;
|
| 4 |
+
int cl_int;
|
| 5 |
+
string cl_string;
|
| 6 |
+
int cl_int_arr[];
|
| 7 |
+
|
| 8 |
+
function new(string name="");
|
| 9 |
+
super.new(name);
|
| 10 |
+
cl_string = name;
|
| 11 |
+
cl_int = 10;
|
| 12 |
+
cl_int_arr = new[cl_int];
|
| 13 |
+
for(int i = 0; i < cl_int; i++) begin
|
| 14 |
+
cl_int_arr[i] = i + 1;
|
| 15 |
+
end
|
| 16 |
+
endfunction
|
| 17 |
+
endclass
|
Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_1/uvm_core_utilities/src/listing_2.10.sv
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
class class_B2 extends uvm_object;
|
| 2 |
+
|
| 3 |
+
// basic datatypes
|
| 4 |
+
rand int par_int;
|
| 5 |
+
rand byte par_address;
|
| 6 |
+
string par_string;
|
| 7 |
+
logic [3:0] bits_field;
|
| 8 |
+
|
| 9 |
+
// Some objects to demonstrate the copy recursion policy
|
| 10 |
+
|
| 11 |
+
child_cl cl1; // UVM_SHALLOW
|
| 12 |
+
child_cl cl3; // UVM_DEEP
|
| 13 |
+
|
| 14 |
+
`uvm_object_utils_begin(class_B2)
|
| 15 |
+
`uvm_field_int(par_int,UVM_DEFAULT|UVM_NOPACK)
|
| 16 |
+
`uvm_field_int(par_address,UVM_DEFAULT | UVM_NOCOPY|UVM_NOPACK)
|
| 17 |
+
`uvm_field_string(par_string,UVM_NOCOPY|UVM_NOPACK)
|
| 18 |
+
`uvm_field_object(cl1,UVM_DEFAULT|UVM_NOPACK)
|
| 19 |
+
`uvm_field_object(cl3,UVM_DEFAULT|UVM_SHALLOW|UVM_NOPACK)
|
| 20 |
+
`uvm_field_int(bits_field,UVM_DEFAULT|UVM_NOPACK)
|
| 21 |
+
`uvm_object_utils_end
|
| 22 |
+
|
| 23 |
+
function new(string name="");
|
| 24 |
+
super.new(name);
|
| 25 |
+
cl1 = new(name);
|
| 26 |
+
cl3 = new(name ) ;
|
| 27 |
+
par_string = name;
|
| 28 |
+
bits_field = inst_id;
|
| 29 |
+
endfunction
|
| 30 |
+
|
| 31 |
+
function void do_pack (uvm_packer packer);
|
| 32 |
+
super.do_pack(packer);
|
| 33 |
+
packer.pack_field_int(par_int,32);
|
| 34 |
+
packer.pack_field_int(par_address,8);
|
| 35 |
+
packer.pack_string(par_string);
|
| 36 |
+
packer.pack_object(cl1);
|
| 37 |
+
packer.pack_object(cl3);
|
| 38 |
+
packer.pack_field(bits_field,$bits(bits_field));
|
| 39 |
+
endfunction
|
| 40 |
+
|
| 41 |
+
function void do_unpack (uvm_packer packer);
|
| 42 |
+
super.do_unpack(packer);
|
| 43 |
+
par_int = packer.unpack_field_int(32);
|
| 44 |
+
par_address = packer.unpack_field_int(8);
|
| 45 |
+
par_string = packer.unpack_string(-1);
|
| 46 |
+
packer.unpack_object(cl1);
|
| 47 |
+
packer.unpack_object(cl3);
|
| 48 |
+
bits_field = packer.unpack_field($bits(bits_field));
|
| 49 |
+
endfunction
|
| 50 |
+
endclass
|
| 51 |
+
|
Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_1/uvm_core_utilities/src/listing_2.2.sv
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
class classB_cl extends uvm_object;
|
| 2 |
+
|
| 3 |
+
// basic datatypes
|
| 4 |
+
rand int par_int;
|
| 5 |
+
rand byte par_address;
|
| 6 |
+
string par_string;
|
| 7 |
+
|
| 8 |
+
// Some objects to demonstrate the copy recursion policy
|
| 9 |
+
|
| 10 |
+
classA_cl cl1; // UVM_SHALLOW
|
| 11 |
+
classA_cl cl3; // UVM_DEEP
|
| 12 |
+
|
| 13 |
+
function new(string name="");
|
| 14 |
+
super.new(name);
|
| 15 |
+
cl1 = new("cl1_inst");
|
| 16 |
+
cl3 = new("cl3_inst") ;
|
| 17 |
+
par_string = name;
|
| 18 |
+
endfunction
|
| 19 |
+
|
| 20 |
+
endclass
|
| 21 |
+
|
| 22 |
+
|
Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_1/uvm_core_utilities/src/new_packer.sv
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
module top;
|
| 3 |
+
import uvm_pkg::*;
|
| 4 |
+
|
| 5 |
+
// Class definition
|
| 6 |
+
class class_A extends uvm_object;
|
| 7 |
+
|
| 8 |
+
int cl_int;
|
| 9 |
+
string cl_string;
|
| 10 |
+
int cl_int_arr[];
|
| 11 |
+
longint unsigned logic_data[*];
|
| 12 |
+
|
| 13 |
+
`uvm_object_utils_begin(class_A)
|
| 14 |
+
`uvm_field_int(cl_int,UVM_ALL_ON)
|
| 15 |
+
`uvm_field_string(cl_string,UVM_ALL_ON)
|
| 16 |
+
`uvm_field_array_int(cl_int_arr,UVM_ALL_ON)
|
| 17 |
+
`uvm_field_aa_int_longint_unsigned(logic_data,UVM_ALL_ON)
|
| 18 |
+
`uvm_object_utils_end
|
| 19 |
+
|
| 20 |
+
function new(string name="");
|
| 21 |
+
int idx = 1;
|
| 22 |
+
super.new(name);
|
| 23 |
+
cl_string = name;
|
| 24 |
+
cl_int = 10;
|
| 25 |
+
cl_int_arr = new[cl_int];
|
| 26 |
+
for(int i = 0; i < cl_int; i++) begin
|
| 27 |
+
cl_int_arr[i] = i + 1;
|
| 28 |
+
end
|
| 29 |
+
repeat (16) begin
|
| 30 |
+
logic_data[idx] = idx;
|
| 31 |
+
idx = idx << 1;
|
| 32 |
+
end
|
| 33 |
+
endfunction
|
| 34 |
+
|
| 35 |
+
endclass
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
class class_P extends uvm_object;
|
| 39 |
+
|
| 40 |
+
// basic datatypes
|
| 41 |
+
rand int par_int;
|
| 42 |
+
rand byte par_address;
|
| 43 |
+
string par_string;
|
| 44 |
+
|
| 45 |
+
// Some objects to demonstrate the copy recursion policy
|
| 46 |
+
|
| 47 |
+
class_A cl1; // UVM_SHALLOW
|
| 48 |
+
class_A cl3; // UVM_DEEP
|
| 49 |
+
|
| 50 |
+
`uvm_object_utils_begin(class_P)
|
| 51 |
+
`uvm_field_int(par_int,UVM_ALL_ON)
|
| 52 |
+
`uvm_field_int(par_address,UVM_ALL_ON )
|
| 53 |
+
`uvm_field_string(par_string,UVM_NOCOPY)
|
| 54 |
+
`uvm_field_object(cl1,UVM_ALL_ON|UVM_NOCOPY)
|
| 55 |
+
`uvm_field_object(cl3,UVM_ALL_ON|UVM_REFERENCE)
|
| 56 |
+
`uvm_object_utils_end
|
| 57 |
+
|
| 58 |
+
function new(string name="");
|
| 59 |
+
super.new(name);
|
| 60 |
+
cl1 = new(name);
|
| 61 |
+
cl3 = new(name ) ;
|
| 62 |
+
par_string = name;
|
| 63 |
+
endfunction
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
function void do_copy(uvm_object rhs);
|
| 67 |
+
class_P rhs_;
|
| 68 |
+
super.do_copy(rhs);
|
| 69 |
+
$cast(rhs_,rhs);
|
| 70 |
+
cl1 = new rhs_.cl1;
|
| 71 |
+
cl3 = new rhs_.cl3;
|
| 72 |
+
endfunction
|
| 73 |
+
|
| 74 |
+
virtual function bit do_compare(uvm_object rhs, uvm_comparer comparer);
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
endfunction
|
| 78 |
+
endclass
|
| 79 |
+
|
| 80 |
+
class class_Pass2 extends uvm_object;
|
| 81 |
+
|
| 82 |
+
// basic datatypes
|
| 83 |
+
rand int par_int;
|
| 84 |
+
rand byte par_address;
|
| 85 |
+
string par_string;
|
| 86 |
+
|
| 87 |
+
// Some objects to demonstrate the copy recursion policy
|
| 88 |
+
|
| 89 |
+
class_A cl1; // UVM_SHALLOW
|
| 90 |
+
class_A cl3; // UVM_DEEP
|
| 91 |
+
|
| 92 |
+
`uvm_object_utils_begin(class_Pass2)
|
| 93 |
+
`uvm_field_int(par_int,UVM_ALL_ON)
|
| 94 |
+
`uvm_field_int(par_address,UVM_ALL_ON | UVM_NOCOPY)
|
| 95 |
+
`uvm_field_string(par_string,UVM_NOCOPY)
|
| 96 |
+
`uvm_field_object(cl1,UVM_ALL_ON)
|
| 97 |
+
`uvm_field_object(cl3,UVM_ALL_ON|UVM_SHALLOW)
|
| 98 |
+
`uvm_object_utils_end
|
| 99 |
+
|
| 100 |
+
function new(string name="");
|
| 101 |
+
super.new(name);
|
| 102 |
+
cl1 = new(name);
|
| 103 |
+
cl3 = new(name ) ;
|
| 104 |
+
par_string = name;
|
| 105 |
+
endfunction
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
function void do_copy(uvm_object rhs);
|
| 109 |
+
class_Pass2 rhs_;
|
| 110 |
+
super.do_copy(rhs);
|
| 111 |
+
$cast(rhs_,rhs);
|
| 112 |
+
par_int = rhs_.par_int;
|
| 113 |
+
par_address = rhs_.par_address;
|
| 114 |
+
par_string = rhs_.par_string;
|
| 115 |
+
cl1 = new rhs_.cl1;
|
| 116 |
+
cl3 = new rhs_.cl3;
|
| 117 |
+
endfunction
|
| 118 |
+
|
| 119 |
+
virtual function bit do_compare(uvm_object rhs, uvm_comparer comparer);
|
| 120 |
+
class_P rhs_;
|
| 121 |
+
do_compare = super.do_compare(rhs,comparer);
|
| 122 |
+
$cast(rhs_,rhs);
|
| 123 |
+
do_compare &= comparer.compare_field_int("par_int",par_int,rhs_.par_int,32,UVM_NORADIX);
|
| 124 |
+
do_compare &= comparer.compare_field_int("par_address",par_int,rhs_.par_int,32,UVM_NORADIX);
|
| 125 |
+
do_compare &= comparer.compare_string("par_string",par_string,rhs_.par_string);
|
| 126 |
+
do_compare &= comparer.compare_object("cl1",cl1,rhs_.cl1);
|
| 127 |
+
do_compare &= comparer.compare_object("cl1",cl3,rhs_.cl3);
|
| 128 |
+
endfunction
|
| 129 |
+
|
| 130 |
+
function void do_pack (uvm_packer packer);
|
| 131 |
+
super.do_pack(packer);
|
| 132 |
+
packer.pack_field_int(par_int,32);
|
| 133 |
+
packer.pack_field_int(par_address,8);
|
| 134 |
+
packer.pack_string(par_string);
|
| 135 |
+
packer.pack_object(cl1);
|
| 136 |
+
packer.pack_object(cl3);
|
| 137 |
+
endfunction
|
| 138 |
+
|
| 139 |
+
|
| 140 |
+
function void do_unpack (uvm_packer packer);
|
| 141 |
+
super.do_unpack(packer);
|
| 142 |
+
par_int = packer.unpack_field_int(32);
|
| 143 |
+
par_address = packer.unpack_field_int(8);
|
| 144 |
+
par_string = packer.unpack_string(par_string);
|
| 145 |
+
packer.unpack_object(cl1);
|
| 146 |
+
packer.unpack_object(cl3);
|
| 147 |
+
endfunction
|
| 148 |
+
endclass
|
| 149 |
+
|
| 150 |
+
|
| 151 |
+
bit pack_bytes[];
|
| 152 |
+
class_P class_P_inst1;
|
| 153 |
+
class_P class_P_inst2;
|
| 154 |
+
initial begin
|
| 155 |
+
// free children
|
| 156 |
+
|
| 157 |
+
class_P_inst1 = new("first_inst");
|
| 158 |
+
class_P_inst1.randomize();
|
| 159 |
+
class_P_inst1.print();
|
| 160 |
+
|
| 161 |
+
uvm_default_packer.use_metadata = 1;
|
| 162 |
+
class_P_inst1.pack(pack_bytes);
|
| 163 |
+
|
| 164 |
+
|
| 165 |
+
class_P_inst2 = new("second_inst");
|
| 166 |
+
// class_P_inst2.randomize();
|
| 167 |
+
class_P_inst2.print();
|
| 168 |
+
|
| 169 |
+
class_P_inst2.unpack(pack_bytes);
|
| 170 |
+
class_P_inst2.print();
|
| 171 |
+
|
| 172 |
+
|
| 173 |
+
end
|
| 174 |
+
endmodule
|
| 175 |
+
|
| 176 |
+
|
Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_1/uvm_core_utilities/src/print.sv
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
module top;
|
| 3 |
+
import uvm_pkg::*;
|
| 4 |
+
`include "class.sv"
|
| 5 |
+
|
| 6 |
+
uvm_line_printer local_line_printer = new;
|
| 7 |
+
uvm_tree_printer local_tree_printer = new;
|
| 8 |
+
uvm_table_printer local_table_printer = new;
|
| 9 |
+
UVM_FILE myfile;
|
| 10 |
+
|
| 11 |
+
class_A cl1 = new("Child Class");
|
| 12 |
+
initial begin
|
| 13 |
+
myfile = $fopen("Data","w");
|
| 14 |
+
//uvm_default_printer = uvm_default_table_printer; //default, so not needed.
|
| 15 |
+
cl1.print();
|
| 16 |
+
uvm_default_printer = uvm_default_line_printer;
|
| 17 |
+
cl1.print();
|
| 18 |
+
uvm_default_printer = uvm_default_tree_printer;
|
| 19 |
+
cl1.print();
|
| 20 |
+
local_table_printer.knobs.type_width = 20;
|
| 21 |
+
local_table_printer.knobs.header = 1;
|
| 22 |
+
local_table_printer.knobs.value_width = 20;
|
| 23 |
+
local_table_printer.knobs.mcd = myfile;
|
| 24 |
+
cl1.print(local_table_printer);
|
| 25 |
+
end
|
| 26 |
+
endmodule
|
| 27 |
+
|
| 28 |
+
|
Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/README.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
This example is the main example upon which all the files are patterned.
|
| 2 |
+
So I have marked all the files in this example as being important.
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
*************************************************************
|
| 7 |
+
STEPS TO COMPILE AND RUN EXAMPLE
|
| 8 |
+
*************************************************************
|
| 9 |
+
|
| 10 |
+
Note:
|
| 11 |
+
1) To include the UVM1.2 inbuilt source from VCS installation:
|
| 12 |
+
Inclusion of UVM_HOME can be replaced by -ntb_opts uvm command in Makefile
|
| 13 |
+
2) To use the UVM source other than VCS installation directory:
|
| 14 |
+
Set environment variable VCS_UVM_HOME to the uvm-1.2 installation directory
|
| 15 |
+
|
| 16 |
+
*************************************************************
|
| 17 |
+
Directory Structure of environment generated by UVMGEN
|
| 18 |
+
*************************************************************
|
| 19 |
+
-EXAMPLE
|
| 20 |
+
|
|
| 21 |
+
-README.md ( This file)
|
| 22 |
+
|
|
| 23 |
+
-hdl/ ---> includes top module and inclusion of all environment files.
|
| 24 |
+
|
|
| 25 |
+
| - wb_env_top.sv -- Top level file that instantiates everything
|
| 26 |
+
| - dut.v -- Dummy DUT
|
| 27 |
+
|
|
| 28 |
+
-env/ ---> includes environment related files (environment, ralenv)
|
| 29 |
+
|
|
| 30 |
+
| - wb_slave_agent.sv -- top level slave agent file
|
| 31 |
+
| - wb_master_agent.sv -- top level master agent file
|
| 32 |
+
| - wb_env_env.sv -- the complete environment
|
| 33 |
+
|
|
| 34 |
+
-include/
|
| 35 |
+
|
|
| 36 |
+
-src/ ---> includes Transaction, configurations, driver, monitor, master/slave subenv, scoreboard, coverage related files.
|
| 37 |
+
|
|
| 38 |
+
| - wb_slave.sv --- Slave driver
|
| 39 |
+
| - wb_slave_mon.sv -- Slave monitor
|
| 40 |
+
| - wb_slave_if.sv -- slave interface
|
| 41 |
+
| - wb_transaction.sv -- transaction class
|
| 42 |
+
| - wb_slave_seqr.sv -- Slave Sequencer. This is not used in this example
|
| 43 |
+
| - wb_master.sv -- master driver
|
| 44 |
+
| - wb_master_seqr.sv -- master sequencer
|
| 45 |
+
| - wb_master_agent_sequence_library.sv -- All the sequences for the master are HERE
|
| 46 |
+
| - wb_master_if.sv -- master interface
|
| 47 |
+
| - wb_master_mon.sv -- master monitor
|
| 48 |
+
| - wb_env_cov.sv -- coverage
|
| 49 |
+
| - wb_env_cfg.sv -- env config class as an example. Not used much in the example
|
| 50 |
+
|
|
| 51 |
+
-tests/ ---> includes testbench module and testcases
|
| 52 |
+
|
|
| 53 |
+
| - wb_env_tb_mod.sv
|
| 54 |
+
| - wb_env_test.sv --- This is the actual test you need to look at
|
| 55 |
+
|
|
| 56 |
+
-run/ ---> Makefile
|
| 57 |
+
| - Makefile
|
| 58 |
+
| - simv.log -- run log file
|
| 59 |
+
| - vcs.log -- compile log file
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
|
Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/env/wb_env_env.sv
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`ifndef WB_ENV_ENV__SV
|
| 2 |
+
`define WB_ENV_ENV__SV
|
| 3 |
+
`include "wb_env.sv"
|
| 4 |
+
class wb_env_env extends uvm_env;
|
| 5 |
+
wb_master_agent master_agent;
|
| 6 |
+
wb_slave_agent slave_agent;
|
| 7 |
+
wb_env_cov cov;
|
| 8 |
+
|
| 9 |
+
wb_master_mon_2cov_connect mon2cov;
|
| 10 |
+
wb_scoreboard sb;
|
| 11 |
+
`uvm_component_utils(wb_env_env)
|
| 12 |
+
|
| 13 |
+
extern function new(string name="wb_env_env", uvm_component parent=null);
|
| 14 |
+
extern virtual function void build_phase(uvm_phase phase);
|
| 15 |
+
extern virtual function void connect_phase(uvm_phase phase);
|
| 16 |
+
extern virtual function void report_phase(uvm_phase phase);
|
| 17 |
+
|
| 18 |
+
endclass: wb_env_env
|
| 19 |
+
|
| 20 |
+
function wb_env_env::new(string name= "wb_env_env",uvm_component parent=null);
|
| 21 |
+
super.new(name,parent);
|
| 22 |
+
endfunction:new
|
| 23 |
+
|
| 24 |
+
function void wb_env_env::build_phase(uvm_phase phase);
|
| 25 |
+
super.build_phase(phase);
|
| 26 |
+
master_agent = wb_master_agent::type_id::create("master_agent",this);
|
| 27 |
+
slave_agent = wb_slave_agent::type_id::create("slave_agent",this);
|
| 28 |
+
|
| 29 |
+
cov = wb_env_cov::type_id::create("cov",this); //Instantiating the coverage class
|
| 30 |
+
|
| 31 |
+
mon2cov = wb_master_mon_2cov_connect::type_id::create("mon2cov", this);
|
| 32 |
+
mon2cov.cov = cov;
|
| 33 |
+
sb = wb_scoreboard::type_id::create("sb",this);
|
| 34 |
+
|
| 35 |
+
endfunction: build_phase
|
| 36 |
+
|
| 37 |
+
function void wb_env_env::connect_phase(uvm_phase phase);
|
| 38 |
+
super.connect_phase(phase);
|
| 39 |
+
master_agent.mast_mon.mon_analysis_port.connect(cov.cov_export);
|
| 40 |
+
master_agent.mast_mon.mon_analysis_port.connect(sb.expected_wb_transaction_fifo.analysis_export);
|
| 41 |
+
slave_agent.slv_mon.mon_analysis_port.connect(sb.actual_wb_transaction_fifo.analysis_export);
|
| 42 |
+
|
| 43 |
+
endfunction: connect_phase
|
| 44 |
+
|
| 45 |
+
function void wb_env_env::report_phase(uvm_phase phase);
|
| 46 |
+
super.report_phase(phase);
|
| 47 |
+
endfunction:report_phase
|
| 48 |
+
|
| 49 |
+
`endif // WB_ENV_ENV__SV
|
| 50 |
+
|
Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/env/wb_master_agent.sv
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//
|
| 2 |
+
// Template for UVM-compliant generic master agent
|
| 3 |
+
//
|
| 4 |
+
|
| 5 |
+
`ifndef WB_MASTER_AGENT__SV
|
| 6 |
+
`define WB_MASTER_AGENT__SV
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
class wb_master_agent extends uvm_agent;
|
| 10 |
+
// ToDo: add uvm agent properties here
|
| 11 |
+
protected uvm_active_passive_enum is_active = UVM_ACTIVE;
|
| 12 |
+
wb_master_seqr mast_sqr;
|
| 13 |
+
wb_master mast_drv;
|
| 14 |
+
wb_master_mon mast_mon;
|
| 15 |
+
typedef virtual wb_master_if vif;
|
| 16 |
+
vif mast_agt_if;
|
| 17 |
+
wb_config mstr_agent_cfg;
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
`uvm_component_utils_begin(wb_master_agent)
|
| 21 |
+
`uvm_field_object(mast_sqr, UVM_DEFAULT)
|
| 22 |
+
`uvm_field_object(mast_drv, UVM_DEFAULT)
|
| 23 |
+
`uvm_field_object(mast_mon, UVM_DEFAULT)
|
| 24 |
+
`uvm_field_object (mstr_agent_cfg,UVM_DEFAULT)
|
| 25 |
+
`uvm_component_utils_end
|
| 26 |
+
|
| 27 |
+
// ToDo: Add required short hand override method
|
| 28 |
+
|
| 29 |
+
function new(string name = "mast_agt", uvm_component parent = null);
|
| 30 |
+
super.new(name, parent);
|
| 31 |
+
endfunction
|
| 32 |
+
|
| 33 |
+
virtual function void build_phase(uvm_phase phase);
|
| 34 |
+
super.build_phase(phase);
|
| 35 |
+
uvm_config_db #(wb_config)::get(this, "", "config", mstr_agent_cfg);
|
| 36 |
+
|
| 37 |
+
mast_mon = wb_master_mon::type_id::create("mast_mon", this);
|
| 38 |
+
if (is_active == UVM_ACTIVE) begin
|
| 39 |
+
mast_sqr = wb_master_seqr::type_id::create("mast_sqr", this);
|
| 40 |
+
mast_drv = wb_master::type_id::create("mast_drv", this);
|
| 41 |
+
mast_drv.mstr_drv_cfg = mstr_agent_cfg;
|
| 42 |
+
mast_sqr.cfg = mstr_agent_cfg;
|
| 43 |
+
mast_mon.mstr_mon_cfg = mstr_agent_cfg;
|
| 44 |
+
|
| 45 |
+
end
|
| 46 |
+
if (!uvm_config_db#(vif)::get(this, "", "mst_if", mast_agt_if)) begin
|
| 47 |
+
`uvm_fatal("AGT/NOVIF", "No virtual interface specified for this agent instance Master Agent")
|
| 48 |
+
end
|
| 49 |
+
uvm_config_db# (vif)::set(this,"mast_drv","mst_if",mast_agt_if);
|
| 50 |
+
uvm_config_db# (vif)::set(this,"mast_mon","mon_if",mast_agt_if);
|
| 51 |
+
|
| 52 |
+
// Now getting the configuration
|
| 53 |
+
endfunction: build_phase
|
| 54 |
+
|
| 55 |
+
virtual function void connect_phase(uvm_phase phase);
|
| 56 |
+
super.connect_phase(phase);
|
| 57 |
+
if (is_active == UVM_ACTIVE) begin
|
| 58 |
+
mast_drv.seq_item_port.connect(mast_sqr.seq_item_export);
|
| 59 |
+
end
|
| 60 |
+
endfunction
|
| 61 |
+
|
| 62 |
+
virtual task run_phase(uvm_phase phase);
|
| 63 |
+
super.run_phase(phase);
|
| 64 |
+
phase.raise_objection(this,"master_agt_run");
|
| 65 |
+
|
| 66 |
+
//ToDo :: Implement here
|
| 67 |
+
|
| 68 |
+
phase.drop_objection(this);
|
| 69 |
+
endtask
|
| 70 |
+
|
| 71 |
+
virtual function void report_phase(uvm_phase phase);
|
| 72 |
+
super.report_phase(phase);
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
endfunction
|
| 76 |
+
|
| 77 |
+
endclass: wb_master_agent
|
| 78 |
+
|
| 79 |
+
`endif // WB_MASTER_AGENT__SV
|
| 80 |
+
|
Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/env/wb_slave_agent.sv
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`ifndef WB_SLAVE_AGENT__SV
|
| 2 |
+
`define WB_SLAVE_AGENT__SV
|
| 3 |
+
|
| 4 |
+
typedef class wb_slave_seqr;
|
| 5 |
+
class wb_slave_agent extends uvm_agent;
|
| 6 |
+
protected uvm_active_passive_enum is_active = UVM_ACTIVE;
|
| 7 |
+
wb_slave slv_drv;
|
| 8 |
+
wb_slave_mon slv_mon;
|
| 9 |
+
wb_slave_seqr slv_seqr;
|
| 10 |
+
typedef virtual wb_slave_if vif;
|
| 11 |
+
vif slv_agt_if;
|
| 12 |
+
|
| 13 |
+
wb_config slv_agent_cfg;
|
| 14 |
+
|
| 15 |
+
`uvm_component_utils_begin(wb_slave_agent)
|
| 16 |
+
`uvm_field_object(slv_seqr, UVM_DEFAULT)
|
| 17 |
+
`uvm_field_object(slv_drv, UVM_DEFAULT)
|
| 18 |
+
`uvm_field_object(slv_mon, UVM_DEFAULT)
|
| 19 |
+
`uvm_component_utils_end
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
function new(string name = "slv_agt", uvm_component parent = null);
|
| 23 |
+
super.new(name, parent);
|
| 24 |
+
endfunction
|
| 25 |
+
|
| 26 |
+
virtual function void build_phase(uvm_phase phase);
|
| 27 |
+
super.build_phase(phase);
|
| 28 |
+
uvm_config_db #(wb_config)::get(this, "", "config", slv_agent_cfg);
|
| 29 |
+
|
| 30 |
+
slv_mon = wb_slave_mon::type_id::create("slv_mon", this);
|
| 31 |
+
if (is_active == UVM_ACTIVE) begin
|
| 32 |
+
slv_seqr = wb_slave_seqr::type_id::create("slv_seqr",this);
|
| 33 |
+
slv_drv = wb_slave::type_id::create("slv_drv", this);
|
| 34 |
+
slv_drv.wb_slave_cfg = slv_agent_cfg;
|
| 35 |
+
slv_mon.slv_mon_cfg = slv_agent_cfg;
|
| 36 |
+
end
|
| 37 |
+
if (!uvm_config_db#(vif)::get(this, "", "slv_if", slv_agt_if)) begin
|
| 38 |
+
`uvm_fatal("AGT/NOVIF", "No virtual interface specified for this agent instance")
|
| 39 |
+
end
|
| 40 |
+
uvm_config_db# (vif)::set(this,"slv_drv","slv_if",slv_agt_if);
|
| 41 |
+
uvm_config_db# (vif)::set(this,"slv_mon","mon_if",slv_agt_if);
|
| 42 |
+
endfunction: build_phase
|
| 43 |
+
|
| 44 |
+
virtual function void connect_phase(uvm_phase phase);
|
| 45 |
+
super.connect_phase(phase);
|
| 46 |
+
if (is_active == UVM_ACTIVE) begin
|
| 47 |
+
slv_drv.seq_item_port.connect(slv_seqr.seq_item_export);
|
| 48 |
+
slv_seqr.m_getp.connect(slv_drv.getp);
|
| 49 |
+
end
|
| 50 |
+
endfunction
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
virtual task run_phase(uvm_phase phase);
|
| 54 |
+
super.run_phase(phase);
|
| 55 |
+
phase.raise_objection(this,"slv_agt_main");
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
phase.drop_objection(this);
|
| 59 |
+
endtask
|
| 60 |
+
|
| 61 |
+
virtual function void report_phase(uvm_phase phase);
|
| 62 |
+
super.report_phase(phase);
|
| 63 |
+
endfunction
|
| 64 |
+
|
| 65 |
+
endclass: wb_slave_agent
|
| 66 |
+
|
| 67 |
+
`endif // WB_SLAVE_AGENT__SV
|
Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/hdl/design.sv
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
`include "wb_master_if.sv"
|
| 3 |
+
`include "wb_slave_if.sv"
|
| 4 |
+
`ifndef WB_ENV_TOP__SV
|
| 5 |
+
`define WB_ENV_TOP__SV
|
| 6 |
+
|
| 7 |
+
module wb_env_top_mod();
|
| 8 |
+
|
| 9 |
+
logic clk;
|
| 10 |
+
logic rst;
|
| 11 |
+
|
| 12 |
+
// Clock Generation
|
| 13 |
+
parameter sim_cycle = 10;
|
| 14 |
+
// Reset Delay Parameter
|
| 15 |
+
parameter rst_delay = 5;
|
| 16 |
+
initial begin
|
| 17 |
+
clk = 0;
|
| 18 |
+
forever clk = #(sim_cycle/2) ~clk;
|
| 19 |
+
#10000 $finish;
|
| 20 |
+
end
|
| 21 |
+
|
| 22 |
+
wb_master_if mast_if(clk,rst);
|
| 23 |
+
wb_slave_if slave_if(clk,rst);
|
| 24 |
+
|
| 25 |
+
wb_env_tb_mod test();
|
| 26 |
+
|
| 27 |
+
dut dut(mast_if,slave_if);
|
| 28 |
+
|
| 29 |
+
//Driver reset depending on rst_delay
|
| 30 |
+
initial
|
| 31 |
+
begin
|
| 32 |
+
clk = 0;
|
| 33 |
+
rst = 0;
|
| 34 |
+
#1 rst = 1;
|
| 35 |
+
repeat (rst_delay) @(clk);
|
| 36 |
+
rst = 1'b0;
|
| 37 |
+
@(clk);
|
| 38 |
+
end
|
| 39 |
+
|
| 40 |
+
endmodule: wb_env_top_mod
|
| 41 |
+
|
| 42 |
+
`endif // WB_ENV_TOP__SV
|
| 43 |
+
|
| 44 |
+
module dut(wb_master_if mast_if, wb_slave_if slave_if);
|
| 45 |
+
|
| 46 |
+
assign slave_if.CYC_I = mast_if.CYC_O;
|
| 47 |
+
|
| 48 |
+
assign slave_if.DAT_I = mast_if.DAT_O;
|
| 49 |
+
assign mast_if.DAT_I = slave_if.DAT_O;
|
| 50 |
+
|
| 51 |
+
assign slave_if.TGD_I = mast_if.TGD_O;
|
| 52 |
+
assign mast_if.TGD_I = slave_if.TGD_O;
|
| 53 |
+
|
| 54 |
+
assign mast_if.ACK_I = slave_if.ACK_O;
|
| 55 |
+
|
| 56 |
+
assign slave_if.ADR_I = mast_if.ADR_O;
|
| 57 |
+
assign mast_if.ERR_I = slave_if.ERR_O;
|
| 58 |
+
assign slave_if.LOCK_I = mast_if.LOCK_O;
|
| 59 |
+
assign slave_if.SEL_I = mast_if.SEL_O;
|
| 60 |
+
assign slave_if.STB_I = mast_if.STB_O;
|
| 61 |
+
assign slave_if.TGA_I = mast_if.TGA_O;
|
| 62 |
+
assign slave_if.TGC_I = mast_if.TGC_O;
|
| 63 |
+
assign slave_if.WE_I = mast_if.WE_O;
|
| 64 |
+
assign mast_if.RTY_I = slave_if.RTY_O;
|
| 65 |
+
assign mast_if.RST_I = 1;
|
| 66 |
+
assign slave_if.RST_I = 1;
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
endmodule
|
| 70 |
+
*/
|
| 71 |
+
// Code your design here
|
Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/hdl/dut2.sv
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
module dut(wb_master_if mast_if, wb_slave_if slave_if);
|
| 2 |
+
|
| 3 |
+
assign slave_if.CYC_I = mast_if.CYC_O;
|
| 4 |
+
|
| 5 |
+
assign slave_if.DAT_I = mast_if.DAT_O;
|
| 6 |
+
assign mast_if.DAT_I = slave_if.DAT_O;
|
| 7 |
+
|
| 8 |
+
assign slave_if.TGD_I = mast_if.TGD_O;
|
| 9 |
+
assign mast_if.TGD_I = slave_if.TGD_O;
|
| 10 |
+
|
| 11 |
+
assign mast_if.ACK_I = slave_if.ACK_O;
|
| 12 |
+
|
| 13 |
+
assign slave_if.ADR_I = mast_if.ADR_O;
|
| 14 |
+
assign mast_if.ERR_I = slave_if.ERR_O;
|
| 15 |
+
assign slave_if.LOCK_I = mast_if.LOCK_O;
|
| 16 |
+
assign slave_if.SEL_I = mast_if.SEL_O;
|
| 17 |
+
assign slave_if.STB_I = mast_if.STB_O;
|
| 18 |
+
assign slave_if.TGA_I = mast_if.TGA_O;
|
| 19 |
+
assign slave_if.TGC_I = mast_if.TGC_O;
|
| 20 |
+
assign slave_if.WE_I = mast_if.WE_O;
|
| 21 |
+
assign mast_if.RTY_I = slave_if.RTY_O;
|
| 22 |
+
assign mast_if.RST_I = 1;
|
| 23 |
+
assign slave_if.RST_I = 1;
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
endmodule
|
| 27 |
+
// Code your design here
|
Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/hdl/wb_env_top.sv
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`include "wb_master_if.sv"
|
| 2 |
+
`include "wb_slave_if.sv"
|
| 3 |
+
`ifndef WB_ENV_TOP__SV
|
| 4 |
+
`define WB_ENV_TOP__SV
|
| 5 |
+
|
| 6 |
+
module wb_env_top_mod();
|
| 7 |
+
|
| 8 |
+
logic clk;
|
| 9 |
+
logic rst;
|
| 10 |
+
|
| 11 |
+
// Clock Generation
|
| 12 |
+
parameter sim_cycle = 10;
|
| 13 |
+
// Reset Delay Parameter
|
| 14 |
+
parameter rst_delay = 5;
|
| 15 |
+
initial begin
|
| 16 |
+
clk = 0;
|
| 17 |
+
forever clk = #(sim_cycle/2) ~clk;
|
| 18 |
+
#10000 $finish;
|
| 19 |
+
end
|
| 20 |
+
|
| 21 |
+
wb_master_if mast_if(clk,rst);
|
| 22 |
+
wb_slave_if slave_if(clk,rst);
|
| 23 |
+
|
| 24 |
+
wb_env_tb_mod test();
|
| 25 |
+
|
| 26 |
+
dut dut(mast_if,slave_if);
|
| 27 |
+
|
| 28 |
+
//Driver reset depending on rst_delay
|
| 29 |
+
initial
|
| 30 |
+
begin
|
| 31 |
+
clk = 0;
|
| 32 |
+
rst = 0;
|
| 33 |
+
#1 rst = 1;
|
| 34 |
+
repeat (rst_delay) @(clk);
|
| 35 |
+
rst = 1'b0;
|
| 36 |
+
@(clk);
|
| 37 |
+
end
|
| 38 |
+
|
| 39 |
+
endmodule: wb_env_top_mod
|
| 40 |
+
|
| 41 |
+
`endif // WB_ENV_TOP__SV
|
| 42 |
+
|
Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/include/wb_env.sv
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//
|
| 2 |
+
// Template for UVM-compliant verification environment
|
| 3 |
+
//
|
| 4 |
+
|
| 5 |
+
`ifndef WB_ENV__SV
|
| 6 |
+
`define WB_ENV__SV
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
`include "mstr_slv_src.incl"
|
| 12 |
+
|
| 13 |
+
`include "wb_env_cfg.sv"
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
`include "wb_env_cov.sv"
|
| 18 |
+
|
| 19 |
+
`include "mon_2cov.sv"
|
| 20 |
+
`include "wb_scoreboard.sv"
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
// ToDo: Add additional required `include directives
|
| 24 |
+
|
| 25 |
+
`endif // WB_ENV__SV
|
Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/run/vc_hdrs.h
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef _GNU_SOURCE
|
| 2 |
+
#define _GNU_SOURCE
|
| 3 |
+
#endif
|
| 4 |
+
#include <stdio.h>
|
| 5 |
+
#include <dlfcn.h>
|
| 6 |
+
#include "svdpi.h"
|
| 7 |
+
|
| 8 |
+
#ifdef __cplusplus
|
| 9 |
+
extern "C" {
|
| 10 |
+
#endif
|
| 11 |
+
|
| 12 |
+
#ifndef _VC_TYPES_
|
| 13 |
+
#define _VC_TYPES_
|
| 14 |
+
/* common definitions shared with DirectC.h */
|
| 15 |
+
|
| 16 |
+
typedef unsigned int U;
|
| 17 |
+
typedef unsigned char UB;
|
| 18 |
+
typedef unsigned char scalar;
|
| 19 |
+
typedef struct { U c; U d;} vec32;
|
| 20 |
+
|
| 21 |
+
#define scalar_0 0
|
| 22 |
+
#define scalar_1 1
|
| 23 |
+
#define scalar_z 2
|
| 24 |
+
#define scalar_x 3
|
| 25 |
+
|
| 26 |
+
extern long long int ConvUP2LLI(U* a);
|
| 27 |
+
extern void ConvLLI2UP(long long int a1, U* a2);
|
| 28 |
+
extern long long int GetLLIresult();
|
| 29 |
+
extern void StoreLLIresult(const unsigned int* data);
|
| 30 |
+
typedef struct VeriC_Descriptor *vc_handle;
|
| 31 |
+
|
| 32 |
+
#ifndef SV_3_COMPATIBILITY
|
| 33 |
+
#define SV_STRING const char*
|
| 34 |
+
#else
|
| 35 |
+
#define SV_STRING char*
|
| 36 |
+
#endif
|
| 37 |
+
|
| 38 |
+
#endif /* _VC_TYPES_ */
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
extern int uvm_hdl_check_path(/* INPUT */const char* path);
|
| 42 |
+
|
| 43 |
+
extern int uvm_hdl_deposit(/* INPUT */const char* path, const /* INPUT */svLogicVecVal *value);
|
| 44 |
+
|
| 45 |
+
extern int uvm_hdl_force(/* INPUT */const char* path, const /* INPUT */svLogicVecVal *value);
|
| 46 |
+
|
| 47 |
+
extern int uvm_hdl_release_and_read(/* INPUT */const char* path, /* INOUT */svLogicVecVal *value);
|
| 48 |
+
|
| 49 |
+
extern int uvm_hdl_release(/* INPUT */const char* path);
|
| 50 |
+
|
| 51 |
+
extern int uvm_hdl_read(/* INPUT */const char* path, /* OUTPUT */svLogicVecVal *value);
|
| 52 |
+
|
| 53 |
+
extern SV_STRING uvm_dpi_get_next_arg_c(/* INPUT */int init);
|
| 54 |
+
|
| 55 |
+
extern SV_STRING uvm_dpi_get_tool_name_c();
|
| 56 |
+
|
| 57 |
+
extern SV_STRING uvm_dpi_get_tool_version_c();
|
| 58 |
+
|
| 59 |
+
extern void* uvm_dpi_regcomp(/* INPUT */const char* regex);
|
| 60 |
+
|
| 61 |
+
extern int uvm_dpi_regexec(/* INPUT */void* preg, /* INPUT */const char* str);
|
| 62 |
+
|
| 63 |
+
extern void uvm_dpi_regfree(/* INPUT */void* preg);
|
| 64 |
+
|
| 65 |
+
extern int uvm_re_match(/* INPUT */const char* re, /* INPUT */const char* str);
|
| 66 |
+
|
| 67 |
+
extern void uvm_dump_re_cache();
|
| 68 |
+
|
| 69 |
+
extern SV_STRING uvm_glob_to_re(/* INPUT */const char* glob);
|
| 70 |
+
|
| 71 |
+
extern void m__uvm_report_dpi(/* INPUT */int severity, /* INPUT */const char* id, /* INPUT */const char* message, /* INPUT */int verbosity, /* INPUT */const char* filename, /* INPUT */int line);
|
| 72 |
+
void SdisableFork();
|
| 73 |
+
|
| 74 |
+
#ifdef __cplusplus
|
| 75 |
+
}
|
| 76 |
+
#endif
|
| 77 |
+
|
Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/src/mon_2cov.sv
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//
|
| 2 |
+
// Template for UVM-compliant Monitor to Coverage Connector Callbacks
|
| 3 |
+
//
|
| 4 |
+
|
| 5 |
+
`ifndef WB_MASTER_MON_2COV_CONNECT
|
| 6 |
+
`define WB_MASTER_MON_2COV_CONNECT
|
| 7 |
+
class wb_master_mon_2cov_connect extends uvm_component;
|
| 8 |
+
wb_env_cov cov;
|
| 9 |
+
uvm_analysis_export # (wb_transaction) an_exp;
|
| 10 |
+
`uvm_component_utils(wb_master_mon_2cov_connect)
|
| 11 |
+
function new(string name="", uvm_component parent=null);
|
| 12 |
+
super.new(name, parent);
|
| 13 |
+
endfunction: new
|
| 14 |
+
|
| 15 |
+
virtual function void write(wb_transaction tr);
|
| 16 |
+
cov.tr = tr;
|
| 17 |
+
-> cov.cov_event;
|
| 18 |
+
endfunction:write
|
| 19 |
+
endclass: wb_master_mon_2cov_connect
|
| 20 |
+
|
| 21 |
+
`endif // WB_MASTER_MON_2COV_CONNECT
|
Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/src/wb_config.sv
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`ifndef WB_CONFIG
|
| 2 |
+
`define WB_CONFIG
|
| 3 |
+
class wb_config extends uvm_object;
|
| 4 |
+
|
| 5 |
+
bit enable_coverage; // Enable coverage from monitor
|
| 6 |
+
|
| 7 |
+
typedef enum {BYTE, WORD, DWORD, QWORD} sizes_e;
|
| 8 |
+
rand sizes_e port_size;
|
| 9 |
+
rand sizes_e granularity;
|
| 10 |
+
|
| 11 |
+
typedef enum {CLASSIC, REGISTERED} cycle_types_e;
|
| 12 |
+
rand cycle_types_e cycles;
|
| 13 |
+
|
| 14 |
+
rand integer max_n_wss;
|
| 15 |
+
|
| 16 |
+
rand bit [63:0] min_addr;
|
| 17 |
+
rand bit [63:0] max_addr;
|
| 18 |
+
|
| 19 |
+
constraint wb_slave_cfg_valid {
|
| 20 |
+
max_addr >= min_addr;
|
| 21 |
+
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
constraint wb_cfg_valid {
|
| 25 |
+
granularity <= port_size;
|
| 26 |
+
max_n_wss >= 0;
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
constraint reasonable_max_n_wss {
|
| 30 |
+
max_n_wss == 10;
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
constraint supported {
|
| 34 |
+
port_size == DWORD;
|
| 35 |
+
granularity == BYTE;
|
| 36 |
+
cycles == CLASSIC;
|
| 37 |
+
}
|
| 38 |
+
`uvm_object_utils_begin(wb_config); // All we need is it registerd with factory
|
| 39 |
+
`uvm_field_enum(sizes_e,port_size,UVM_DEFAULT)
|
| 40 |
+
`uvm_field_enum(sizes_e,granularity,UVM_DEFAULT)
|
| 41 |
+
`uvm_field_enum(cycle_types_e,cycles,UVM_DEFAULT)
|
| 42 |
+
`uvm_field_int(max_n_wss,UVM_DEFAULT)
|
| 43 |
+
`uvm_field_int(min_addr,UVM_DEFAULT)
|
| 44 |
+
`uvm_field_int(max_addr,UVM_DEFAULT)
|
| 45 |
+
`uvm_object_utils_end
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
function new(string name = "");
|
| 49 |
+
super.new(name);
|
| 50 |
+
endfunction
|
| 51 |
+
|
| 52 |
+
endclass
|
| 53 |
+
`endif
|
Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/src/wb_env_cfg.sv
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`ifndef WB_ENV_CFG__SV
|
| 2 |
+
`define WB_ENV_CFG__SV
|
| 3 |
+
|
| 4 |
+
class wb_env_cfg extends uvm_object;
|
| 5 |
+
|
| 6 |
+
// Define test configuration parameters (e.g. how long to run)
|
| 7 |
+
rand int num_trans;
|
| 8 |
+
rand int num_scen;
|
| 9 |
+
// ToDo: Add other environment configuration varaibles
|
| 10 |
+
|
| 11 |
+
constraint cst_num_trans_default {
|
| 12 |
+
num_trans inside {[1:7]};
|
| 13 |
+
}
|
| 14 |
+
constraint cst_num_scen_default {
|
| 15 |
+
num_scen inside {[1:2]};
|
| 16 |
+
}
|
| 17 |
+
// ToDo: Add constraint blocks to prevent error injection
|
| 18 |
+
|
| 19 |
+
`uvm_object_utils_begin(wb_env_cfg)
|
| 20 |
+
`uvm_field_int(num_trans,UVM_DEFAULT)
|
| 21 |
+
`uvm_field_int(num_scen,UVM_DEFAULT)
|
| 22 |
+
// ToDo: add properties using macros here
|
| 23 |
+
`uvm_object_utils_end
|
| 24 |
+
function new(string name = "wb_env_cfg") ;
|
| 25 |
+
super.new(name);
|
| 26 |
+
endfunction
|
| 27 |
+
|
| 28 |
+
endclass: wb_env_cfg
|
| 29 |
+
|
| 30 |
+
`endif // WB_ENV_CFG__SV
|
Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/src/wb_env_cov.sv
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`ifndef WB_ENV_COV__SV
|
| 2 |
+
`define WB_ENV_COV__SV
|
| 3 |
+
typedef class wb_transaction;
|
| 4 |
+
|
| 5 |
+
class wb_env_cov extends uvm_subscriber #(wb_transaction);
|
| 6 |
+
event cov_event;
|
| 7 |
+
wb_transaction tr;
|
| 8 |
+
`uvm_component_utils(wb_env_cov)
|
| 9 |
+
|
| 10 |
+
covergroup cg_trans @(cov_event);
|
| 11 |
+
coverpoint tr.kind;
|
| 12 |
+
coverpoint tr.address {
|
| 13 |
+
bins low = {[0:10]};
|
| 14 |
+
bins mid = {[10:100]};
|
| 15 |
+
bins high = {[100:$]};
|
| 16 |
+
}
|
| 17 |
+
coverpoint tr.lock ;
|
| 18 |
+
coverpoint tr.status;
|
| 19 |
+
coverpoint tr.num_wait_states {
|
| 20 |
+
bins legal[] = {[0:15]};
|
| 21 |
+
illegal_bins ib = {[16:$]};
|
| 22 |
+
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
endgroup: cg_trans
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
function new(string name, uvm_component parent);
|
| 29 |
+
super.new(name,parent);
|
| 30 |
+
cg_trans = new;
|
| 31 |
+
endfunction: new
|
| 32 |
+
|
| 33 |
+
virtual function void write(wb_transaction t);
|
| 34 |
+
this.tr = t;
|
| 35 |
+
-> cov_event;
|
| 36 |
+
endfunction: write
|
| 37 |
+
|
| 38 |
+
endclass: wb_env_cov
|
| 39 |
+
|
| 40 |
+
`endif // WB_ENV_COV__SV
|
| 41 |
+
|
Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/src/wb_master.sv
ADDED
|
@@ -0,0 +1,273 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`ifndef WB_MASTER__SV
|
| 2 |
+
`define WB_MASTER__SV
|
| 3 |
+
|
| 4 |
+
typedef class wb_transaction;
|
| 5 |
+
typedef class wb_config;
|
| 6 |
+
typedef class wb_master;
|
| 7 |
+
typedef class wb_config;
|
| 8 |
+
//`include "wb_master_if.sv"
|
| 9 |
+
|
| 10 |
+
class wb_master_callbacks extends uvm_callback;
|
| 11 |
+
|
| 12 |
+
// Called before a transaction is executed
|
| 13 |
+
virtual task pre_tx( wb_master xactor,
|
| 14 |
+
wb_transaction tr);
|
| 15 |
+
|
| 16 |
+
`uvm_info("WB_MASTER_CALLBACKS"," This is in the pre-callback phase",UVM_LOW)
|
| 17 |
+
tr.print();
|
| 18 |
+
|
| 19 |
+
endtask: pre_tx
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
// Called after a transaction has been executed
|
| 23 |
+
virtual task post_tx( wb_master xactor,
|
| 24 |
+
wb_transaction tr);
|
| 25 |
+
|
| 26 |
+
endtask: post_tx
|
| 27 |
+
|
| 28 |
+
endclass: wb_master_callbacks
|
| 29 |
+
|
| 30 |
+
class wb_master extends uvm_driver # (wb_transaction);
|
| 31 |
+
|
| 32 |
+
wb_config mstr_drv_cfg;
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
typedef virtual wb_master_if v_if;
|
| 36 |
+
v_if drv_if;
|
| 37 |
+
`uvm_register_cb(wb_master,wb_master_callbacks);
|
| 38 |
+
|
| 39 |
+
extern function new(string name = "wb_master",
|
| 40 |
+
uvm_component parent = null);
|
| 41 |
+
|
| 42 |
+
`uvm_component_utils_begin(wb_master)
|
| 43 |
+
`uvm_component_utils_end
|
| 44 |
+
|
| 45 |
+
extern virtual function void build_phase(uvm_phase phase);
|
| 46 |
+
extern virtual function void end_of_elaboration_phase(uvm_phase phase);
|
| 47 |
+
extern virtual function void start_of_simulation_phase(uvm_phase phase);
|
| 48 |
+
extern virtual function void connect_phase(uvm_phase phase);
|
| 49 |
+
extern virtual task reset_phase(uvm_phase phase); // See Note near implementation of this phase.
|
| 50 |
+
extern virtual task run_phase(uvm_phase phase);
|
| 51 |
+
extern protected virtual task main_driver();
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
extern protected virtual task read(wb_transaction trans);
|
| 55 |
+
extern protected virtual task write(wb_transaction trans);
|
| 56 |
+
extern protected virtual task blockRead(wb_transaction trans);
|
| 57 |
+
extern protected virtual task blockWrite( wb_transaction trans);
|
| 58 |
+
extern protected virtual task ReadModifyWrite(wb_transaction trans);
|
| 59 |
+
|
| 60 |
+
endclass: wb_master
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
function wb_master::new(string name = "wb_master",
|
| 64 |
+
uvm_component parent = null);
|
| 65 |
+
super.new(name, parent);
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
endfunction: new
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
function void wb_master::build_phase(uvm_phase phase);
|
| 72 |
+
super.build_phase(phase);
|
| 73 |
+
endfunction: build_phase
|
| 74 |
+
|
| 75 |
+
function void wb_master::connect_phase(uvm_phase phase);
|
| 76 |
+
super.connect_phase(phase);
|
| 77 |
+
uvm_config_db#(v_if)::get(this, "", "mst_if", drv_if);
|
| 78 |
+
|
| 79 |
+
endfunction: connect_phase
|
| 80 |
+
|
| 81 |
+
function void wb_master::end_of_elaboration_phase(uvm_phase phase);
|
| 82 |
+
super.end_of_elaboration_phase(phase);
|
| 83 |
+
if (drv_if == null)
|
| 84 |
+
`uvm_fatal("NO_CONN", "Virtual port not connected to the actual interface instance");
|
| 85 |
+
endfunction: end_of_elaboration_phase
|
| 86 |
+
|
| 87 |
+
function void wb_master::start_of_simulation_phase(uvm_phase phase);
|
| 88 |
+
super.start_of_simulation_phase(phase);
|
| 89 |
+
endfunction: start_of_simulation_phase
|
| 90 |
+
|
| 91 |
+
//This reset_phase task implementation really isn't the recommended way to do use the reset_phase task.
|
| 92 |
+
// However, I provided this to simplify the example simply to allow you to follow along.
|
| 93 |
+
// See Book for reasons why you should do it a different way.
|
| 94 |
+
|
| 95 |
+
task wb_master::reset_phase(uvm_phase phase);
|
| 96 |
+
super.reset_phase(phase);
|
| 97 |
+
phase.raise_objection(this,"");
|
| 98 |
+
// Driving the signals as per the spec.
|
| 99 |
+
this.drv_if.master_cb.DAT_O <= 'bz;
|
| 100 |
+
this.drv_if.master_cb.TGD_O <= 'bz;
|
| 101 |
+
this.drv_if.master_cb.ADR_O <= 'bz;
|
| 102 |
+
this.drv_if.master_cb.WE_O <= 'bz;
|
| 103 |
+
this.drv_if.master_cb.CYC_O <= 'bz;
|
| 104 |
+
this.drv_if.master_cb.LOCK_O <= 'bz;
|
| 105 |
+
this.drv_if.master_cb.SEL_O <= 'bz;
|
| 106 |
+
this.drv_if.master_cb.STB_O <= 'bz;
|
| 107 |
+
this.drv_if.master_cb.TGA_O <= 'bz;
|
| 108 |
+
this.drv_if.master_cb.TGC_O <= 'bz;
|
| 109 |
+
|
| 110 |
+
repeat (4) @(this.drv_if.master_cb);
|
| 111 |
+
// Done setting signals. Now we can drop objections and move on.
|
| 112 |
+
phase.drop_objection(this);
|
| 113 |
+
endtask: reset_phase
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
task wb_master::run_phase(uvm_phase phase);
|
| 117 |
+
super.run_phase(phase);
|
| 118 |
+
phase.raise_objection(this,"");
|
| 119 |
+
fork
|
| 120 |
+
main_driver();
|
| 121 |
+
join_none
|
| 122 |
+
phase.drop_objection(this);
|
| 123 |
+
endtask: run_phase
|
| 124 |
+
|
| 125 |
+
|
| 126 |
+
task wb_master::main_driver();
|
| 127 |
+
int count;
|
| 128 |
+
count = 0;
|
| 129 |
+
forever begin
|
| 130 |
+
wb_transaction tr;
|
| 131 |
+
bit drop = 0;
|
| 132 |
+
// Set output signals to their idle state
|
| 133 |
+
|
| 134 |
+
this.drv_if.master_cb.DAT_O <= 'bz;
|
| 135 |
+
this.drv_if.master_cb.TGD_O <= 'bz;
|
| 136 |
+
this.drv_if.master_cb.ADR_O <= 'bz;
|
| 137 |
+
this.drv_if.master_cb.CYC_O <= 'bz;
|
| 138 |
+
this.drv_if.master_cb.LOCK_O <= 'bz;
|
| 139 |
+
this.drv_if.master_cb.SEL_O <= 'bz;
|
| 140 |
+
this.drv_if.master_cb.STB_O <= 'b0;
|
| 141 |
+
this.drv_if.master_cb.TGA_O <= 'bz;
|
| 142 |
+
this.drv_if.master_cb.TGC_O <= 'bz;
|
| 143 |
+
|
| 144 |
+
seq_item_port.get_next_item(tr);
|
| 145 |
+
`uvm_info("wb_env_DRIVER", "Starting transaction...",UVM_LOW)
|
| 146 |
+
`uvm_do_callbacks(wb_master,wb_master_callbacks, pre_tx(this, tr))
|
| 147 |
+
// Since we are just beginning the transaction, we dont know what kind it's yet.
|
| 148 |
+
|
| 149 |
+
tr.status = wb_transaction::UNKNOWN;
|
| 150 |
+
|
| 151 |
+
case (tr.kind)
|
| 152 |
+
wb_transaction::READ: begin
|
| 153 |
+
read(tr);
|
| 154 |
+
end
|
| 155 |
+
wb_transaction::WRITE: begin
|
| 156 |
+
// ToDo: Implement DISPLAY transaction
|
| 157 |
+
write(tr);
|
| 158 |
+
end
|
| 159 |
+
wb_transaction::BLK_RD: begin
|
| 160 |
+
// ToDo: Implement BLK_RD transaction
|
| 161 |
+
end
|
| 162 |
+
wb_transaction::BLK_WR: begin
|
| 163 |
+
// ToDo: Implement BLK_RD transaction
|
| 164 |
+
end
|
| 165 |
+
wb_transaction::RMW: begin
|
| 166 |
+
// ToDo: Implement RMW transaction
|
| 167 |
+
end
|
| 168 |
+
endcase
|
| 169 |
+
|
| 170 |
+
seq_item_port.item_done();
|
| 171 |
+
`uvm_info("wb_env_DRIVER", tr.sprint(),UVM_LOW)
|
| 172 |
+
|
| 173 |
+
`uvm_do_callbacks(wb_master,wb_master_callbacks, post_tx(this, tr))
|
| 174 |
+
`uvm_info("wb_env_DRIVER", "Completed transaction...",UVM_LOW)
|
| 175 |
+
count = count + 1;
|
| 176 |
+
end
|
| 177 |
+
endtask : main_driver
|
| 178 |
+
|
| 179 |
+
|
| 180 |
+
task wb_master::read(wb_transaction trans);
|
| 181 |
+
@(this.drv_if.master_cb);
|
| 182 |
+
|
| 183 |
+
`uvm_info("Wb master","Got a read transaction",UVM_LOW)
|
| 184 |
+
|
| 185 |
+
// Edge 0
|
| 186 |
+
this.drv_if.master_cb.ADR_O <= trans.address;
|
| 187 |
+
this.drv_if.master_cb.TGA_O <= trans.tga;
|
| 188 |
+
this.drv_if.master_cb.WE_O <= 1'b0;
|
| 189 |
+
this.drv_if.master_cb.SEL_O <= trans.sel;
|
| 190 |
+
this.drv_if.master_cb.CYC_O <= 1'b1;
|
| 191 |
+
this.drv_if.master_cb.TGC_O <= trans.tgc;
|
| 192 |
+
this.drv_if.master_cb.STB_O <= 1'b1;
|
| 193 |
+
|
| 194 |
+
// Edge 1
|
| 195 |
+
trans.status = wb_transaction::TIMEOUT ;
|
| 196 |
+
repeat (this.mstr_drv_cfg.max_n_wss + 1) begin
|
| 197 |
+
// Wait states
|
| 198 |
+
@(this.drv_if.master_cb);
|
| 199 |
+
|
| 200 |
+
case (1'b1)
|
| 201 |
+
this.drv_if.master_cb.ERR_I: trans.status = wb_transaction::ERR ;
|
| 202 |
+
this.drv_if.master_cb.RTY_I: trans.status = wb_transaction::RTY ;
|
| 203 |
+
this.drv_if.master_cb.ACK_I: trans.status = wb_transaction::ACK ;
|
| 204 |
+
default: continue;
|
| 205 |
+
endcase
|
| 206 |
+
|
| 207 |
+
break;
|
| 208 |
+
end
|
| 209 |
+
trans.data = this.drv_if.master_cb.DAT_I;
|
| 210 |
+
trans.tgd = this.drv_if.master_cb.TGD_I;
|
| 211 |
+
|
| 212 |
+
this.drv_if.master_cb.LOCK_O <= trans.lock;
|
| 213 |
+
this.drv_if.master_cb.CYC_O <= 1'bz;
|
| 214 |
+
|
| 215 |
+
endtask
|
| 216 |
+
|
| 217 |
+
task wb_master::write( wb_transaction trans);
|
| 218 |
+
|
| 219 |
+
|
| 220 |
+
// Section 3.2.2 of Wishbone B3 Specification
|
| 221 |
+
@(this.drv_if.master_cb);
|
| 222 |
+
`uvm_info("Wb master","Got a write transaction",UVM_LOW)
|
| 223 |
+
|
| 224 |
+
// Edge 0
|
| 225 |
+
this.drv_if.master_cb.ADR_O <= trans.address;
|
| 226 |
+
this.drv_if.master_cb.TGA_O <= trans.tga;
|
| 227 |
+
this.drv_if.master_cb.DAT_O <= trans.data;
|
| 228 |
+
this.drv_if.master_cb.TGD_O <= trans.tgd;
|
| 229 |
+
this.drv_if.master_cb.WE_O <= 1'b1;
|
| 230 |
+
this.drv_if.master_cb.SEL_O <= trans.sel;
|
| 231 |
+
this.drv_if.master_cb.CYC_O <= 1'b1;
|
| 232 |
+
this.drv_if.master_cb.TGC_O <= trans.tgc;
|
| 233 |
+
this.drv_if.master_cb.STB_O <= 1'b1;
|
| 234 |
+
|
| 235 |
+
// Edge 1
|
| 236 |
+
trans.status = wb_transaction::TIMEOUT ;
|
| 237 |
+
repeat (this.mstr_drv_cfg.max_n_wss + 1) begin
|
| 238 |
+
// Wait states
|
| 239 |
+
@(this.drv_if.master_cb);
|
| 240 |
+
case (1'b1)
|
| 241 |
+
this.drv_if.master_cb.ERR_I: trans.status = wb_transaction::ERR ;
|
| 242 |
+
this.drv_if.master_cb.RTY_I: trans.status = wb_transaction::RTY ;
|
| 243 |
+
this.drv_if.master_cb.ACK_I: trans.status = wb_transaction::ACK ;
|
| 244 |
+
default: continue;
|
| 245 |
+
endcase
|
| 246 |
+
|
| 247 |
+
break;
|
| 248 |
+
end
|
| 249 |
+
|
| 250 |
+
if (trans.status == wb_transaction::TIMEOUT ) begin
|
| 251 |
+
`uvm_info("wb_master_driver: ", "Timeout waiting for ACK_I, RTY_I or ERR_I",UVM_HIGH);
|
| 252 |
+
end
|
| 253 |
+
|
| 254 |
+
this.drv_if.master_cb.LOCK_O <= trans.lock;
|
| 255 |
+
this.drv_if.master_cb.CYC_O <= 1'bz;
|
| 256 |
+
|
| 257 |
+
endtask
|
| 258 |
+
|
| 259 |
+
task wb_master::blockRead(wb_transaction trans);
|
| 260 |
+
`uvm_error("WB_MASTER","blockRead not implemented yet")
|
| 261 |
+
endtask
|
| 262 |
+
|
| 263 |
+
task wb_master::blockWrite(wb_transaction trans);
|
| 264 |
+
`uvm_error("WB_MASTER","blockWrite not implemented yet")
|
| 265 |
+
endtask
|
| 266 |
+
|
| 267 |
+
task wb_master::ReadModifyWrite(wb_transaction trans);
|
| 268 |
+
|
| 269 |
+
`uvm_error("WB_MASTER","ReadModifyWrite not implemented yet")
|
| 270 |
+
endtask
|
| 271 |
+
`endif // WB_MASTER__SV
|
| 272 |
+
|
| 273 |
+
|
Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/src/wb_master_agent_sequence_library.sv
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//
|
| 2 |
+
// Template for UVM-compliant sequence library
|
| 3 |
+
//
|
| 4 |
+
|
| 5 |
+
typedef class wb_transaction;
|
| 6 |
+
|
| 7 |
+
class wb_master_seqr_sequence_library extends uvm_sequence_library # (wb_transaction);
|
| 8 |
+
`uvm_sequence_library_utils(wb_master_seqr_sequence_library)
|
| 9 |
+
|
| 10 |
+
function new(string name = "simple_seq_lib");
|
| 11 |
+
super.new(name);
|
| 12 |
+
init_sequence_library();
|
| 13 |
+
endfunction
|
| 14 |
+
|
| 15 |
+
endclass
|
| 16 |
+
|
| 17 |
+
class base_sequence extends uvm_sequence #(wb_transaction);
|
| 18 |
+
`uvm_object_utils(base_sequence)
|
| 19 |
+
|
| 20 |
+
function new(string name = "base_seq");
|
| 21 |
+
super.new(name);
|
| 22 |
+
set_automatic_phase_objection(1);
|
| 23 |
+
endfunction:new
|
| 24 |
+
/*
|
| 25 |
+
virtual task pre_body();
|
| 26 |
+
uvm_phase phase_=get_starting_phase();
|
| 27 |
+
if (phase_ != null)
|
| 28 |
+
phase_.raise_objection(this);
|
| 29 |
+
endtask:pre_body
|
| 30 |
+
virtual task post_body();
|
| 31 |
+
|
| 32 |
+
uvm_phase phase_=get_starting_phase();
|
| 33 |
+
|
| 34 |
+
if (phase_ != null)
|
| 35 |
+
phase_.drop_objection(this);
|
| 36 |
+
endtask:post_body
|
| 37 |
+
*/
|
| 38 |
+
endclass
|
| 39 |
+
|
| 40 |
+
class sequence_0 extends base_sequence;
|
| 41 |
+
`uvm_object_utils(sequence_0)
|
| 42 |
+
`uvm_add_to_seq_lib(sequence_0,wb_master_seqr_sequence_library)
|
| 43 |
+
function new(string name = "seq_0");
|
| 44 |
+
super.new(name);
|
| 45 |
+
endfunction:new
|
| 46 |
+
virtual task body();
|
| 47 |
+
|
| 48 |
+
repeat(2) begin
|
| 49 |
+
`uvm_do(req);
|
| 50 |
+
end
|
| 51 |
+
start_item(req);
|
| 52 |
+
finish_item(req);
|
| 53 |
+
endtask
|
| 54 |
+
virtual task pre_body();
|
| 55 |
+
// Provided as an example. See above comment DONT USE THIS.
|
| 56 |
+
|
| 57 |
+
uvm_phase phase_=get_starting_phase();
|
| 58 |
+
|
| 59 |
+
if (phase_!=null) begin
|
| 60 |
+
`uvm_info(get_type_name(),
|
| 61 |
+
$sformatf("%s pre_body() raising %s objection",
|
| 62 |
+
get_sequence_path(),
|
| 63 |
+
phase_.get_name()), UVM_MEDIUM);
|
| 64 |
+
phase_.raise_objection(this);
|
| 65 |
+
end
|
| 66 |
+
endtask
|
| 67 |
+
|
| 68 |
+
// Drop the objection in the post_body so the objection is removed when
|
| 69 |
+
// the root sequence is complete. Provided as an example. See above comment. DONT USE THIS.
|
| 70 |
+
virtual task post_body();
|
| 71 |
+
uvm_phase phase_=get_starting_phase();
|
| 72 |
+
|
| 73 |
+
if (phase_!=null) begin
|
| 74 |
+
`uvm_info(get_type_name(),
|
| 75 |
+
$sformatf("%s post_body() dropping %s objection",
|
| 76 |
+
get_sequence_path(),
|
| 77 |
+
phase_.get_name()), UVM_MEDIUM);
|
| 78 |
+
phase_.drop_objection(this);
|
| 79 |
+
end
|
| 80 |
+
endtask
|
| 81 |
+
|
| 82 |
+
endclass
|
| 83 |
+
|
| 84 |
+
class sequence_1 extends base_sequence;
|
| 85 |
+
byte sa;
|
| 86 |
+
`uvm_object_utils(sequence_1)
|
| 87 |
+
`uvm_add_to_seq_lib(sequence_1, wb_master_seqr_sequence_library)
|
| 88 |
+
function new(string name = "seq_1");
|
| 89 |
+
super.new(name);
|
| 90 |
+
endfunction:new
|
| 91 |
+
virtual task body();
|
| 92 |
+
`uvm_do_with(req, {address == 3; kind == wb_transaction::WRITE; data == 63'hdeadbeef;} )
|
| 93 |
+
`uvm_do_with(req,{address == 4; kind == wb_transaction::WRITE; data == 63'hbeefdead;} )
|
| 94 |
+
`uvm_do_with(req, {address == 5; kind == wb_transaction::WRITE; data == 63'h0123456678;} )
|
| 95 |
+
|
| 96 |
+
`uvm_do_with(req, {address == 6; kind == wb_transaction::READ ;} )
|
| 97 |
+
`uvm_do_with(req, {address == 6; kind == wb_transaction::READ;} )
|
| 98 |
+
`uvm_do_with(req, {address == 7; kind == wb_transaction::READ;} )
|
| 99 |
+
endtask
|
| 100 |
+
endclass
|
| 101 |
+
|
Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/src/wb_master_if.sv
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`ifndef WB_MASTER_IF__SV
|
| 2 |
+
`define WB_MASTER_IF__SV
|
| 3 |
+
|
| 4 |
+
interface wb_master_if (input wire clk,input bit rst);
|
| 5 |
+
|
| 6 |
+
// ToDo: Define default setup & hold times
|
| 7 |
+
|
| 8 |
+
parameter setup_time = 5/*ns*/;
|
| 9 |
+
parameter hold_time = 3/*ns*/;
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
// Common Signals
|
| 13 |
+
wire [63:0] DAT_I;
|
| 14 |
+
wire [63:0] DAT_O;
|
| 15 |
+
wire RST_I;
|
| 16 |
+
wire [15:0] TGD_I;
|
| 17 |
+
wire [15:0] TGD_O;
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
// Master signals
|
| 21 |
+
logic ACK_I;
|
| 22 |
+
logic [63:0] ADR_O;
|
| 23 |
+
logic CYC_O;
|
| 24 |
+
logic ERR_I;
|
| 25 |
+
logic LOCK_O;
|
| 26 |
+
|
| 27 |
+
logic RTY_I ;
|
| 28 |
+
logic [7:0] SEL_O;
|
| 29 |
+
logic STB_O;
|
| 30 |
+
logic [15:0] TGA_O;
|
| 31 |
+
logic [15:0] TGC_O;
|
| 32 |
+
logic WE_O;
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
clocking master_cb @(posedge clk);
|
| 36 |
+
|
| 37 |
+
// Common Signals
|
| 38 |
+
input clk;
|
| 39 |
+
input rst;
|
| 40 |
+
|
| 41 |
+
input DAT_I;
|
| 42 |
+
output DAT_O;
|
| 43 |
+
input RST_I;
|
| 44 |
+
input TGD_I;
|
| 45 |
+
output TGD_O;
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
// Master signals
|
| 49 |
+
input ACK_I;
|
| 50 |
+
output ADR_O;
|
| 51 |
+
output CYC_O;
|
| 52 |
+
input ERR_I;
|
| 53 |
+
output LOCK_O;
|
| 54 |
+
|
| 55 |
+
input RTY_I ;
|
| 56 |
+
output SEL_O;
|
| 57 |
+
output STB_O;
|
| 58 |
+
output TGA_O;
|
| 59 |
+
output TGC_O;
|
| 60 |
+
output WE_O;
|
| 61 |
+
endclocking
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
clocking monitor_cb @(posedge clk);
|
| 67 |
+
// Common Signals
|
| 68 |
+
input clk;
|
| 69 |
+
input rst;
|
| 70 |
+
|
| 71 |
+
input DAT_I;
|
| 72 |
+
input DAT_O;
|
| 73 |
+
input RST_I;
|
| 74 |
+
input TGD_I;
|
| 75 |
+
input TGD_O;
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
// Master signals
|
| 79 |
+
input ACK_I;
|
| 80 |
+
input ADR_O;
|
| 81 |
+
input CYC_O;
|
| 82 |
+
input ERR_I;
|
| 83 |
+
input LOCK_O;
|
| 84 |
+
|
| 85 |
+
input RTY_I ;
|
| 86 |
+
input SEL_O;
|
| 87 |
+
input STB_O;
|
| 88 |
+
input TGA_O;
|
| 89 |
+
input TGC_O;
|
| 90 |
+
input WE_O;
|
| 91 |
+
endclocking
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
modport master (clocking master_cb);
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
modport monitor (clocking monitor_cb);
|
| 98 |
+
|
| 99 |
+
|
| 100 |
+
endinterface: wb_master_if
|
| 101 |
+
|
| 102 |
+
`endif // WB_MASTER_IF__SV
|
Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/src/wb_master_mon.sv
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`ifndef WB_MASTER_MON__SV
|
| 2 |
+
`define WB_MASTER_MON__SV
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
typedef class wb_transaction;
|
| 6 |
+
typedef class wb_master_mon;
|
| 7 |
+
typedef class wb_config;
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
class wb_master_mon_callbacks extends uvm_callback;
|
| 11 |
+
|
| 12 |
+
// ToDo: Add additional relevant callbacks
|
| 13 |
+
// ToDo: Use a task if callbacks can be blocking
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
// Called at start of observed transaction
|
| 17 |
+
virtual function void pre_trans(wb_master_mon xactor,
|
| 18 |
+
wb_transaction tr);
|
| 19 |
+
endfunction: pre_trans
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
// Called before acknowledging a transaction
|
| 23 |
+
virtual function pre_ack(wb_master_mon xactor,
|
| 24 |
+
wb_transaction tr);
|
| 25 |
+
endfunction: pre_ack
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
// Called at end of observed transaction
|
| 29 |
+
virtual function void post_trans(wb_master_mon xactor,
|
| 30 |
+
wb_transaction tr);
|
| 31 |
+
endfunction: post_trans
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
// Callback method post_cb_trans can be used for coverage
|
| 35 |
+
virtual task post_cb_trans(wb_master_mon xactor,
|
| 36 |
+
wb_transaction tr);
|
| 37 |
+
endtask: post_cb_trans
|
| 38 |
+
|
| 39 |
+
endclass: wb_master_mon_callbacks
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
class wb_master_mon extends uvm_monitor;
|
| 44 |
+
|
| 45 |
+
uvm_analysis_port #(wb_transaction) mon_analysis_port; //TLM analysis port
|
| 46 |
+
typedef virtual wb_master_if v_if;
|
| 47 |
+
v_if mon_if;
|
| 48 |
+
// ToDo: Add another class property if required
|
| 49 |
+
|
| 50 |
+
wb_config mstr_mon_cfg;
|
| 51 |
+
|
| 52 |
+
extern function new(string name = "wb_master_mon",uvm_component parent);
|
| 53 |
+
`uvm_register_cb(wb_master_mon,wb_master_mon_callbacks);
|
| 54 |
+
`uvm_component_utils_begin(wb_master_mon)
|
| 55 |
+
// ToDo: Add uvm monitor member if any class property added later through field macros
|
| 56 |
+
|
| 57 |
+
`uvm_component_utils_end
|
| 58 |
+
// ToDo: Add required short hand override method
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
extern virtual function void build_phase(uvm_phase phase);
|
| 62 |
+
extern virtual function void end_of_elaboration_phase(uvm_phase phase);
|
| 63 |
+
extern virtual function void start_of_simulation_phase(uvm_phase phase);
|
| 64 |
+
extern virtual function void connect_phase(uvm_phase phase);
|
| 65 |
+
extern virtual task reset_phase(uvm_phase phase);
|
| 66 |
+
extern virtual task configure_phase(uvm_phase phase);
|
| 67 |
+
extern virtual task run_phase(uvm_phase phase);
|
| 68 |
+
extern protected virtual task master_monitor_task();
|
| 69 |
+
|
| 70 |
+
endclass: wb_master_mon
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
function wb_master_mon::new(string name = "wb_master_mon",uvm_component parent);
|
| 74 |
+
super.new(name, parent);
|
| 75 |
+
mon_analysis_port = new ("mon_analysis_port",this);
|
| 76 |
+
endfunction: new
|
| 77 |
+
|
| 78 |
+
function void wb_master_mon::build_phase(uvm_phase phase);
|
| 79 |
+
super.build_phase(phase);
|
| 80 |
+
//ToDo : Implement this phase here
|
| 81 |
+
|
| 82 |
+
endfunction: build_phase
|
| 83 |
+
|
| 84 |
+
function void wb_master_mon::connect_phase(uvm_phase phase);
|
| 85 |
+
super.connect_phase(phase);
|
| 86 |
+
uvm_config_db#(v_if)::get(this, "", "mon_if", mon_if);
|
| 87 |
+
endfunction: connect_phase
|
| 88 |
+
|
| 89 |
+
function void wb_master_mon::end_of_elaboration_phase(uvm_phase phase);
|
| 90 |
+
super.end_of_elaboration_phase(phase);
|
| 91 |
+
if (mon_if == null)
|
| 92 |
+
`uvm_fatal("NO_CONN", "Virtual port not connected to the actual interface instance");
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
endfunction: end_of_elaboration_phase
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
function void wb_master_mon::start_of_simulation_phase(uvm_phase phase);
|
| 99 |
+
super.start_of_simulation_phase(phase);
|
| 100 |
+
endfunction: start_of_simulation_phase
|
| 101 |
+
|
| 102 |
+
|
| 103 |
+
task wb_master_mon::reset_phase(uvm_phase phase);
|
| 104 |
+
super.reset_phase(phase);
|
| 105 |
+
|
| 106 |
+
endtask: reset_phase
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
task wb_master_mon::configure_phase(uvm_phase phase);
|
| 110 |
+
super.configure_phase(phase);
|
| 111 |
+
phase.raise_objection(this,"");
|
| 112 |
+
//ToDo: Configure your component here
|
| 113 |
+
phase.drop_objection(this);
|
| 114 |
+
|
| 115 |
+
endtask:configure_phase
|
| 116 |
+
|
| 117 |
+
|
| 118 |
+
task wb_master_mon::run_phase(uvm_phase phase);
|
| 119 |
+
super.configure_phase(phase);
|
| 120 |
+
phase.raise_objection(this,"");
|
| 121 |
+
fork
|
| 122 |
+
master_monitor_task();
|
| 123 |
+
join_none
|
| 124 |
+
phase.drop_objection(this);
|
| 125 |
+
`uvm_info("wb_env_MONITOR", "Droppoimg all objectsion...",UVM_HIGH)
|
| 126 |
+
|
| 127 |
+
endtask: run_phase
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
task wb_master_mon::master_monitor_task();
|
| 131 |
+
|
| 132 |
+
forever begin
|
| 133 |
+
wb_transaction tr;
|
| 134 |
+
|
| 135 |
+
do begin
|
| 136 |
+
|
| 137 |
+
@(this.mon_if.CYC_O or
|
| 138 |
+
this.mon_if.STB_O or
|
| 139 |
+
this.mon_if.ADR_O or
|
| 140 |
+
this.mon_if.SEL_O or
|
| 141 |
+
this.mon_if.WE_O or
|
| 142 |
+
this.mon_if.TGA_O or
|
| 143 |
+
this.mon_if.TGC_O);
|
| 144 |
+
end while (this.mon_if.CYC_O !== 1'b1 ||
|
| 145 |
+
this.mon_if.STB_O !== 1'b1);
|
| 146 |
+
tr= wb_transaction::type_id::create("tr", this);
|
| 147 |
+
tr.address = this.mon_if.ADR_O;
|
| 148 |
+
// Are we supposed to respond to this cycle?
|
| 149 |
+
if(this.mstr_mon_cfg.min_addr <= tr.address && tr.address <=this.mstr_mon_cfg.max_addr )
|
| 150 |
+
begin
|
| 151 |
+
`uvm_do_callbacks(wb_master_mon,wb_master_mon_callbacks,
|
| 152 |
+
pre_trans(this, tr))
|
| 153 |
+
|
| 154 |
+
tr.tga = this.mon_if.TGA_O;
|
| 155 |
+
if(this.mon_if.WE_O) begin
|
| 156 |
+
tr.kind = wb_transaction::WRITE;
|
| 157 |
+
`uvm_info("WB master Monitor","got a write transaction from Master ",UVM_LOW)
|
| 158 |
+
tr.data = this.mon_if.DAT_I;
|
| 159 |
+
tr.tgd = this.mon_if.TGD_O;
|
| 160 |
+
tr.status = wb_transaction::ACK;
|
| 161 |
+
end
|
| 162 |
+
else begin
|
| 163 |
+
tr.kind = wb_transaction::READ ;
|
| 164 |
+
`uvm_info("Wb_master Monitor","got a read transaction ",UVM_LOW)
|
| 165 |
+
|
| 166 |
+
tr.status = wb_transaction::ACK;
|
| 167 |
+
end
|
| 168 |
+
|
| 169 |
+
`uvm_do_callbacks(wb_master_mon,wb_master_mon_callbacks,
|
| 170 |
+
pre_ack(this, tr))
|
| 171 |
+
|
| 172 |
+
wait(this.mon_if.master_cb.ACK_I);
|
| 173 |
+
tr.data = this.mon_if.DAT_O;
|
| 174 |
+
tr.tgd = this.mon_if.TGD_O;
|
| 175 |
+
|
| 176 |
+
tr.sel = this.mon_if.SEL_O;
|
| 177 |
+
tr.tgc = this.mon_if.TGC_O;
|
| 178 |
+
@(this.mon_if.monitor_cb);
|
| 179 |
+
end
|
| 180 |
+
`uvm_do_callbacks(wb_master_mon,wb_master_mon_callbacks,
|
| 181 |
+
post_trans(this, tr))
|
| 182 |
+
mon_analysis_port.write(tr);
|
| 183 |
+
end
|
| 184 |
+
|
| 185 |
+
endtask: master_monitor_task
|
| 186 |
+
|
| 187 |
+
|
| 188 |
+
|
| 189 |
+
|
| 190 |
+
|
| 191 |
+
|
| 192 |
+
`endif // WB_MASTER_MON__SV
|
Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/src/wb_master_seqr.sv
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`ifndef WB_MASTER_SEQR
|
| 2 |
+
`define WB_MASTER_SEQR
|
| 3 |
+
typedef class wb_transaction;
|
| 4 |
+
typedef class wb_config;
|
| 5 |
+
class wb_master_seqr extends uvm_sequencer # (wb_transaction);
|
| 6 |
+
|
| 7 |
+
wb_config cfg;
|
| 8 |
+
|
| 9 |
+
`uvm_component_utils(wb_master_seqr)
|
| 10 |
+
function new (string name,
|
| 11 |
+
uvm_component parent);
|
| 12 |
+
super.new(name,parent);
|
| 13 |
+
endfunction:new
|
| 14 |
+
endclass:wb_master_seqr
|
| 15 |
+
`endif
|
Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/src/wb_scoreboard.sv
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`ifndef WB_SCOREBOARD__SV
|
| 2 |
+
`define WB_SCOREBOARD__SV
|
| 3 |
+
|
| 4 |
+
class wb_scoreboard extends uvm_scoreboard;
|
| 5 |
+
`uvm_component_utils( wb_scoreboard)
|
| 6 |
+
|
| 7 |
+
uvm_tlm_analysis_fifo#( wb_transaction ) expected_wb_transaction_fifo;
|
| 8 |
+
uvm_tlm_analysis_fifo#( wb_transaction ) actual_wb_transaction_fifo;
|
| 9 |
+
|
| 10 |
+
// Constructor
|
| 11 |
+
|
| 12 |
+
function new( string name, uvm_component parent );
|
| 13 |
+
super.new( name, parent );
|
| 14 |
+
endfunction: new
|
| 15 |
+
|
| 16 |
+
extern virtual function void build_phase( uvm_phase phase );
|
| 17 |
+
extern virtual function void connect_phase( uvm_phase phase );
|
| 18 |
+
extern virtual task run_phase( uvm_phase phase );
|
| 19 |
+
|
| 20 |
+
endclass: wb_scoreboard
|
| 21 |
+
|
| 22 |
+
// Build all the components ..
|
| 23 |
+
|
| 24 |
+
function void wb_scoreboard::build_phase( uvm_phase phase );
|
| 25 |
+
super.build_phase( phase );
|
| 26 |
+
expected_wb_transaction_fifo = new( "expected_wb_transaction_fifo", this );
|
| 27 |
+
actual_wb_transaction_fifo = new( "actual_wb_transaction_fifo", this );
|
| 28 |
+
endfunction: build_phase
|
| 29 |
+
|
| 30 |
+
// Function: connect_phase
|
| 31 |
+
// Connect the components
|
| 32 |
+
|
| 33 |
+
function void wb_scoreboard::connect_phase( uvm_phase phase );
|
| 34 |
+
super.connect_phase( phase );
|
| 35 |
+
endfunction: connect_phase
|
| 36 |
+
|
| 37 |
+
// Task: run_phase. All the heavy lifting takes place here.
|
| 38 |
+
|
| 39 |
+
task wb_scoreboard::run_phase( uvm_phase phase );
|
| 40 |
+
wb_transaction expected_transaction;
|
| 41 |
+
wb_transaction actual_transaction;
|
| 42 |
+
|
| 43 |
+
super.run_phase( phase ); // THis should do nothing
|
| 44 |
+
forever begin
|
| 45 |
+
expected_wb_transaction_fifo.get_peek_export.get( expected_transaction);
|
| 46 |
+
actual_wb_transaction_fifo.get_peek_export.get(actual_transaction);
|
| 47 |
+
`uvm_info("SCOREBOARD","EXPECTED TRANSACTION",UVM_LOW)
|
| 48 |
+
expected_transaction.print();
|
| 49 |
+
`uvm_info("SCOREBOARD","ACTUAL TRANSACTION",UVM_LOW)
|
| 50 |
+
actual_transaction.print();
|
| 51 |
+
|
| 52 |
+
if ( !expected_transaction.compare( actual_transaction) ) begin
|
| 53 |
+
`uvm_error( "WB Scoreboard", "wb_transaction mismatch")
|
| 54 |
+
//expected_transaction.print();
|
| 55 |
+
//actual_transaction.print();
|
| 56 |
+
end
|
| 57 |
+
else begin
|
| 58 |
+
`uvm_info("WB SCOREBOARD", "TRANSACTIONS MATCH", UVM_LOW)
|
| 59 |
+
end
|
| 60 |
+
end
|
| 61 |
+
endtask: run_phase
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
`endif // WB_SCOREBOARD__SV
|
Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/src/wb_slave.my.sv
ADDED
|
@@ -0,0 +1,220 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//
|
| 2 |
+
// Template for UVM-compliant physical-level transactor
|
| 3 |
+
//
|
| 4 |
+
|
| 5 |
+
`ifndef WB_SLAVE__SV
|
| 6 |
+
`define WB_SLAVE__SV
|
| 7 |
+
|
| 8 |
+
typedef class wb_transaction;
|
| 9 |
+
typedef class wb_slave;
|
| 10 |
+
|
| 11 |
+
class wb_slave_callbacks extends uvm_callback;
|
| 12 |
+
|
| 13 |
+
// Called before a transaction is executed
|
| 14 |
+
virtual task pre_tx( wb_slave xactor, wb_transaction tr);
|
| 15 |
+
$display("pre tx slave Not implemented yet");
|
| 16 |
+
endtask: pre_tx
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
// Called after a transaction has been executed
|
| 20 |
+
virtual task post_tx( wb_slave xactor,
|
| 21 |
+
wb_transaction tr);
|
| 22 |
+
$display("post tx slave Not implemented yet");
|
| 23 |
+
|
| 24 |
+
endtask: post_tx
|
| 25 |
+
|
| 26 |
+
endclass: wb_slave_callbacks
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
class wb_slave extends uvm_driver # (wb_transaction);
|
| 30 |
+
|
| 31 |
+
protected wb_transaction m_tr; // This is what is captured
|
| 32 |
+
event send_to_get;
|
| 33 |
+
|
| 34 |
+
uvm_blocking_get_imp #(wb_transaction,wb_slave) get_export;
|
| 35 |
+
// uvm_blocking_put_port #(wb_transaction,wb_slave) addr_ph_imp;
|
| 36 |
+
|
| 37 |
+
wb_config wb_slave_cfg;
|
| 38 |
+
|
| 39 |
+
typedef virtual wb_slave_if v_if;
|
| 40 |
+
v_if drv_if;
|
| 41 |
+
`uvm_register_cb(wb_slave,wb_slave_callbacks);
|
| 42 |
+
|
| 43 |
+
extern function new(string name = "wb_slave",
|
| 44 |
+
uvm_component parent = null);
|
| 45 |
+
|
| 46 |
+
`uvm_component_utils_begin(wb_slave)
|
| 47 |
+
`uvm_component_utils_end
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
extern virtual function void build_phase(uvm_phase phase);
|
| 51 |
+
extern virtual function void end_of_elaboration_phase(uvm_phase phase);
|
| 52 |
+
extern virtual function void start_of_simulation_phase(uvm_phase phase);
|
| 53 |
+
extern virtual function void connect_phase(uvm_phase phase);
|
| 54 |
+
extern virtual task reset_phase(uvm_phase phase);
|
| 55 |
+
extern virtual task configure_phase(uvm_phase phase);
|
| 56 |
+
extern virtual task main_phase(uvm_phase phase);
|
| 57 |
+
extern protected virtual task slave_driver();
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
task get(output wb_transaction transaction);
|
| 61 |
+
wait(send_to_get.triggered)
|
| 62 |
+
$display("Got transaction in get task\n");
|
| 63 |
+
m_tr.print();
|
| 64 |
+
transaction = m_tr;
|
| 65 |
+
m_tr = null;
|
| 66 |
+
send_to_get = null;
|
| 67 |
+
endtask: get
|
| 68 |
+
endclass: wb_slave
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
function wb_slave::new(string name = "wb_slave",
|
| 75 |
+
uvm_component parent = null);
|
| 76 |
+
super.new(name, parent);
|
| 77 |
+
get_export = new("slv_get_export",this);
|
| 78 |
+
|
| 79 |
+
endfunction: new
|
| 80 |
+
|
| 81 |
+
|
| 82 |
+
function void wb_slave::build_phase(uvm_phase phase);
|
| 83 |
+
super.build_phase(phase);
|
| 84 |
+
endfunction: build_phase
|
| 85 |
+
|
| 86 |
+
function void wb_slave::connect_phase(uvm_phase phase);
|
| 87 |
+
super.connect_phase(phase);
|
| 88 |
+
if(!uvm_config_db#(v_if)::get(this, "", "slv_if", drv_if))
|
| 89 |
+
`uvm_fatal("NOVIF",{"virtual interface must be set for: ",get_full_name(),".v_if"});
|
| 90 |
+
endfunction: connect_phase
|
| 91 |
+
|
| 92 |
+
function void wb_slave::end_of_elaboration_phase(uvm_phase phase);
|
| 93 |
+
super.end_of_elaboration_phase(phase);
|
| 94 |
+
if (drv_if == null)
|
| 95 |
+
`uvm_fatal("NO_CONN", "Virtual port not connected to the actual interface instance");
|
| 96 |
+
endfunction: end_of_elaboration_phase
|
| 97 |
+
|
| 98 |
+
function void wb_slave::start_of_simulation_phase(uvm_phase phase);
|
| 99 |
+
super.start_of_simulation_phase(phase);
|
| 100 |
+
endfunction: start_of_simulation_phase
|
| 101 |
+
|
| 102 |
+
|
| 103 |
+
task wb_slave::reset_phase(uvm_phase phase);
|
| 104 |
+
super.reset_phase(phase);
|
| 105 |
+
phase.raise_objection(this,"");
|
| 106 |
+
this.drv_if.DAT_O <= 64'bz;
|
| 107 |
+
this.drv_if.TGD_O <= 16'bz;
|
| 108 |
+
this.drv_if.ACK_O <= 1'bz;
|
| 109 |
+
this.drv_if.RTY_O <= 1'bz;
|
| 110 |
+
this.drv_if.ERR_O <= 1'bz;
|
| 111 |
+
phase.drop_objection(this);
|
| 112 |
+
endtask: reset_phase
|
| 113 |
+
|
| 114 |
+
task wb_slave::configure_phase(uvm_phase phase);
|
| 115 |
+
super.configure_phase(phase);
|
| 116 |
+
phase.raise_objection(this,"");
|
| 117 |
+
//ToDo: Configure your component here
|
| 118 |
+
phase.drop_objection(this);
|
| 119 |
+
endtask:configure_phase
|
| 120 |
+
|
| 121 |
+
|
| 122 |
+
task wb_slave::main_phase(uvm_phase phase);
|
| 123 |
+
super.configure_phase(phase);
|
| 124 |
+
phase.raise_objection(this,"");
|
| 125 |
+
fork
|
| 126 |
+
slave_driver();
|
| 127 |
+
join_none
|
| 128 |
+
phase.drop_objection(this);
|
| 129 |
+
endtask: main_phase
|
| 130 |
+
|
| 131 |
+
|
| 132 |
+
|
| 133 |
+
|
| 134 |
+
task wb_slave::slave_driver();
|
| 135 |
+
forever begin
|
| 136 |
+
wb_transaction tr;
|
| 137 |
+
process proc;
|
| 138 |
+
|
| 139 |
+
do begin
|
| 140 |
+
if (this.drv_if.CYC_I !== 1'b1 || this.drv_if.STB_I !== 1'b1) begin
|
| 141 |
+
this.drv_if.DAT_O <= 64'bz;
|
| 142 |
+
this.drv_if.TGD_O <= 16'bz;
|
| 143 |
+
this.drv_if.ACK_O <= 1'bz;
|
| 144 |
+
this.drv_if.RTY_O <= 1'bz;
|
| 145 |
+
this.drv_if.ERR_O <= 1'bz;
|
| 146 |
+
end
|
| 147 |
+
|
| 148 |
+
@(this.drv_if.CYC_I or
|
| 149 |
+
this.drv_if.STB_I or
|
| 150 |
+
this.drv_if.ADR_I or
|
| 151 |
+
this.drv_if.SEL_I or
|
| 152 |
+
this.drv_if.WE_I or
|
| 153 |
+
this.drv_if.TGA_I or
|
| 154 |
+
this.drv_if.TGC_I);
|
| 155 |
+
end while (this.drv_if.CYC_I !== 1'b1 ||
|
| 156 |
+
this.drv_if.STB_I !== 1'b1);
|
| 157 |
+
$display(" creating a new transatciopmn");
|
| 158 |
+
tr= wb_transaction::type_id::create("tr", this);
|
| 159 |
+
tr.address = this.drv_if.ADR_I;
|
| 160 |
+
// Are we supposed to respond to this cycle?
|
| 161 |
+
if(this.wb_slave_cfg.min_addr <= tr.address && tr.address <=this.wb_slave_cfg.max_addr )
|
| 162 |
+
begin
|
| 163 |
+
tr.tga = this.drv_if.TGA_I;
|
| 164 |
+
if(this.drv_if.WE_I) begin
|
| 165 |
+
tr.kind = wb_transaction::WRITE;
|
| 166 |
+
`uvm_info("Wb_slave","got a write transaction from Master ",UVM_LOW)
|
| 167 |
+
tr.data = this.drv_if.DAT_I;
|
| 168 |
+
tr.tgd = this.drv_if.TGD_I;
|
| 169 |
+
end
|
| 170 |
+
else begin
|
| 171 |
+
tr.kind = wb_transaction::READ ;
|
| 172 |
+
`uvm_info("Wb_slave","got a read transaction ",UVM_LOW)
|
| 173 |
+
end
|
| 174 |
+
|
| 175 |
+
tr.sel = this.drv_if.SEL_I;
|
| 176 |
+
tr.tgc = this.drv_if.TGC_I;
|
| 177 |
+
// Send back an ack ..
|
| 178 |
+
m_tr = tr;
|
| 179 |
+
-> send_to_get;
|
| 180 |
+
this.drv_if.ACK_O <= 1;
|
| 181 |
+
$display("Troggeriing");
|
| 182 |
+
@(this.drv_if.slave_cb);
|
| 183 |
+
end
|
| 184 |
+
`uvm_do_callbacks(wb_slave,wb_slave_callbacks, pre_tx(this, tr))
|
| 185 |
+
tr = null;
|
| 186 |
+
/*
|
| 187 |
+
begin
|
| 188 |
+
proc = process::self();
|
| 189 |
+
seq_item_port.get_next_item(tr);
|
| 190 |
+
case (tr.kind)
|
| 191 |
+
wb_transaction::READ: begin
|
| 192 |
+
$display("responding to a read transaction\n");
|
| 193 |
+
// ToDo: Implement READ transaction
|
| 194 |
+
|
| 195 |
+
end
|
| 196 |
+
wb_transaction::WRITE: begin
|
| 197 |
+
$display("responding to a write transaction\n");
|
| 198 |
+
// ToDo: Implement READ transaction
|
| 199 |
+
end
|
| 200 |
+
endcase
|
| 201 |
+
seq_item_port.item_done();
|
| 202 |
+
`uvm_info("SLAVE_DRIVER", "Completed transaction...",UVM_LOW)
|
| 203 |
+
`uvm_do_callbacks(wb_slave,wb_slave_callbacks, post_tx(this, tr))
|
| 204 |
+
|
| 205 |
+
end
|
| 206 |
+
|
| 207 |
+
|
| 208 |
+
*/
|
| 209 |
+
|
| 210 |
+
end
|
| 211 |
+
|
| 212 |
+
endtask : slave_driver
|
| 213 |
+
|
| 214 |
+
|
| 215 |
+
|
| 216 |
+
|
| 217 |
+
|
| 218 |
+
`endif // WB_SLAVE__SV
|
| 219 |
+
|
| 220 |
+
|
Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/src/wb_slave.sv
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`ifndef WB_SLAVE__SV
|
| 2 |
+
`define WB_SLAVE__SV
|
| 3 |
+
|
| 4 |
+
typedef class wb_transaction;
|
| 5 |
+
typedef class wb_slave;
|
| 6 |
+
|
| 7 |
+
class wb_slave_callbacks extends uvm_callback;
|
| 8 |
+
|
| 9 |
+
// Called before a transaction is executed
|
| 10 |
+
virtual task pre_tx( wb_slave xactor, wb_transaction tr);
|
| 11 |
+
`uvm_info("WB_SLAVE",$sformatf("pre tx slave Not implemented yet"),UVM_LOW)
|
| 12 |
+
endtask: pre_tx
|
| 13 |
+
|
| 14 |
+
// Called after a transaction has been executed
|
| 15 |
+
virtual task post_tx( wb_slave xactor,
|
| 16 |
+
wb_transaction tr);
|
| 17 |
+
`uvm_info("WB_SLAVE",$sformatf("post tx slave Not implemented yet"),UVM_LOW)
|
| 18 |
+
|
| 19 |
+
endtask: post_tx
|
| 20 |
+
|
| 21 |
+
endclass: wb_slave_callbacks
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
class wb_slave extends uvm_driver # (wb_transaction);
|
| 25 |
+
|
| 26 |
+
wb_transaction m_tr; // This is what is captured
|
| 27 |
+
local bit [63:0] ram [*];
|
| 28 |
+
|
| 29 |
+
uvm_blocking_get_imp #(wb_transaction,wb_slave) getp;
|
| 30 |
+
|
| 31 |
+
wb_config wb_slave_cfg;
|
| 32 |
+
|
| 33 |
+
typedef virtual wb_slave_if v_if;
|
| 34 |
+
v_if drv_if;
|
| 35 |
+
`uvm_register_cb(wb_slave,wb_slave_callbacks);
|
| 36 |
+
|
| 37 |
+
extern function new(string name = "wb_slave",
|
| 38 |
+
uvm_component parent = null);
|
| 39 |
+
|
| 40 |
+
`uvm_component_utils(wb_slave)
|
| 41 |
+
|
| 42 |
+
extern virtual function void build_phase(uvm_phase phase);
|
| 43 |
+
extern virtual function void end_of_elaboration_phase(uvm_phase phase);
|
| 44 |
+
extern virtual function void connect_phase(uvm_phase phase);
|
| 45 |
+
extern virtual task reset_phase(uvm_phase phase);
|
| 46 |
+
extern virtual task configure_phase(uvm_phase phase);
|
| 47 |
+
extern virtual task run_phase(uvm_phase phase);
|
| 48 |
+
extern protected virtual task slave_driver();
|
| 49 |
+
|
| 50 |
+
task get(output wb_transaction transaction);
|
| 51 |
+
wait(m_tr != null )
|
| 52 |
+
transaction = m_tr;
|
| 53 |
+
m_tr = null;
|
| 54 |
+
endtask: get
|
| 55 |
+
|
| 56 |
+
endclass: wb_slave
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
function wb_slave::new(string name = "wb_slave",
|
| 63 |
+
uvm_component parent = null);
|
| 64 |
+
super.new(name, parent);
|
| 65 |
+
getp= new("slv_get_export",this);
|
| 66 |
+
|
| 67 |
+
endfunction: new
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
function void wb_slave::build_phase(uvm_phase phase);
|
| 71 |
+
super.build_phase(phase);
|
| 72 |
+
endfunction: build_phase
|
| 73 |
+
|
| 74 |
+
function void wb_slave::connect_phase(uvm_phase phase);
|
| 75 |
+
super.connect_phase(phase);
|
| 76 |
+
if(!uvm_config_db#(v_if)::get(this, "", "slv_if", drv_if))
|
| 77 |
+
`uvm_fatal("NOVIF SLV DRIVER",{"virtual interface must be set for: ","WB_SLAVE",".v_if"});
|
| 78 |
+
endfunction: connect_phase
|
| 79 |
+
|
| 80 |
+
function void wb_slave::end_of_elaboration_phase(uvm_phase phase);
|
| 81 |
+
super.end_of_elaboration_phase(phase);
|
| 82 |
+
if (drv_if == null)
|
| 83 |
+
`uvm_fatal("NO_CONN", "Virtual port not connected to the actual interface instance");
|
| 84 |
+
endfunction: end_of_elaboration_phase
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
task wb_slave::reset_phase(uvm_phase phase);
|
| 89 |
+
super.reset_phase(phase);
|
| 90 |
+
phase.raise_objection(this,"");
|
| 91 |
+
this.drv_if.DAT_O <= 64'bz;
|
| 92 |
+
this.drv_if.TGD_O <= 16'bz;
|
| 93 |
+
this.drv_if.ACK_O <= 1'bz;
|
| 94 |
+
this.drv_if.RTY_O <= 1'bz;
|
| 95 |
+
this.drv_if.ERR_O <= 1'bz;
|
| 96 |
+
phase.drop_objection(this);
|
| 97 |
+
endtask: reset_phase
|
| 98 |
+
|
| 99 |
+
task wb_slave::configure_phase(uvm_phase phase);
|
| 100 |
+
super.configure_phase(phase);
|
| 101 |
+
phase.raise_objection(this,"");
|
| 102 |
+
|
| 103 |
+
phase.drop_objection(this);
|
| 104 |
+
endtask:configure_phase
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
task wb_slave::run_phase(uvm_phase phase);
|
| 108 |
+
super.configure_phase(phase);
|
| 109 |
+
//phase.raise_objection(this,"");
|
| 110 |
+
fork
|
| 111 |
+
slave_driver();
|
| 112 |
+
join_none
|
| 113 |
+
//phase.drop_objection(this);
|
| 114 |
+
endtask: run_phase
|
| 115 |
+
|
| 116 |
+
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
task wb_slave::slave_driver();
|
| 120 |
+
bit [63:0] read_data;
|
| 121 |
+
wb_slave_cfg.print();
|
| 122 |
+
forever begin
|
| 123 |
+
wb_transaction tr;
|
| 124 |
+
|
| 125 |
+
do begin
|
| 126 |
+
if (this.drv_if.CYC_I !== 1'b1 || this.drv_if.STB_I !== 1'b1) begin
|
| 127 |
+
this.drv_if.DAT_O <= 64'bz;
|
| 128 |
+
this.drv_if.TGD_O <= 16'bz;
|
| 129 |
+
this.drv_if.ACK_O <= 1'bz;
|
| 130 |
+
this.drv_if.RTY_O <= 1'bz;
|
| 131 |
+
this.drv_if.ERR_O <= 1'bz;
|
| 132 |
+
end
|
| 133 |
+
|
| 134 |
+
@(this.drv_if.CYC_I or
|
| 135 |
+
this.drv_if.STB_I or
|
| 136 |
+
this.drv_if.ADR_I or
|
| 137 |
+
this.drv_if.SEL_I or
|
| 138 |
+
this.drv_if.WE_I or
|
| 139 |
+
this.drv_if.TGA_I or
|
| 140 |
+
this.drv_if.TGC_I);
|
| 141 |
+
end while (this.drv_if.CYC_I !== 1'b1 ||
|
| 142 |
+
this.drv_if.STB_I !== 1'b1);
|
| 143 |
+
tr= wb_transaction::type_id::create("tr", this);
|
| 144 |
+
tr.address = this.drv_if.ADR_I;
|
| 145 |
+
// Are we supposed to respond to this cycle?
|
| 146 |
+
if(this.wb_slave_cfg.min_addr <= tr.address && tr.address <=this.wb_slave_cfg.max_addr )
|
| 147 |
+
begin
|
| 148 |
+
tr.sel = this.drv_if.SEL_I;
|
| 149 |
+
tr.tgc = this.drv_if.TGC_I;
|
| 150 |
+
`uvm_do_callbacks(wb_slave,wb_slave_callbacks, pre_tx(this, tr))
|
| 151 |
+
tr.tga = this.drv_if.TGA_I;
|
| 152 |
+
if(this.drv_if.WE_I) begin
|
| 153 |
+
tr.kind = wb_transaction::WRITE;
|
| 154 |
+
`uvm_info("Wb_slave","got a write transaction from Master ",UVM_LOW)
|
| 155 |
+
tr.data = this.drv_if.DAT_I;
|
| 156 |
+
tr.tgd = this.drv_if.TGD_I;
|
| 157 |
+
end
|
| 158 |
+
else begin
|
| 159 |
+
tr.kind = wb_transaction::READ ;
|
| 160 |
+
`uvm_info("Wb_slave","got a read transaction ",UVM_LOW)
|
| 161 |
+
end
|
| 162 |
+
m_tr = tr;
|
| 163 |
+
seq_item_port.get_next_item(tr);
|
| 164 |
+
this.drv_if.DAT_O = 64'bz;
|
| 165 |
+
if(tr.kind == wb_transaction::READ) begin
|
| 166 |
+
this.drv_if.DAT_O = tr.data;
|
| 167 |
+
end
|
| 168 |
+
|
| 169 |
+
repeat (this.wb_slave_cfg.max_n_wss) begin
|
| 170 |
+
@ (this.drv_if.slave_cb);
|
| 171 |
+
end
|
| 172 |
+
this.drv_if.ACK_O <= 1'b1;
|
| 173 |
+
this.drv_if.RTY_O <= 1'b0;
|
| 174 |
+
this.drv_if.ERR_O <= 1'b0;
|
| 175 |
+
@ (this.drv_if.slave_cb);
|
| 176 |
+
this.drv_if.ACK_O <= 1'b0;
|
| 177 |
+
@(this.drv_if.slave_cb);
|
| 178 |
+
this.drv_if.DAT_O <= 64'bz;
|
| 179 |
+
`uvm_do_callbacks(wb_slave,wb_slave_callbacks, post_tx(this, tr))
|
| 180 |
+
`uvm_info("SLAVE_DRIVER", "Completed transaction...",UVM_LOW)
|
| 181 |
+
seq_item_port.item_done(tr);
|
| 182 |
+
end // if
|
| 183 |
+
end //forever
|
| 184 |
+
endtask : slave_driver
|
| 185 |
+
|
| 186 |
+
`endif // WB_SLAVE__SV
|
| 187 |
+
|
| 188 |
+
|
Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/src/wb_slave_agent_sequence_library.sv
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//
|
| 2 |
+
// Template for UVM-compliant sequence library
|
| 3 |
+
//
|
| 4 |
+
|
| 5 |
+
typedef class wb_transaction;
|
| 6 |
+
|
| 7 |
+
class wb_slave_seqr_sequence_library extends uvm_sequence_library # (wb_transaction);
|
| 8 |
+
`uvm_sequence_library_utils(wb_slave_seqr_sequence_library)
|
| 9 |
+
|
| 10 |
+
function new(string name = "slave_seq_lib");
|
| 11 |
+
super.new(name);
|
| 12 |
+
init_sequence_library();
|
| 13 |
+
endfunction
|
| 14 |
+
|
| 15 |
+
endclass
|
| 16 |
+
|
| 17 |
+
class slv_base_sequence extends uvm_sequence #(wb_transaction);
|
| 18 |
+
|
| 19 |
+
`uvm_object_utils(slv_base_sequence)
|
| 20 |
+
|
| 21 |
+
`uvm_declare_p_sequencer(wb_slave_seqr)
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
function new(string name = "base_seq");
|
| 25 |
+
super.new(name);
|
| 26 |
+
endfunction:new
|
| 27 |
+
virtual task pre_body();
|
| 28 |
+
uvm_phase phase_ = get_starting_phase();
|
| 29 |
+
if (phase_ != null)
|
| 30 |
+
phase_.raise_objection(this);
|
| 31 |
+
endtask:pre_body
|
| 32 |
+
virtual task post_body();
|
| 33 |
+
uvm_phase phase_ = get_starting_phase();
|
| 34 |
+
if (phase_ != null)
|
| 35 |
+
phase_.drop_objection(this);
|
| 36 |
+
endtask:post_body
|
| 37 |
+
endclass
|
| 38 |
+
|
| 39 |
+
class ram_sequence extends uvm_sequence #(wb_transaction);
|
| 40 |
+
`uvm_object_utils(ram_sequence)
|
| 41 |
+
`uvm_declare_p_sequencer(wb_slave_seqr)
|
| 42 |
+
`uvm_add_to_seq_lib(ram_sequence,wb_slave_seqr_sequence_library)
|
| 43 |
+
function new(string name = "seq_0");
|
| 44 |
+
super.new(name);
|
| 45 |
+
endfunction:new
|
| 46 |
+
virtual task body();
|
| 47 |
+
wb_transaction tr;
|
| 48 |
+
forever begin
|
| 49 |
+
p_sequencer.wait_for_req(this, tr);
|
| 50 |
+
`uvm_info(get_full_name(),$sformatf("In SLAVE SEQUENCER, Transaction address = %h kind = %s",tr.address,tr.kind.name()),UVM_LOW)
|
| 51 |
+
case (tr.kind)
|
| 52 |
+
wb_transaction::WRITE: p_sequencer.write(tr.address, tr.data);
|
| 53 |
+
wb_transaction::READ: tr.data = p_sequencer.read(tr.address);
|
| 54 |
+
endcase
|
| 55 |
+
tr.status = wb_transaction::ACK;
|
| 56 |
+
`uvm_info(get_full_name(),$sformatf("SLAVE SEQUENCER OUTPUT, Transaction address = %h kind = %s data = %h",tr.address,tr.kind.name(), tr.data),UVM_LOW)
|
| 57 |
+
p_sequencer.send_rsp(this, tr);
|
| 58 |
+
end
|
| 59 |
+
endtask
|
| 60 |
+
|
| 61 |
+
endclass
|
| 62 |
+
|
Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/src/wb_slave_if.sv
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`ifndef WB_SLAVE_IF__SV
|
| 2 |
+
`define WB_SLAVE_IF__SV
|
| 3 |
+
|
| 4 |
+
interface wb_slave_if (input bit clk, input bit rst);
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
parameter setup_time = 5/*ns*/;
|
| 8 |
+
parameter hold_time = 3/*ns*/;
|
| 9 |
+
|
| 10 |
+
// Common Signals
|
| 11 |
+
wire CYC_I;
|
| 12 |
+
wire [63:0] DAT_I;
|
| 13 |
+
logic [63:0] DAT_O;
|
| 14 |
+
wire RST_I;
|
| 15 |
+
wire [15:0] TGD_I;
|
| 16 |
+
logic [15:0] TGD_O;
|
| 17 |
+
// Slave Signals
|
| 18 |
+
logic ACK_O ;
|
| 19 |
+
logic [63:0] ADR_I;
|
| 20 |
+
logic ERR_O ;
|
| 21 |
+
logic LOCK_I ;
|
| 22 |
+
logic RTY_O ;
|
| 23 |
+
logic [7:0] SEL_I ;
|
| 24 |
+
logic STB_I ;
|
| 25 |
+
logic [15:0] TGA_I ;
|
| 26 |
+
logic [15:0] TGC_I ;
|
| 27 |
+
logic WE_I ;
|
| 28 |
+
|
| 29 |
+
clocking slave_cb @(posedge clk);
|
| 30 |
+
default input #setup_time output #hold_time;
|
| 31 |
+
|
| 32 |
+
// Common Signals
|
| 33 |
+
input CYC_I;
|
| 34 |
+
input DAT_I;
|
| 35 |
+
output DAT_O;
|
| 36 |
+
input RST_I;
|
| 37 |
+
input TGD_I;
|
| 38 |
+
output TGD_O;
|
| 39 |
+
// Slave Signals
|
| 40 |
+
output ACK_O ;
|
| 41 |
+
input ADR_I;
|
| 42 |
+
output ERR_O ;
|
| 43 |
+
input LOCK_I ;
|
| 44 |
+
output RTY_O ;
|
| 45 |
+
input SEL_I ;
|
| 46 |
+
input STB_I ;
|
| 47 |
+
input TGA_I ;
|
| 48 |
+
input TGC_I ;
|
| 49 |
+
input WE_I ;
|
| 50 |
+
|
| 51 |
+
endclocking: slave_cb
|
| 52 |
+
|
| 53 |
+
clocking slave_mon_cb @(posedge clk);
|
| 54 |
+
default input #setup_time output #hold_time;
|
| 55 |
+
|
| 56 |
+
// Common Signals
|
| 57 |
+
input CYC_I;
|
| 58 |
+
input DAT_I;
|
| 59 |
+
input DAT_O;
|
| 60 |
+
input RST_I;
|
| 61 |
+
input TGD_I;
|
| 62 |
+
input TGD_O;
|
| 63 |
+
// Slave Signals
|
| 64 |
+
input ACK_O ;
|
| 65 |
+
input ADR_I;
|
| 66 |
+
input ERR_O ;
|
| 67 |
+
input LOCK_I ;
|
| 68 |
+
input RTY_O ;
|
| 69 |
+
input SEL_I ;
|
| 70 |
+
input STB_I ;
|
| 71 |
+
input TGA_I ;
|
| 72 |
+
input TGC_I ;
|
| 73 |
+
input WE_I;
|
| 74 |
+
|
| 75 |
+
endclocking: slave_mon_cb
|
| 76 |
+
modport slave (clocking slave_cb);
|
| 77 |
+
|
| 78 |
+
modport slave_mon (clocking slave_mon_cb);
|
| 79 |
+
|
| 80 |
+
endinterface: wb_slave_if
|
| 81 |
+
|
| 82 |
+
`endif // WB_SLAVE_IF__SV
|
Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/src/wb_slave_mon.sv
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`ifndef WB_SLAVE_MON__SV
|
| 2 |
+
`define WB_SLAVE_MON__SV
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
typedef class wb_transaction;
|
| 6 |
+
typedef class wb_slave_mon;
|
| 7 |
+
typedef class wb_config;
|
| 8 |
+
|
| 9 |
+
class wb_slave_mon_callbacks extends uvm_callback;
|
| 10 |
+
|
| 11 |
+
// ToDo: Add additional relevant callbacks
|
| 12 |
+
// ToDo: Use a task if callbacks can be blocking
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
// Called at start of observed transaction
|
| 16 |
+
virtual function void pre_trans(wb_slave_mon xactor,
|
| 17 |
+
wb_transaction tr);
|
| 18 |
+
endfunction: pre_trans
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
// Called before acknowledging a transaction
|
| 22 |
+
virtual function pre_ack(wb_slave_mon xactor,
|
| 23 |
+
wb_transaction tr);
|
| 24 |
+
endfunction: pre_ack
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
// Called at end of observed transaction
|
| 28 |
+
virtual function void post_trans(wb_slave_mon xactor,
|
| 29 |
+
wb_transaction tr);
|
| 30 |
+
endfunction: post_trans
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
// Callback method post_cb_trans can be used for coverage
|
| 34 |
+
virtual task post_cb_trans(wb_slave_mon xactor,
|
| 35 |
+
wb_transaction tr);
|
| 36 |
+
endtask: post_cb_trans
|
| 37 |
+
|
| 38 |
+
endclass: wb_slave_mon_callbacks
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
class wb_slave_mon extends uvm_monitor;
|
| 43 |
+
|
| 44 |
+
uvm_analysis_port #(wb_transaction) mon_analysis_port; //TLM analysis port
|
| 45 |
+
typedef virtual wb_slave_if v_if;
|
| 46 |
+
v_if mon_if;
|
| 47 |
+
|
| 48 |
+
// ToDo: Add another class property if required
|
| 49 |
+
|
| 50 |
+
wb_config slv_mon_cfg;
|
| 51 |
+
extern function new(string name = "wb_slave_mon",uvm_component parent);
|
| 52 |
+
`uvm_register_cb(wb_slave_mon,wb_slave_mon_callbacks);
|
| 53 |
+
|
| 54 |
+
`uvm_component_utils_begin(wb_slave_mon)
|
| 55 |
+
// ToDo: Add uvm monitor member if any class property added later through field macros
|
| 56 |
+
|
| 57 |
+
`uvm_component_utils_end
|
| 58 |
+
// ToDo: Add required short hand override method
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
extern virtual function void build_phase(uvm_phase phase);
|
| 62 |
+
extern virtual function void connect_phase(uvm_phase phase);
|
| 63 |
+
extern virtual task reset_phase(uvm_phase phase);
|
| 64 |
+
extern virtual task configure_phase(uvm_phase phase);
|
| 65 |
+
extern virtual task run_phase(uvm_phase phase);
|
| 66 |
+
extern protected virtual task slave_monitor_task();
|
| 67 |
+
|
| 68 |
+
endclass: wb_slave_mon
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
function wb_slave_mon::new(string name = "wb_slave_mon",uvm_component parent);
|
| 72 |
+
super.new(name, parent);
|
| 73 |
+
mon_analysis_port = new ("mon_analysis_port",this);
|
| 74 |
+
endfunction: new
|
| 75 |
+
|
| 76 |
+
function void wb_slave_mon::build_phase(uvm_phase phase);
|
| 77 |
+
super.build_phase(phase);
|
| 78 |
+
//ToDo : Implement this phase here
|
| 79 |
+
|
| 80 |
+
endfunction: build_phase
|
| 81 |
+
|
| 82 |
+
function void wb_slave_mon::connect_phase(uvm_phase phase);
|
| 83 |
+
super.connect_phase(phase);
|
| 84 |
+
uvm_config_db#(v_if)::get(this, "", "mon_if", mon_if);
|
| 85 |
+
endfunction: connect_phase
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
task wb_slave_mon::reset_phase(uvm_phase phase);
|
| 90 |
+
super.reset_phase(phase);
|
| 91 |
+
phase.raise_objection(this,"");
|
| 92 |
+
// ToDo: Implement reset here
|
| 93 |
+
phase.drop_objection(this);
|
| 94 |
+
|
| 95 |
+
endtask: reset_phase
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
task wb_slave_mon::configure_phase(uvm_phase phase);
|
| 99 |
+
super.configure_phase(phase);
|
| 100 |
+
phase.raise_objection(this,"");
|
| 101 |
+
//ToDo: Configure your component here
|
| 102 |
+
phase.drop_objection(this);
|
| 103 |
+
|
| 104 |
+
endtask:configure_phase
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
task wb_slave_mon::run_phase(uvm_phase phase);
|
| 108 |
+
super.configure_phase(phase);
|
| 109 |
+
phase.raise_objection(this,"");
|
| 110 |
+
fork
|
| 111 |
+
slave_monitor_task();
|
| 112 |
+
join_none
|
| 113 |
+
phase.drop_objection(this);
|
| 114 |
+
`uvm_info("wb_env_SLAVE MONITOR", "Dropped objections ...",UVM_HIGH)
|
| 115 |
+
|
| 116 |
+
endtask: run_phase
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
task wb_slave_mon::slave_monitor_task();
|
| 120 |
+
|
| 121 |
+
forever begin
|
| 122 |
+
wb_transaction tr;
|
| 123 |
+
|
| 124 |
+
do begin
|
| 125 |
+
|
| 126 |
+
@(this.mon_if.CYC_I or
|
| 127 |
+
this.mon_if.STB_I or
|
| 128 |
+
this.mon_if.ADR_I or
|
| 129 |
+
this.mon_if.SEL_I or
|
| 130 |
+
this.mon_if.WE_I or
|
| 131 |
+
this.mon_if.TGA_I or
|
| 132 |
+
this.mon_if.TGC_I);
|
| 133 |
+
end while (this.mon_if.CYC_I !== 1'b1 ||
|
| 134 |
+
this.mon_if.STB_I !== 1'b1);
|
| 135 |
+
tr= wb_transaction::type_id::create("tr", this);
|
| 136 |
+
tr.address = this.mon_if.ADR_I;
|
| 137 |
+
// Are we supposed to respond to this cycle?
|
| 138 |
+
if(this.slv_mon_cfg.min_addr <= tr.address && tr.address <=this.slv_mon_cfg.max_addr )
|
| 139 |
+
begin
|
| 140 |
+
`uvm_do_callbacks(wb_slave_mon,wb_slave_mon_callbacks,
|
| 141 |
+
pre_trans(this, tr))
|
| 142 |
+
|
| 143 |
+
tr.tga = this.mon_if.TGA_I;
|
| 144 |
+
if(this.mon_if.WE_I) begin
|
| 145 |
+
tr.kind = wb_transaction::WRITE;
|
| 146 |
+
`uvm_info("WB slave Monitor","got a write transaction from Master ",UVM_LOW)
|
| 147 |
+
tr.data = this.mon_if.DAT_I;
|
| 148 |
+
tr.tgd = this.mon_if.TGD_I;
|
| 149 |
+
tr.status = wb_transaction::ACK;
|
| 150 |
+
end
|
| 151 |
+
else begin
|
| 152 |
+
tr.kind = wb_transaction::READ ;
|
| 153 |
+
`uvm_info("Wb_slave Monitor","got a read transaction ",UVM_LOW)
|
| 154 |
+
tr.data = this.mon_if.DAT_I;
|
| 155 |
+
tr.tgd = this.mon_if.TGD_I;
|
| 156 |
+
|
| 157 |
+
tr.status = wb_transaction::ACK;
|
| 158 |
+
end
|
| 159 |
+
|
| 160 |
+
`uvm_do_callbacks(wb_slave_mon,wb_slave_mon_callbacks,
|
| 161 |
+
pre_ack(this, tr))
|
| 162 |
+
|
| 163 |
+
repeat (this.slv_mon_cfg.max_n_wss) begin
|
| 164 |
+
@ (this.mon_if.slave_mon_cb);
|
| 165 |
+
end
|
| 166 |
+
|
| 167 |
+
|
| 168 |
+
|
| 169 |
+
tr.sel = this.mon_if.SEL_I;
|
| 170 |
+
tr.tgc = this.mon_if.TGC_I;
|
| 171 |
+
@(this.mon_if.slave_mon_cb);
|
| 172 |
+
end
|
| 173 |
+
`uvm_do_callbacks(wb_slave_mon,wb_slave_mon_callbacks,
|
| 174 |
+
post_trans(this, tr))
|
| 175 |
+
mon_analysis_port.write(tr);
|
| 176 |
+
end
|
| 177 |
+
|
| 178 |
+
endtask: slave_monitor_task
|
| 179 |
+
|
| 180 |
+
|
| 181 |
+
|
| 182 |
+
|
| 183 |
+
|
| 184 |
+
|
| 185 |
+
`endif // WB_SLAVE_MON__SV
|
Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/src/wb_slave_seqr.sv
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`ifndef WB_SLAVE_SEQR
|
| 2 |
+
`define WB_SLAVE_SEQR
|
| 3 |
+
typedef class wb_transaction;
|
| 4 |
+
class wb_slave_seqr extends uvm_sequencer # (wb_transaction);
|
| 5 |
+
|
| 6 |
+
uvm_blocking_get_port #(wb_transaction) m_getp;
|
| 7 |
+
|
| 8 |
+
local bit [63:0] ram [*];
|
| 9 |
+
`uvm_component_utils(wb_slave_seqr)
|
| 10 |
+
function new (string name,
|
| 11 |
+
uvm_component parent);
|
| 12 |
+
super.new(name,parent);
|
| 13 |
+
m_getp = new("slave_get_port",this);
|
| 14 |
+
set_arbitration(UVM_SEQ_ARB_STRICT_FIFO);
|
| 15 |
+
|
| 16 |
+
endfunction:new
|
| 17 |
+
|
| 18 |
+
task wait_for_req(uvm_sequence_base seq, output wb_transaction req);
|
| 19 |
+
wait_for_grant(seq);
|
| 20 |
+
m_getp.get(req);
|
| 21 |
+
endtask
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
task send_rsp(uvm_sequence_base seq, wb_transaction rsp);
|
| 25 |
+
rsp.set_item_context(seq);
|
| 26 |
+
seq.finish_item(rsp);
|
| 27 |
+
endtask
|
| 28 |
+
|
| 29 |
+
function bit [63:0] read(bit [63:0] addr);
|
| 30 |
+
read = (this.ram.exists(addr)) ? this.ram[addr] : 64'bx;
|
| 31 |
+
endfunction: read
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
function void write(bit [63:0] addr,
|
| 35 |
+
bit [63:0] data);
|
| 36 |
+
this.ram[addr] = data;
|
| 37 |
+
endfunction: write
|
| 38 |
+
|
| 39 |
+
function void start_of_simulation_phase(uvm_phase phase);
|
| 40 |
+
integer i;
|
| 41 |
+
super.start_of_simulation_phase(phase);
|
| 42 |
+
`uvm_info("WB_SLAVE_SEQR","Initializing memory",UVM_MEDIUM)
|
| 43 |
+
for(i = 0; i < 1000; i++) begin
|
| 44 |
+
write(i,i * 10);
|
| 45 |
+
end
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
endfunction
|
| 49 |
+
|
| 50 |
+
endclass:wb_slave_seqr
|
| 51 |
+
`endif
|
Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/src/wb_transaction.sv
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Template for UVM-compliant transaction descriptor
|
| 3 |
+
* this class provides the basic transaction required
|
| 4 |
+
* by the WB Master and WB Slave Agents
|
| 5 |
+
*/
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
`ifndef WB_TRANSACTION__SV
|
| 9 |
+
`define WB_TRANSACTION__SV
|
| 10 |
+
|
| 11 |
+
typedef class wb_config;
|
| 12 |
+
class wb_transaction extends uvm_sequence_item;
|
| 13 |
+
|
| 14 |
+
// Different types of read and Write cycles.
|
| 15 |
+
typedef enum {READ, WRITE, BLK_RD, BLK_WR, RMW} kinds_e;
|
| 16 |
+
rand kinds_e kind;
|
| 17 |
+
|
| 18 |
+
// This is the status of the transaction
|
| 19 |
+
typedef enum {OK, ACK, RTY, ERR, TIMEOUT ,INFLIGHT , UNKNOWN } status_e;
|
| 20 |
+
wb_config cfg; // Must be non-NULL to randomize
|
| 21 |
+
|
| 22 |
+
rand status_e status;
|
| 23 |
+
|
| 24 |
+
typedef enum {CLASSIC, CONSTANT,
|
| 25 |
+
LINEAR, WRAP4, WRAP8, WRAP16,
|
| 26 |
+
EOB} pipelining_e;
|
| 27 |
+
rand pipelining_e next_cycle;
|
| 28 |
+
|
| 29 |
+
rand bit [63:0] address;
|
| 30 |
+
rand bit [63:0] data;
|
| 31 |
+
rand bit [ 7:0] sel;
|
| 32 |
+
rand bit [15:0] tgc;
|
| 33 |
+
rand bit [15:0] tga;
|
| 34 |
+
rand bit [15:0] tgd;
|
| 35 |
+
rand bit lock;
|
| 36 |
+
rand bit [15:0] tag;
|
| 37 |
+
|
| 38 |
+
int num_wait_states;
|
| 39 |
+
|
| 40 |
+
constraint supported {
|
| 41 |
+
next_cycle == CLASSIC;
|
| 42 |
+
kind == READ || kind == WRITE;
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
constraint valid_address {
|
| 46 |
+
if (cfg.port_size - cfg.granularity == 1) address[0:0] == 1'b0;
|
| 47 |
+
if (cfg.port_size - cfg.granularity == 2) address[1:0] == 2'b00;
|
| 48 |
+
if (cfg.port_size - cfg.granularity == 3) address[2:0] == 3'b000;
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
constraint valid_sel {
|
| 52 |
+
sel inside {8'h01, 8'h03, 8'h07, 8'h0F, 8'h1F, 8'h3F, 8'h7F, 8'hFF};
|
| 53 |
+
if (cfg.port_size - cfg.granularity == 0) sel[7:1] == 7'h00;
|
| 54 |
+
if (cfg.port_size - cfg.granularity == 1) sel[7:2] == 6'h00;
|
| 55 |
+
if (cfg.port_size - cfg.granularity == 2) sel[7:4] == 4'h0;
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
constraint wb_transaction_valid {
|
| 60 |
+
status == OK;
|
| 61 |
+
if (cfg.cycles == wb_config::CLASSIC ) next_cycle == CLASSIC;
|
| 62 |
+
|
| 63 |
+
}
|
| 64 |
+
`uvm_object_utils_begin(wb_transaction)
|
| 65 |
+
`uvm_field_int(address,UVM_DEFAULT)
|
| 66 |
+
`uvm_field_int(data,UVM_DEFAULT)
|
| 67 |
+
`uvm_field_int(sel,UVM_DEFAULT)
|
| 68 |
+
`uvm_field_int(tga,UVM_DEFAULT)
|
| 69 |
+
`uvm_field_int(tgc,UVM_DEFAULT)
|
| 70 |
+
`uvm_field_int(lock,UVM_DEFAULT)
|
| 71 |
+
`uvm_field_int(num_wait_states,UVM_DEFAULT)
|
| 72 |
+
`uvm_field_enum(kinds_e,kind,UVM_DEFAULT)
|
| 73 |
+
`uvm_field_enum(status_e,status, UVM_DEFAULT)
|
| 74 |
+
`uvm_field_enum(pipelining_e,next_cycle, UVM_DEFAULT)
|
| 75 |
+
`uvm_object_utils_end
|
| 76 |
+
|
| 77 |
+
function new(string name="" );
|
| 78 |
+
super.new(name);
|
| 79 |
+
cfg = new();
|
| 80 |
+
endfunction: new
|
| 81 |
+
|
| 82 |
+
endclass: wb_transaction
|
| 83 |
+
|
| 84 |
+
`endif // WB_TRANSACTION__SV
|
Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/src/wb_transaction_extended.sv
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`ifndef WB_TRANSACTION_EXTENDED__SV
|
| 2 |
+
`define WB_TRANSACTION_EXTENDED__SV
|
| 3 |
+
|
| 4 |
+
class wb_transaction_extended extends wb_transaction;
|
| 5 |
+
|
| 6 |
+
constraint my_new_constraint {
|
| 7 |
+
address inside {32'h01, 32'h03, 32'h07, 32'h0F, 32'h1F, 32'h3F, 32'h7F, 32'hFF};
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
`uvm_object_utils(wb_transaction_extended)
|
| 11 |
+
|
| 12 |
+
function new(string name="" );
|
| 13 |
+
super.new(name);
|
| 14 |
+
endfunction: new
|
| 15 |
+
|
| 16 |
+
endclass: wb_transaction_extended
|
| 17 |
+
|
| 18 |
+
`endif // WB_TRANSACTION_EXTENDED__SV
|
Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/tests/wb_env_base_test.sv
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`ifndef BASE_TEST__SV
|
| 2 |
+
`define BASE_TEST__SV
|
| 3 |
+
|
| 4 |
+
typedef class wb_env;
|
| 5 |
+
|
| 6 |
+
class wb_env_base_test extends uvm_test;
|
| 7 |
+
bit test_pass = 1;
|
| 8 |
+
|
| 9 |
+
wb_config wb_master_config;
|
| 10 |
+
wb_config wb_slave_config;
|
| 11 |
+
|
| 12 |
+
`uvm_component_utils(wb_env_base_test)
|
| 13 |
+
|
| 14 |
+
wb_env env;
|
| 15 |
+
|
| 16 |
+
function new(string name, uvm_component parent);
|
| 17 |
+
super.new(name, parent);
|
| 18 |
+
endfunction
|
| 19 |
+
|
| 20 |
+
virtual function void build_phase(uvm_phase phase);
|
| 21 |
+
super.build_phase(phase);
|
| 22 |
+
env = wb_env::type_id::create("env", this);
|
| 23 |
+
wb_master_config = new("wb_master_config");
|
| 24 |
+
wb_slave_config = new("wb_slave_config");
|
| 25 |
+
|
| 26 |
+
wb_master_config.max_n_wss = 10;
|
| 27 |
+
wb_master_config.min_addr = 0;
|
| 28 |
+
wb_master_config.max_addr = 10000000;
|
| 29 |
+
|
| 30 |
+
wb_slave_config.max_n_wss = 10;
|
| 31 |
+
wb_slave_config.min_addr = 0;
|
| 32 |
+
wb_slave_config.max_addr = 10000000;
|
| 33 |
+
|
| 34 |
+
begin: configure
|
| 35 |
+
uvm_config_db #(uvm_object_wrapper)::set(this, "env.master_agent.mast_sqr.run_phase", "default_sequence", sequence_1::get_type());
|
| 36 |
+
uvm_config_db #(uvm_object_wrapper)::set(this, "env.slave_agent.slv_seqr.run_phase", "default_sequence", ram_sequence::get_type());
|
| 37 |
+
|
| 38 |
+
uvm_config_db #(wb_config)::set(this, "env.master_agent", "config", wb_master_config);
|
| 39 |
+
uvm_config_db #(wb_config)::set(this, "env.slave_agent", "config", wb_slave_config);
|
| 40 |
+
end
|
| 41 |
+
endfunction
|
| 42 |
+
task run_phase(uvm_phase phase);
|
| 43 |
+
// obj_.set_drain_time(this, 50); Dont use this. Use Objections in Sequence
|
| 44 |
+
endtask : run_phase
|
| 45 |
+
|
| 46 |
+
endclass : wb_env_base_test
|
| 47 |
+
|
| 48 |
+
`endif //BASE_TEST__SV
|
| 49 |
+
|
Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/tests/wb_env_tb_mod.sv
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Code your testbench here
|
| 2 |
+
// or browse Examples
|
| 3 |
+
|
| 4 |
+
`ifndef WB_ENV_TB_MOD__SV
|
| 5 |
+
`define WB_ENV_TB_MOD__SV
|
| 6 |
+
`include "uvm_macros.svh"
|
| 7 |
+
|
| 8 |
+
//`include "mstr_slv_intfs.incl"
|
| 9 |
+
`include "wb_test.pkg"
|
| 10 |
+
|
| 11 |
+
module wb_env_tb_mod;
|
| 12 |
+
|
| 13 |
+
import uvm_pkg::*;
|
| 14 |
+
import wb_tests::*;
|
| 15 |
+
|
| 16 |
+
typedef virtual wb_master_if v_if1;
|
| 17 |
+
typedef virtual wb_slave_if v_if2;
|
| 18 |
+
initial begin
|
| 19 |
+
uvm_config_db #(v_if1)::set(null,"uvm_test_top.env.master_agent","mst_if",wb_env_top_mod.mast_if);
|
| 20 |
+
uvm_config_db #(v_if2)::set(null,"uvm_test_top.env.slave_agent","slv_if",wb_env_top_mod.slave_if);
|
| 21 |
+
uvm_config_db #(bit) :: set(null,"env.slave_agent","is_active",1);
|
| 22 |
+
uvm_config_db #(bit) :: set(null,"env.master_agent","is_active",1);
|
| 23 |
+
|
| 24 |
+
run_test();
|
| 25 |
+
end
|
| 26 |
+
|
| 27 |
+
endmodule: wb_env_tb_mod
|
| 28 |
+
|
| 29 |
+
`endif // WB_ENV_TB_MOD__SV
|
| 30 |
+
|
Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/tests/wb_env_test.sv
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`ifndef WB_ENV_TEST
|
| 2 |
+
`define WB_ENV_TEST
|
| 3 |
+
typedef class wb_env_env;
|
| 4 |
+
|
| 5 |
+
class wb_env_test extends uvm_test;
|
| 6 |
+
bit test_pass = 1;
|
| 7 |
+
wb_config master_config;
|
| 8 |
+
wb_config slave_config;
|
| 9 |
+
int slave_adr_max ;
|
| 10 |
+
int slave_adr_min;
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
`uvm_component_utils(wb_env_test)
|
| 15 |
+
|
| 16 |
+
wb_env_env env;
|
| 17 |
+
|
| 18 |
+
function new(string name, uvm_component parent);
|
| 19 |
+
super.new(name, parent);
|
| 20 |
+
endfunction
|
| 21 |
+
|
| 22 |
+
virtual function void build_phase(uvm_phase phase);
|
| 23 |
+
super.build_phase(phase);
|
| 24 |
+
slave_adr_min = 32'h0;
|
| 25 |
+
slave_adr_max = 32'h0fffffe;
|
| 26 |
+
|
| 27 |
+
// Create and Build the configuration
|
| 28 |
+
master_config = wb_config::type_id::create("master_configuration");
|
| 29 |
+
slave_config = wb_config::type_id::create("slave_configuration");
|
| 30 |
+
// Randomize the configuration
|
| 31 |
+
slave_config.randomize with {min_addr == slave_adr_min; max_addr == slave_adr_max; max_n_wss == 2; };
|
| 32 |
+
master_config.randomize with {min_addr == slave_adr_min; max_addr == slave_adr_max; max_n_wss == 2; };
|
| 33 |
+
// Set in Config DB
|
| 34 |
+
uvm_config_db #(wb_config)::set(null,"uvm_test_top.env.master_agent","mstr_agent_cfg",master_config);
|
| 35 |
+
uvm_config_db #(wb_config)::set(null,"uvm_test_top.env.slave_agent","mstr_agent_cfg",slave_config);
|
| 36 |
+
env = wb_env_env::type_id::create("env", this);
|
| 37 |
+
|
| 38 |
+
uvm_config_db #(uvm_object_wrapper)::set(this, "env.master_agent.mast_sqr.main_phase", "default_sequence", sequence_1::get_type());
|
| 39 |
+
endfunction
|
| 40 |
+
|
| 41 |
+
function void report_phase(uvm_phase phase);
|
| 42 |
+
if(test_pass) begin
|
| 43 |
+
`uvm_info(get_type_name(), "** UVM TEST PASSED **", UVM_NONE)
|
| 44 |
+
end
|
| 45 |
+
else begin
|
| 46 |
+
`uvm_error(get_type_name(), "** UVM TEST FAIL **")
|
| 47 |
+
end
|
| 48 |
+
endfunction
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
endclass : wb_env_test
|
| 52 |
+
|
| 53 |
+
`endif //TEST__SV
|
| 54 |
+
|
Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_2-Putting_it_all_Together/tests/wb_env_test_extended.sv
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
class wb_env_test_extended extends wb_env_base_test;
|
| 3 |
+
|
| 4 |
+
`uvm_component_utils(wb_env_test_extended)
|
| 5 |
+
|
| 6 |
+
virtual function void build_phase(uvm_phase phase);
|
| 7 |
+
super.build_phase(phase);
|
| 8 |
+
wb_transaction::type_id::set_type_override(wb_transaction_extended::get_type());
|
| 9 |
+
uvm_config_db #(uvm_object_wrapper)::set(this, "env.master_agent.mast_sqr.main_phase", "default_sequence", sequence_0::get_type());
|
| 10 |
+
endfunction
|
| 11 |
+
|
| 12 |
+
function new(string name="wb_env_test_extended",uvm_component parent);
|
| 13 |
+
super.new(name,parent);
|
| 14 |
+
endfunction
|
| 15 |
+
|
| 16 |
+
endclass
|
Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_3_Stimulus_Generation/README.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
There are 2 files in this directory and 2 Directories.
|
| 3 |
+
|
| 4 |
+
The grab_ungrab.sv shows a simple sequence which can be used in the example from Part2.
|
| 5 |
+
The priority shows how to handle priority in sequences.
|
| 6 |
+
|
| 7 |
+
To have a complete example, use the examples in the 2 directories. These are FULLY
|
| 8 |
+
working environments. The ONLY file that has changed in both xamples
|
| 9 |
+
|
| 10 |
+
|
Practical-UVM-Step-By-Step_Practical-UVM-Step-By-Step/Part_3_Stimulus_Generation/grab.sv
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
class grab_sequence extends base_sequence;
|
| 2 |
+
byte sa;
|
| 3 |
+
`uvm_object_utils(grab_sequence)
|
| 4 |
+
`uvm_add_to_seq_lib(grab_sequence, wb_master_seqr_sequence_library)
|
| 5 |
+
function new(string name = "int_seq");
|
| 6 |
+
super.new(name);
|
| 7 |
+
endfunction:new
|
| 8 |
+
virtual task body();
|
| 9 |
+
`uvm_info(get_type_name(),"STARTING INTERRUPT SEQUENCE",UVM_LOW)
|
| 10 |
+
grab();
|
| 11 |
+
`uvm_do_with(req, {address == 15; kind == wb_transaction::READ ;} )
|
| 12 |
+
`uvm_do_with(req,{address == 14; kind == wb_transaction::WRITE; data == 63'hbeefdead;} )
|
| 13 |
+
`uvm_do_with(req, {address == 13; kind == wb_transaction::READ;} )
|
| 14 |
+
ungrab();
|
| 15 |
+
endtask
|
| 16 |
+
endclass
|