1
\$\begingroup\$

I have a few questions about what this code does and how it works:

x <= '{default:'1} ;
  1. What is the purpose of the "default" keyword ?
  2. What is the purpose of the inner single quote apostrophe before the 1 in this case ?
  3. What is the purpose of the inner single quote apostrophe before the { in this case ?
\$\endgroup\$
2
  • 1
    \$\begingroup\$ Stackoverflow has a question on this. \$\endgroup\$
    – user103380
    Sep 9, 2020 at 19:59
  • 1
    \$\begingroup\$ I've read the question on Stackoverflow before posting this one. I'm not asking the same thing. \$\endgroup\$
    – shaiko
    Sep 9, 2020 at 22:40

2 Answers 2

3
\$\begingroup\$

The inner single quote before the 1 is a numeric literal fill. The '0, '1, 'z, and 'x literals will be extended to fill the width of whatever context they are used in.

The outer single quote before the { means that this is an assignment pattern to an array or struct. Assignment patterns require a value for every element of the array or struct, which can be positionally ordered or matched by name/index. When matched by name/index, the default: serves as a match to any unspecified element.

This is all explained in section 10.9 Assignment patterns in the IEEE 1800-2017 SystemVerilog LRM

\$\endgroup\$
1
  • \$\begingroup\$ In fact your answer states the same as mine, except you use more formal terms. But it's in no way more correct. \$\endgroup\$
    – schnedan
    Sep 10, 2020 at 7:14
0
\$\begingroup\$

As far as I know:

  • its SystemVerilog
  • '{} defines a (unnamed) struct
  • default:'1 , as the default width is 32bit, is 32x '1' as constant

(if not correct, please correct me)

\$\endgroup\$
5

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.