{"id":17830,"date":"2022-11-14T19:33:53","date_gmt":"2022-11-15T00:33:53","guid":{"rendered":"https:\/\/blogs.sw.siemens.com\/verificationhorizons\/?p=17830"},"modified":"2026-03-27T08:50:13","modified_gmt":"2026-03-27T12:50:13","slug":"register-testing-the-easy-way-at-dvcon-europe","status":"publish","type":"post","link":"https:\/\/blogs.sw.siemens.com\/verificationhorizons\/2022\/11\/14\/register-testing-the-easy-way-at-dvcon-europe\/","title":{"rendered":"Register Testing the &#8220;Easy Way&#8221; at DVCON Europe"},"content":{"rendered":"\n<p><\/p>\n\n\n\n<p><a href=\"https:\/\/dvcon-europe.org\/\" data-type=\"URL\" data-id=\"https:\/\/dvcon-europe.org\/\" target=\"_blank\" rel=\"noopener\">DVCON Europe<\/a> is coming to Munich, December 6-7, 2022. Hope to see you there! I&#8217;ll be presenting a paper on &#8220;<strong>Register Testing \u2013 Exploring Tests, Register\u00a0 Model Libraries, Sequences and Backdoor Access<\/strong>&#8221; between 10:45am and 12:15pm on Wednesday, December 7.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Writing Simple Code<\/h2>\n\n\n\n<p>It&#8217;s really a paper on writing simple, easy to understand models and libraries as opposed to building a register package &#8211; although the examples operate as small register packages.<\/p>\n\n\n\n<p>I&#8217;ll share a simple register modeling package and share a small example as we cruise through the ideas and concepts.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/blogs.sw.siemens.com\/wp-content\/uploads\/sites\/54\/2022\/11\/image-1-1024x680.png\" alt=\"DVCON Europe, Dec 6-7, 2022 in Munich\" class=\"wp-image-17836\" width=\"840\" height=\"558\" srcset=\"https:\/\/blogs.sw.siemens.com\/wp-content\/uploads\/sites\/54\/2022\/11\/image-1-1024x680.png 1024w, https:\/\/blogs.sw.siemens.com\/wp-content\/uploads\/sites\/54\/2022\/11\/image-1-600x399.png 600w, https:\/\/blogs.sw.siemens.com\/wp-content\/uploads\/sites\/54\/2022\/11\/image-1-768x510.png 768w, https:\/\/blogs.sw.siemens.com\/wp-content\/uploads\/sites\/54\/2022\/11\/image-1-900x598.png 900w, https:\/\/blogs.sw.siemens.com\/wp-content\/uploads\/sites\/54\/2022\/11\/image-1.png 1466w\" sizes=\"auto, (max-width: 840px) 100vw, 840px\" \/><figcaption>Simple register model package<\/figcaption><\/figure>\n\n\n\n<p>The UVM Register package is well used, and well loved &#8211; clocking in at about 20,000 lines of code in total. The package discussed in the paper does not assume to be as complete as the UVM Register package &#8211; but is it complete enough? I&#8217;d love to hear your thoughts in Munich.<\/p>\n\n\n\n<p>I&#8217;m a fan of registers, but many (most?) registers cannot just be randomized or stomped through with marching ones. Some can. But could you imagine setting registers to random values in the control chip for  the wood chipper that the tree guys use? Wood chippers are scary enough already.<\/p>\n\n\n\n<p>Instead, I think register tests &#8220;know what the registers can do&#8221; &#8211; they are aware. Or at least register tests embody relationships between registers (regA has to be non-zero, when regB[3] is 1). These kinds of relationships can be captured in tests or constraints for example.<\/p>\n\n\n\n<p>Sometimes a useful register testbench just monitors the addresses, and maps the addresses into register names for easier debug. <\/p>\n\n\n\n<p>In any case, a register model is a useful thing. But does it have to be so big?<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Register-To-Bus Layering<\/h2>\n\n\n\n<p>You were getting ready to ask &#8211; &#8220;What about the register-to-bus layering&#8221;? Simple. A sequence does the work. You write code to go back and forth between the register layer and the bus protocol layer. But not much code. You can change format. You can issue many transactions. It&#8217;s just code. And small.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>class <\/strong>REGISTERtoBUS_rw_sequence <strong>extends <\/strong>uvm_sequence#(bus_transaction);\n  `uvm_object_utils(REGISTERtoBUS_rw_sequence)\n\n  <strong>bit <\/strong>all_done;\n\n  <strong>task <\/strong>body();\n    `uvm_info(get_type_name(), \"...running\", UVM_MEDIUM)\n    all_done = 0;\n    <strong>wait <\/strong>(all_done == 1);\n  <strong>endtask\n<\/strong>\n  <strong>task <\/strong>start_reg_item(register_transaction register_tr);\n    bus_transaction bus_tr;\n    \/\/ Translate to BUS\n    bus_tr = <strong>new<\/strong>(\"bus_tr\");\n    bus_tr.rw = register_tr.rw;\n    bus_tr.addr = register_tr.addr;\n    bus_tr.data = register_tr.data;\n    start_item(bus_tr);\n    register_tr.bus_tr = bus_tr; \/\/ Save it for later.\n    \/\/ Translate back to register\n  <strong>endtask<\/strong>\n\n  <strong>task <\/strong>finish_reg_item(register_transaction register_tr);\n    bus_transaction bus_tr;\n    \/\/ Translate to BUS\n    $cast(bus_tr, register_tr.bus_tr);\n    bus_tr.rw = register_tr.rw;\n    bus_tr.addr = register_tr.addr;\n    bus_tr.data = register_tr.data;\n    finish_item(bus_tr);\n    register_tr.data = bus_tr.data;\n    \/\/ Translate back to register\n  <strong>endtask<\/strong>\n<strong>endclass<\/strong><\/code><\/pre>\n\n\n\n<p>But now I&#8217;m getting ahead of the story. More details and discussion at the show.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">A Register<\/h2>\n\n\n\n<p>Create functionally interesting registers like a status register with a READ-ONLY field named &#8216;active_tr&#8217;. The bit-fields are described with a struct. The behavior of this register is &#8220;regular&#8221; &#8211; nothing fancy, except that the the field &#8216;active_tr&#8217; is READ-ONLY. It cannot be written. So the write() routine is implemented as such.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>typedef struct packed <\/strong>{\n  <strong>reg <\/strong>&#91;1:0] status;\n  <strong>reg <\/strong>&#91;7:0] error_count;\n  <strong>reg <\/strong>&#91;4:0] active_tr; <em>\/\/ READ-ONLY<\/em>\n} csr_t;\n\n<strong>class <\/strong>csr_RO_active_tr <strong>extends <\/strong>register#(csr_t);\r\n  <strong>function void <\/strong>write(T v); \r\n    value.status      = v.status;\r\n    value.error_count = v.error_count;\r\n  <strong>endfunction\r<\/strong>\n<strong>endclass\r<\/strong><\/code><\/pre>\n\n\n\n<p>Simple.<\/p>\n\n\n\n<p>Come by <a href=\"https:\/\/dvcon-europe.org\/\" data-type=\"URL\" data-id=\"https:\/\/dvcon-europe.org\/\" target=\"_blank\" rel=\"noopener\">DVCON Europe<\/a> to chat \u2013 the paper will be presented Wednesday, December 7. The conference is December 6 and 7. Hope to see you there.<\/p>\n\n\n\n<p>Rich<\/p>\n","protected":false},"excerpt":{"rendered":"<p>DVCON Europe is coming to Munich, December 6-7, 2022. Hope to see you there! I&#8217;ll be presenting a paper on&#8230;<\/p>\n","protected":false},"author":71540,"featured_media":17836,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spanish_translation":"","french_translation":"","german_translation":"","italian_translation":"","polish_translation":"","japanese_translation":"","chinese_translation":"","footnotes":""},"categories":[1],"tags":[445,751,787,801],"industry":[],"product":[],"coauthors":[961],"class_list":["post-17830","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-news","tag-dvcon-europe","tag-systemverilog","tag-uvm","tag-uvm-registers"],"featured_image_url":"https:\/\/blogs.sw.siemens.com\/wp-content\/uploads\/sites\/54\/2022\/11\/image-1.png","_links":{"self":[{"href":"https:\/\/blogs.sw.siemens.com\/verificationhorizons\/wp-json\/wp\/v2\/posts\/17830","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.sw.siemens.com\/verificationhorizons\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.sw.siemens.com\/verificationhorizons\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/verificationhorizons\/wp-json\/wp\/v2\/users\/71540"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/verificationhorizons\/wp-json\/wp\/v2\/comments?post=17830"}],"version-history":[{"count":5,"href":"https:\/\/blogs.sw.siemens.com\/verificationhorizons\/wp-json\/wp\/v2\/posts\/17830\/revisions"}],"predecessor-version":[{"id":17845,"href":"https:\/\/blogs.sw.siemens.com\/verificationhorizons\/wp-json\/wp\/v2\/posts\/17830\/revisions\/17845"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/verificationhorizons\/wp-json\/wp\/v2\/media\/17836"}],"wp:attachment":[{"href":"https:\/\/blogs.sw.siemens.com\/verificationhorizons\/wp-json\/wp\/v2\/media?parent=17830"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/verificationhorizons\/wp-json\/wp\/v2\/categories?post=17830"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/verificationhorizons\/wp-json\/wp\/v2\/tags?post=17830"},{"taxonomy":"industry","embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/verificationhorizons\/wp-json\/wp\/v2\/industry?post=17830"},{"taxonomy":"product","embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/verificationhorizons\/wp-json\/wp\/v2\/product?post=17830"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/verificationhorizons\/wp-json\/wp\/v2\/coauthors?post=17830"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}