{"id":93,"date":"2021-12-07T12:28:00","date_gmt":"2021-12-07T04:28:00","guid":{"rendered":"https:\/\/www.cywang.work\/?p=93"},"modified":"2023-04-28T09:42:48","modified_gmt":"2023-04-28T01:42:48","slug":"uvm%ef%bc%88%e4%b8%80%ef%bc%89-field-automation%e3%80%81config_db%e3%80%81factory%e6%9c%ba%e5%88%b6","status":"publish","type":"post","link":"http:\/\/www.cywang.work\/index.php\/2021\/12\/07\/uvm%ef%bc%88%e4%b8%80%ef%bc%89-field-automation%e3%80%81config_db%e3%80%81factory%e6%9c%ba%e5%88%b6\/","title":{"rendered":"UVM\uff08\u4e00\uff09\u2014\u2014 field automation\u3001config_db\u3001factory\u673a\u5236"},"content":{"rendered":"\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-8f761849 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<h2 class=\"wp-block-heading\">1. field_automation\u673a\u5236<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>1.1 \u4ecb\u7ecd<\/strong><br>\u5229\u7528`uvm_field_* \u5b8f\uff0c\u5c06\u7c7b\u4e2d\u7684\u6210\u5458\u53d8\u91cf\u6ce8\u518c\u5230UVM\u4e2d\uff0cUVM\u53ef\u81ea\u52a8\u4e3a\u5176\u5b9e\u73b0compare\u3001copy\u3001print\u3001pack\/unpack\u7b49\u65b9\u6cd5\uff0c\u4e0d\u9700\u8981\u81ea\u5df1\u53bb\u5b9a\u4e49\u3002\u89e3\u51b3 <strong>\u9010\u5b57\u6bb5\u5bf9transaction\u8fdb\u884c\u64cd\u4f5c<\/strong> \u7684\u95ee\u9898\uff0c\u6781\u5927\u5730\u7b80\u5316\u4e86\u9a8c\u8bc1\u5e73\u53f0\u7684\u642d\u5efa\uff0c\u63d0\u9ad8\u4e86\u6548\u7387\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>1.2 \u7528\u6cd5<\/strong><br>\u4f7f\u7528uvm_object_utils_begin\u548cuvm_object_utils_end\u6765\u5b9e\u73b0my_transaction\u7684factory\u6ce8\u518c\uff0c\u5728\u8fd9\u4e24\u4e2a\u5b8f\u4e2d\u95f4\uff0c\u4f7f\u7528uvm_field\u5b8f\u6ce8\u518c\u6240\u6709\u5b57\u6bb5\u3002uvm_field\u7cfb\u5217\u5b8f\u968f\u7740transaction\u6210\u5458\u53d8\u91cf\u7684\u4e0d\u540c\u800c\u4e0d\u540c\u3002<br><img loading=\"lazy\" decoding=\"async\" width=\"350\" height=\"122\" class=\"wp-image-94\" style=\"width: 350px;\" src=\"http:\/\/www.cywang.work\/wp-content\/uploads\/2023\/04\/image-20211129145522740.png\" alt=\"\" srcset=\"http:\/\/www.cywang.work\/wp-content\/uploads\/2023\/04\/image-20211129145522740.png 382w, http:\/\/www.cywang.work\/wp-content\/uploads\/2023\/04\/image-20211129145522740-300x104.png 300w\" sizes=\"auto, (max-width: 350px) 100vw, 350px\" \/><\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-8f761849 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:100%\">\n<p class=\"wp-block-paragraph\">1.3 \u76f8\u5173\u5b8f<\/p>\n\n\n\n<pre class=\"wp-block-code has-background\" style=\"background:linear-gradient(135deg,rgb(238,238,238) 100%,rgb(169,184,195) 100%)\"><code><strong>\u7b80\u5355\u7684uvm_field\u7cfb\u5217\u5b8f<\/strong>\n`define uvm_field_int(ARG,FLAG)\n`define uvm_field_real(ARG,FLAG)\n`define uvm_field_enum(T,ARG,FLAG)\n`define uvm_field_object(ARG,FLAG)\n`define uvm_field_event(ARG,FLAG)\n`define uvm_field_string(ARG,FLAG)<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code has-background\" style=\"background:linear-gradient(135deg,rgb(238,238,238) 100%,rgb(169,184,195) 100%)\"><code><strong>\u52a8\u6001\u6570\u7ec4\uff1a<\/strong>\n`define uvm_field_array_enum(ARG,FLAG)\r\n`define uvm_field_array_int(ARG,FLAG)\r\n`define uvm_field_array_object(ARG,FLAG)\r\n`define uvm_field_array_string(ARG,FLAG)<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code has-background\" style=\"background:linear-gradient(135deg,rgb(238,238,238) 100%,rgb(169,184,195) 100%)\"><code><strong>\u9759\u6001\u6570\u7ec4\uff1a<\/strong>\n`define uvm_field_sarray_int(ARG,FLAG)\r\n`define uvm_field_sarray_enum(ARG,FLAG)\r\n`define uvm_field_sarray_object(ARG,FLAG)\r\n`define uvm_field_sarray_string(ARG,FLAG)<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code has-background\" style=\"background:linear-gradient(135deg,rgb(238,238,238) 100%,rgb(169,184,195) 100%)\"><code><strong>\u961f\u5217\uff1a<\/strong>\n`define uvm_field_queue_enum(ARG,FLAG)\r\n`define uvm_field_queue_int(ARG,FLAG)\r\n`define uvm_field_queue_object(ARG,FLAG)\r\n`define uvm_field_queue_string(ARG,FLAG)<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code has-background\" style=\"background:linear-gradient(135deg,rgb(238,238,238) 100%,rgb(169,184,195) 100%)\"><code><strong>\u8054\u5408\u6570\u7ec4\uff1a<\/strong>\uff08\u7b2c\u4e00\u4e2a\u7c7b\u578b\u662f\u5b58\u50a8\u6570\u636e\u7c7b\u578b\uff0c\u7b2c\u4e8c\u4e2a\u7c7b\u578b\u662f\u7d22\u5f15\u7c7b\u578b\uff09\n`define uvm_field_aa_int_string(ARG, FLAG)\r\n`define uvm_field_aa_string_string(ARG, FLAG)\r\n`define uvm_field_aa_object_string(ARG, FLAG)\r\n`define uvm_field_aa_int_int(ARG, FLAG)\r\n`define uvm_field_aa_int_int_unsigned(ARG, FLAG)\r\n`define uvm_field_aa_int_integer(ARG, FLAG)\r\n`define uvm_field_aa_int_integer_unsigned(ARG, FLAG)\r\n`define uvm_field_aa_int_byte(ARG, FLAG)\r\n`define uvm_field_aa_int_byte_unsigned(ARG, FLAG)\r\n`define uvm_field_aa_int_shortint(ARG, FLAG)\r\n`define uvm_field_aa_int_shortint_unsigned(ARG, FLAG)\r\n`define uvm_field_aa_int_longint(ARG, FLAG)\r\n`define uvm_field_aa_int_longint_unsigned(ARG, FLAG)\r\n`define uvm_field_aa_string_int(ARG, FLAG)\r\n`define uvm_field_aa_object_int(ARG, FLAG)<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-8f761849 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<h2 class=\"wp-block-heading\">2. config_db\u673a\u5236<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>2.1 \u4ecb\u7ecd<\/strong><br>\u7528\u6765\u4f20\u9012\u53c2\u6570\uff0c\u4e00\u822c\u6709\u4ee5\u4e0b\u4e09\u79cd\u5e94\u7528\u573a\u666f\uff1a<br>\uff081\uff09\u4f20\u9012virtual interface\u5230\u73af\u5883\u4e2d\u3002<br>\uff082\uff09\u8bbe\u7f6e\u5355\u4e00\u53d8\u91cf\u503c\uff0c\u4f8b\u5982int\u3001string\u3001enum\u7b49\u3002<br>\uff083\uff09\u4f20\u9012\u914d\u7f6e\u5bf9\u8c61\u5230\u73af\u5883\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>2.2 \u7528\u6cd5<\/strong><br>set\u51fd\u6570\u662f\u5bc4\u4fe1\uff0c\u800cget\u51fd\u6570\u662f\u6536\u4fe1\u3002\u5982\u5728\u67d0\u4e2a\u6d4b\u8bd5\u7528\u4f8b\u7684build_phase\u4e2d\u53ef\u4ee5\u4f7f\u7528\u5982\u4e0b\u65b9\u5f0f\u5bc4\u4fe1\uff1a<br><br><code>uvm_config_db#(int)::set(this,\"env.i_agt.drv\",\"pre_num\",100);<\/code><br><br>\u5176\u4e2d<strong>\u7b2c\u4e00\u4e2a\u548c\u7b2c\u4e8c\u4e2a\u53c2\u6570\u8054\u5408\u8d77\u6765\u7ec4\u6210\u76ee\u6807\u8def\u5f84<\/strong>\uff0c\u4e0e\u6b64\u8def\u5f84\u7b26\u5408\u7684\u76ee\u6807\u624d\u80fd\u6536\u4fe1\u3002<strong>\u7b2c\u4e00\u4e2a\u53c2\u6570\u5fc5\u987b\u662f\u4e00\u4e2auvm_component\u5b9e\u4f8b\u7684\u6307\u9488\uff0c\u7b2c\u4e8c\u4e2a\u53c2\u6570\u662f\u76f8\u5bf9\u6b64\u5b9e\u4f8b\u7684\u8def\u5f84\u3002\u7b2c\u4e09\u4e2a\u53c2\u6570\u8868\u793a\u4e00\u4e2a\u8bb0\u53f7\uff0c\u7528\u4ee5\u8bf4\u660e\u8fd9\u4e2a\u503c\u662f\u4f20\u7ed9\u76ee\u6807\u4e2d\u7684\u54ea\u4e2a\u6210\u5458\u7684\uff0c\u7b2c\u56db\u4e2a\u53c2\u6570\u662f\u8981\u8bbe\u7f6e\u7684\u503c<\/strong>\u3002<br><br>\u5728driver\u4e2d\u7684build_phase\u4f7f\u7528\u5982\u4e0b\u65b9\u5f0f\u6536\u4fe1\uff1a<br><br><code>uvm_config_db#(int)::get(this,\"\",\"pre num\",pre num);<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">get\u51fd\u6570\u4e2d\u7684\u7b2c\u4e00\u4e2a\u53c2\u6570\u548c\u7b2c\u4e8c\u4e2a\u53c2\u6570\u8054\u5408\u8d77\u6765\u7ec4\u6210\u8def\u5f84\u3002<strong>\u7b2c\u4e00\u4e2a\u53c2\u6570\u4e5f\u5fc5\u987b\u662f\u4e00\u4e2auvm_component\u5b9e\u4f8b\u7684\u6307\u9488\uff0c\u7b2c\u4e8c\u4e2a\u53c2\u6570\u662f\u76f8\u5bf9\u6b64\u5b9e\u4f8b\u7684\u8def\u5f84<\/strong>\u3002\u4e00\u822c\u7684\uff0c\u5982\u679c\u7b2c\u4e00\u4e2a\u53c2\u6570\u88ab\u8bbe\u7f6e\u4e3athis\uff0c\u90a3\u4e48\u7b2c\u4e8c\u4e2a\u53c2\u6570\u53ef\u4ee5\u662f\u4e00\u4e2a\u7a7a\u7684\u5b57\u7b26\u4e32\u3002<strong>\u7b2c\u4e09\u4e2a\u53c2\u6570\u5c31\u662fset\u51fd\u6570\u4e2d\u7684\u7b2c\u4e09\u4e2a\u53c2\u6570\uff0c\u8fd9\u4e24\u4e2a\u53c2<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-black-color\">\u6570<\/mark><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">\u5fc5\u987b\u4e25\u683c\u5339\u914d<\/mark>\uff0c\u7b2c\u56db\u4e2a\u53c2\u6570\u5219\u662f\u8981\u8bbe\u7f6e\u7684\u53d8\u91cf<\/strong>\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>2.3 \u4f7f\u7528\u5b9e\u4f8b<\/strong><br>2.3.1 interface\u4f20\u9012<br>\u5728\u5b9e\u73b0\u63a5\u53e3\u4f20\u9012\u7684\u8fc7\u7a0b\u4e2d\u9700\u8981\u6ce8\u610f\uff1a<br>\uff081\uff09\u5728\u4f20\u9012\u8fc7\u7a0b\u4e2d\u7684\u7c7b\u578b\u5e94\u5f53\u4e3avirtual interface\uff0c\u5373\u5b9e\u9645\u63a5\u53e3\u7684\u53e5\u67c4\u3002<br>\uff082\uff09\u63a5\u53e3\u4f20\u9012\u5e94\u8be5\u53d1\u751f\u5728run_test()\u4e4b\u524d\u3002\u8fd9\u4fdd\u8bc1\u4e86\u5728\u8fdb\u5165build phase\u4e4b\u524d\uff0cvirtual interface\u5df2\u7ecf\u88ab\u4f20\u9012\u5230uvm_config_db\u4e2d\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code has-black-color has-text-color has-background\" style=\"background:linear-gradient(135deg,rgb(238,238,238) 100%,rgb(169,184,195) 100%)\"><code>interface intf1; \n    logic enable=0; \nendinterface \n\nclass compl extends uvm component;\n    `uvm_component_utils(comp1)\n    virtual intf1 vif;\n\n    function void build_phase(uvm phase phase); \n        if(!uvm config db#(virtual intf1):: get(this,\"\",\"vif\", vif)) begin \n            uvm_error(\"GETVIF\",\"no virtual interface is assigned\")\n        end \n        `uvm_info(\"SETVAL\",$sformatf(\"vif. enable is %b before set\", vif. enable), UVM LOW)\n        vif.enable=1;\n        `uvm info(\"SETVAL\",$sformatf(\"vif. enable is b after set\", vif. enable), UVM LOW)\n    endfunction \nendclass\n\nclass testl extends uvm_test; \n    `uvm_component_utils(test1)\n    comp1(c1) \n\nendclass \n\nintf1 intf(); \ninitial begin \n    uvm_config_db#(virtual intf1)::set(uvm root::get(),\"uvm test top. cl\",\"vif\", intf); \n    run test(\"test1\"); \nend\n\n\/\/\u8f93\u51fa\u7ed3\u679c\uff1a\nUVM_INFO @ 0:reporter &#91;RNTST] Running test test1...\nUVM_INFO @ 0:uvm_test_top.cl &#91;SETVAL] vif.enable is 0 before set \nUVM_INFO @ 0:uvm_test_top.cl &#91;SETVAL] vif.enable is 1 after set\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">2.3.2 \u53d8\u91cf\u4f20\u9012<br>\u5728\u5404\u4e2atest\u4e2d\uff0c \u53ef\u4ee5\u5728build phase\u5bf9\u5e95\u5c42\u7ec4\u4ef6\u7684\u53d8\u91cf\u52a0\u4ee5\u914d\u7f6e\uff0c \u8fdb\u800c\u5728\u73af\u5883\u4f8b\u5316\u4e4b\u524d\u5b8c\u6210\u914d\u7f6e\uff0c \u4f7f\u5f97\u73af\u5883\u53ef\u4ee5\u6309\u7167\u9884\u671f\u8fd0\u884c\u3002<br>\u4ee3\u7801\u4e0e2.3.1\u7c7b\u4f3c\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">2.3.3 object\u4f20\u9012<br>\u5728test\u914d\u7f6e\u4e2d\uff0c\u9700\u8981\u914d\u7f6e\u7684\u53c2\u6570\u4e0d\u53ea\u662f\u6570\u91cf\u591a\uff0c\u800c\u4e14\u53ef\u80fd\u8fd8\u5206\u5c5e\u4e8e\u4e0d\u540c\u7684\u7ec4\u4ef6\uff0c\u5982\u679c\u6bcf\u4e2a\u53d8\u91cf\u5355\u72ec\u4f20\u9012\uff0c\u5bb9\u6613\u51fa\u9519\uff0c\u8fd8\u4e0d\u80fd\u590d\u7528\u3002\u56e0\u6b64\u6211\u4eec\u53ef\u4ee5\u5c06\u6bcf\u4e2a\u7ec4\u4ef6\u4e2d\u7684\u53d8\u91cf\u52a0\u4ee5\u6574\u5408\uff0c\u9996\u5148\u653e\u7f6e\u5230\u4e00\u4e2auvm_object\u4e2d\uff0c\u518d\u5bf9\u4e2d\u5fc3\u5316\u7684\u914d\u7f6e\u5bf9\u8c61\u8fdb\u884c\u4f20\u9012\uff0c\u4f1a\u66f4\u6709\u5229\u4e8e\u6574\u4f53\u73af\u5883\u7684\u4fee\u6539\u7ef4\u62a4\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code has-background\" style=\"background:linear-gradient(135deg,rgb(238,238,238) 100%,rgb(169,184,195) 100%)\"><code>class configl extends uvm object;\r\n    int val1=1; \r\n    int str1=\"null\"; \r\n    uvm_object_uti1s(config1)\r\n    ...\r\nendclass \n\r\nclass comp1 extends uvm_component;\r\n    `uvm_component_uti1s(comp1)\r\n    configl cfg; \r\n    ...\r\n    function void build_phase(uvm phase phase); \r\n        uvm_object_tmp; \r\n        <strong>uvm_config_db#(uvm_object):: get(this,\"\",\"cfg\", tmp); <\/strong>\r\n        void'($cast(cfg, tmp)); \r\n        uvm_info(\"SETVAL\",$sformatf(\"cfg.vall is %d after get\", cfg. val1), UVM_LOW)\r\n        uvm_info(\"SETVAL\",$sformatf(\"cfg.str1 is %s after get\", cfg. str1), UVM_LOW)\r\n    endfunction\r\nendclass\n\nclass test1 extends uvm_test;\n    `uvm component utils(test1)\n    comp1 c1,c2;\n    config1 cfgl,cfg2; \n    ...\n    function void build_phase(uvm_phase phase); \n        cfg1=config1::type id::create(\"cfg1\"); \n        cfg2=configl::type_id::create(\"cfg2\"); \n        cfg1.val1=30; \n        Cfg1.strl=\"c1\"; \n        Cfg2.val1=50; \n        cfg2.strl=\"c2\"; \n       <strong> uvm_config_db#(uvm_object):set(this,\"cl\",\"cfg\", cfg1); <\/strong>\n        uvm_config_db#(uvm object):set(this,\"c2\",\"cfg\", cfg2); \n        c1=comp1::type id::create(\"c1\", this);\n        c2=comp1::type_id::create(\"c2\", this); \n    endfunction \nendclass\r\n<\/code><\/pre>\n<\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-8f761849 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:100%\">\n<h2 class=\"wp-block-heading\">3. factory\u673a\u5236<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>3.1 \u4ecb\u7ecd<\/strong><br>\u5de5\u5382\u6a21\u5f0f\u7684\u4e3b\u8981\u89e3\u51b3\u7684\u95ee\u9898\u662f\uff0c\u5c06\u539f\u6765\u5206\u5e03\u5728\u5404\u4e2a\u5730\u65b9\u7684\u5bf9\u8c61\u521b\u5efa\u8fc7\u7a0b\u5355\u72ec\u62bd\u79bb\u51fa\u6765\uff0c\u4ea4\u7ed9\u5de5\u5382\u7c7b\u8d1f\u8d23\u521b\u5efa\u3002\u5176\u4ed6\u5730\u65b9\u60f3\u8981\u4f7f\u7528\u5bf9\u8c61\u76f4\u63a5\u627e\u5de5\u5382\uff08\u5373\u8c03\u7528\u5de5\u5382\u7684\u65b9\u6cd5\uff09\u83b7\u53d6\u5bf9\u8c61\u3002<br><strong>\u5bf9\u8c61\u7531\u5de5\u5382\u751f\u4ea7\u662f\u5229\u7528\u5de5\u5382\u751f\u4ea7\u6a21\u5177\u53ef\u7075\u6d3b\u66ff\u4ee3\u7684\u597d\u5904<\/strong>\uff0c\u5728\u4e0d\u4fee\u6539\u539f\u6709\u9a8c\u8bc1\u73af\u5883\u5c42\u6b21\u548c\u9a8c\u8bc1\u5305\u7684\u540c\u65f6\uff0c<strong>\u5b9e\u73b0\u5bf9\u73af\u5883\u5185\u90e8\u7ec4\u4ef6\u7c7b\u578b\u6216\u8005\u5bf9\u8c61\u7684\u8986\u76d6\uff08override\uff0c\u6216\u8bd1\u6210\u91cd\u8f7d\uff09<\/strong>\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>3.2 \u7528\u6cd5<\/strong><br>3.2.1 <strong>\u5b9a\u4e49->\u6ce8\u518c->\u6784\u5efa <\/strong>\u7f3a\u4e00\u4e0d\u53ef<br>component \u6784\u5efa\u51fd\u6570<br><code>function new (string name = \" name\", uvm_component parent = null)<\/code><br>\u521b\u5efa\u5bf9\u8c61<br><code>comp_type::type_id::create(string name,uvm_component parent);<\/code><br><br>object \u6784\u5efa\u51fd\u6570<br><code>function new (string name = \u201cname\u201d)<\/code><br>\u521b\u5efa\u5bf9\u8c61<br><code>object_type::type_id::create(string name);<\/code><\/p>\n\n\n\n<pre class=\"wp-block-code has-background\" style=\"background:linear-gradient(135deg,rgb(238,238,238) 100%,rgb(169,184,195) 100%)\"><code>class comp1 extends uvm_component;\/\/1.\u5b9a\u4e49\n    <strong>`uvm_component_utils<\/strong>(comp1)\/\/2.\u6ce8\u518c\n    \/\/3.\u6784\u5efa\u51fd\u6570\n    function new (string name = \"comp1\", uvm_component parent = null);\n        super.new(name,parent);\n    endfunction:new\nendclass\nclass obj1 extends uvm_object;\/\/1.\u5b9a\u4e49\n    <strong>`uvm_object_utils<\/strong>(obj1)\/\/2.\u6ce8\u518c\n    function new(string name = \"obj1\");\/\/3.\u6784\u5efa\u51fd\u6570\n        super.new(name);\n    endfunction:new\nendclass\n\n\/\/\u521b\u5efa\u5bf9\u8c61\ncomp1 c1,c2;\nobj1 o1,o2;\ninitial begin\n    c1 = new(\"c1\");\n    o1 = new(\"o1\");\n    \/\/\u5efa\u8bae\u4f7f\u7528\u4e0b\u9762\u65b9\u6cd5\u521b\u5efa\u5bf9\u8c61\n    c2 = comp1::type_id::create(\"c2\",null);\n    o2 = obj1::type_id::create(\"o2\");\nend<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">3.2.2 \u8986\u76d6\u65b9\u6cd5<br><strong>\u8986\u76d6\u673a\u5236\u53ef\u4ee5\u5c06\u5176\u539f\u6765\u6240\u5c5e\u7c7b\u578b\u66ff\u6362\u4e3a\u53e6\u4e00\u4e2a\u65b0\u7c7b\u578b<\/strong>\u3002<br>\u5728\u8986\u76d6\u4e4b\u540e\uff0c\u539f\u672c\u7528\u6765\u521b\u5efa\u539f\u578b\u7c7b\u578b\u7684\u8bf7\u6c42\uff0c\u5c06\u7531\u5de5\u5382\u6765\u521b\u5efa\u65b0\u7684\u66ff\u6362\u7c7b\u578b\u3002<br>\uff081\uff09\u65e0\u9700\u4fee\u6539\u539f\u59cb\u4ee3\u7801\uff0c\u4fdd\u8bc1\u4e86\u539f\u6709\u4ee3\u7801\u7684\u5c01\u88c5\u6027<br>\uff082\uff09\u65b0\u7684\u66ff\u6362\u7c7b\u578b\u5fc5\u987b\u4e0e\u88ab\u66ff\u6362\u7684\u7c7b\u578b\u76f8\u517c\u5bb9\uff0c\u5426\u5219\u7a0d\u540e\u7684\u53e5\u67c4\u8d4b\u503c\u5c06\u5931\u8d25\uff0c\u6240\u4ee5\u4f7f\u7528\u7ee7\u627f\u3002<br>\uff083\uff09\u505a\u9876\u5c42\u4fee\u6539\u65f6\uff0c\u975e\u5e38\u65b9\u4fbf<br><br>\u4f7f\u7528create()\u6765\u521b\u5efa\u5bf9\u8c61\u65f6\uff1a<br>\uff081\uff09\u5de5\u5382\u4f1a\u68c0\u67e5\uff0c\u662f\u5426\u6709\u7c7b\u578b\u88ab\u8986\u76d6\uff0c\u5982\u679c\u662f\uff0c\u5b83\u4f1a\u521b\u5efa\u4e00\u4e2a\u65b0\u7c7b\u578b\u7684\u5bf9\u8c61\uff0c\u5982\u679c\u4e0d\u662f\uff0c\u5b83\u4f1a\u521b\u5efa\u4e00\u4e2a\u539f\u6709\u7c7b\u578b\u7684\u5bf9\u8c61<br><br>\u8986\u76d6\u53d1\u751f\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528\u201c\u7c7b\u578b\u8986\u76d6\u201d\u6216\u8005\u201c\u5b9e\u4f8b\u8986\u76d6\u201d\uff1a<br>\uff081\uff09\u7c7b\u578b\u8986\u76d6\uff08<strong>set_type_override()<\/strong>\uff09\u6307\uff0cUVM\u5c42\u6b21\u7ed3\u6784\u4e0b\u7684\u6240\u6709\u539f\u6709\u7c7b\u578b\u90fd\u88ab\u8986\u76d6\u7c7b\u578b\u6240\u66ff\u6362\u3002<br>\uff082\uff09\u5b9e\u4f8b\u8986\u76d6\uff08<strong>set_inst_override()<\/strong>\uff09\u6307\uff0c\u67d0\u4e9b\u4f4d\u7f6e\u4e2d\u539f\u6709\u7c7b\u578b\u4f1a\u88ab\u8986\u76d6\u7c7b\u578b\u6240\u66ff\u6362<\/p>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>1. field_automation\u673a\u5236 1.1 \u4ecb\u7ecd\u5229\u7528`uvm_field_* \u5b8f\uff0c\u5c06\u7c7b\u4e2d\u7684\u6210\u5458\u53d8\u91cf\u6ce8\u518c &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/www.cywang.work\/index.php\/2021\/12\/07\/uvm%ef%bc%88%e4%b8%80%ef%bc%89-field-automation%e3%80%81config_db%e3%80%81factory%e6%9c%ba%e5%88%b6\/\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201cUVM\uff08\u4e00\uff09\u2014\u2014 field automation\u3001config_db\u3001factory\u673a\u5236\u201d<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-93","post","type-post","status-publish","format-standard","hentry","category-uvm"],"_links":{"self":[{"href":"http:\/\/www.cywang.work\/index.php\/wp-json\/wp\/v2\/posts\/93","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.cywang.work\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.cywang.work\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.cywang.work\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.cywang.work\/index.php\/wp-json\/wp\/v2\/comments?post=93"}],"version-history":[{"count":2,"href":"http:\/\/www.cywang.work\/index.php\/wp-json\/wp\/v2\/posts\/93\/revisions"}],"predecessor-version":[{"id":96,"href":"http:\/\/www.cywang.work\/index.php\/wp-json\/wp\/v2\/posts\/93\/revisions\/96"}],"wp:attachment":[{"href":"http:\/\/www.cywang.work\/index.php\/wp-json\/wp\/v2\/media?parent=93"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.cywang.work\/index.php\/wp-json\/wp\/v2\/categories?post=93"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.cywang.work\/index.php\/wp-json\/wp\/v2\/tags?post=93"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}