{"id":138,"date":"2019-08-14T14:25:08","date_gmt":"2019-08-14T14:25:08","guid":{"rendered":"http:\/\/dsd.webs.upv.es\/?page_id=138"},"modified":"2025-08-06T16:24:28","modified_gmt":"2025-08-06T16:24:28","slug":"inicializacion-de-arrays","status":"publish","type":"page","link":"https:\/\/dsd.webs.upv.es\/?page_id=138","title":{"rendered":"Inicializaci\u00f3n de arrays"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u201cPacked array initialization\u201d: asignaci\u00f3n a vector simple<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: systemverilog; title: ; notranslate\" title=\"\">\nlogic &#x5B;3:0] &#x5B;7:0] v1 = 32&#039; h0;\/\/ or &#039;0\nlogic &#x5B;3:0] &#x5B;7:0] v2 = { 8&#039;h3, 8&#039;hz, 8&#039;h9, 8&#039;h0 };\/\/ concatenation\nlogic &#x5B;3:0] &#x5B;7:0] v3 = { 16{2&#039;b01} };\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\"> \u201cUnpacked array initialization\u201d: lista de valores entre &#8216;{ and }<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: systemverilog; title: ; notranslate\" title=\"\">\nint arr &#x5B;2] &#x5B;4] = &#039;{ &#039;{4, 8, 7, 2}, &#039;{9, 1, 0, 6} };\n\/\/ arr&#x5B;0]&#x5B;0] = 4 arr&#x5B;1]&#x5B;0] = 9\n\/\/ arr&#x5B;0]&#x5B;1] = 8 arr&#x5B;1]&#x5B;1] = 1\n\/\/ arr&#x5B;0]&#x5B;2] = 7 arr&#x5B;1]&#x5B;2] = 0\n\/\/ arr&#x5B;0]&#x5B;3] = 2 arr&#x5B;1]&#x5B;3] = 6\nint arr2 &#x5B;2] &#x5B;4] = &#039;{ 2{4, 8, 7, 2} };\n\/\/ arr2&#x5B;0]&#x5B;0] = 4 arr2&#x5B;1]&#x5B;0] = 4\n\/\/ arr2&#x5B;0]&#x5B;1] = 8 arr2&#x5B;1]&#x5B;1] = 8\n\/\/ arr2&#x5B;0]&#x5B;2] = 7 arr2&#x5B;1]&#x5B;2] = 7\n\/\/ arr2&#x5B;0]&#x5B;3] = 2 arr2&#x5B;1]&#x5B;3] = 2\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">Default initialization: Muy util para la inicializaci\u00f3n de unpacked arrays<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: verilog; title: ; notranslate\" title=\"\">\nint arr3 &#x5B;2] &#x5B;4] = &#039;{ default :9};\n\/\/ arr3&#x5B;0]&#x5B;0] = 9 arr3&#x5B;1]&#x5B;0] = 9\n\/\/ arr3&#x5B;0]&#x5B;1] = 9 arr3&#x5B;1]&#x5B;1] = 9\n\/\/ arr3&#x5B;0]&#x5B;2] = 9 arr3&#x5B;1]&#x5B;2] = 9\n\/\/ arr3&#x5B;0]&#x5B;3] = 9 arr3&#x5B;1]&#x5B;3] = 9\nint arr4 &#x5B;2] &#x5B;4] = &#039;{ &#039;{ default : 1}, &#039;{default : 9}};\n\/\/ arr4&#x5B;0]&#x5B;0] = 1 arr4&#x5B;1]&#x5B;0] = 9\n\/\/ arr4&#x5B;0]&#x5B;1] = 1 arr4&#x5B;1]&#x5B;1] = 9\n\/\/ arr4&#x5B;0]&#x5B;2] = 1 arr4&#x5B;1]&#x5B;2] = 9\n\/\/ arr4&#x5B;0]&#x5B;3] = 1 arr4&#x5B;1]&#x5B;3] = 9\n<\/pre><\/div>","protected":false},"excerpt":{"rendered":"<p>\u201cPacked array initialization\u201d: asignaci\u00f3n a vector simple \u201cUnpacked array initialization\u201d: lista de valores entre &#8216;{ and } Default initialization: Muy util para la inicializaci\u00f3n de unpacked arrays<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":59,"menu_order":4,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","ub_ctt_via":"","footnotes":""},"class_list":["post-138","page","type-page","status-publish","hentry"],"featured_image_src":null,"_links":{"self":[{"href":"https:\/\/dsd.webs.upv.es\/index.php?rest_route=\/wp\/v2\/pages\/138","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dsd.webs.upv.es\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/dsd.webs.upv.es\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/dsd.webs.upv.es\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dsd.webs.upv.es\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=138"}],"version-history":[{"count":5,"href":"https:\/\/dsd.webs.upv.es\/index.php?rest_route=\/wp\/v2\/pages\/138\/revisions"}],"predecessor-version":[{"id":1836,"href":"https:\/\/dsd.webs.upv.es\/index.php?rest_route=\/wp\/v2\/pages\/138\/revisions\/1836"}],"up":[{"embeddable":true,"href":"https:\/\/dsd.webs.upv.es\/index.php?rest_route=\/wp\/v2\/pages\/59"}],"wp:attachment":[{"href":"https:\/\/dsd.webs.upv.es\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=138"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}