What’s new in SystemVerilog-2023? Part 1: SV23 design enhancements

The next revision of the SystemVerilog standard IEEE Std 1800™-2023 was approved on December 6.

SV23 adds various enhancements, not just bug fixes. In this post, I summarize the main ones for the basic design language. In an upcoming post, I will summarize the testbench enhancements, such as Java-style weak references.

Update state variables by passing them to a task or function with ‘ref static’ arguments.

The next state in a SystemVerilog finite-state machine (FSM) is specified with a nonblocking assignment (NBA) that defers the assignment until late in the time step.

Until SV23 an FSM couldn’t be factored into manageable levels with tasks and functions, because a state variable passed as an argument couldn’t be the target of an NBA. This restriction was to prevent the potential mistake of passing an automatic variable.

In SV23 a task/function formal can have direction ‘ref static‘ and be passed a state variable to schedule a nonblocking assignment for it.

You can also refer to a ‘ref static’ argument from a fork-join_any or fork-join_none block in a function because it’s guaranteed that nothing automatic will be passed in so the argument will outlive the the fork block.

The BNF change is tf_port_direction in Syntax 13-1, from “const ref” to “[const] ref [static]”.

Associative array parameters for modules, classes and interfaces

A constant associative array can represent a lookup table keyed by strings, enums, integers, and so on. It can also represent a set by using an associative array of bits.

For example, #(.WEIGHT(‘{ HIGH:5, MEDIUM:3:, LOW:1 })) or #(.WEIGHT(my_weights())) where my_weights() is a function that returns an associative array.

The BNF change is param_assignment in Syntax 6-6 from “unpacked_dimension” to “variable_dimension”.

Python-style multiline string literals using triple quotes.

By bracketing the string with quotation marks three times instead of once, such as “””this”””, there is no need to escape newlines or quotation marks. See 5.9.

C-like conditional compilation with logical operators.

An ifdef/ifndef directive can now use the logical operators !, &&, ||, -> and <->. See Syntax 22-5.

‘Soft’ packed unions aren’t restricted to equal-sized members.

Now with the ‘soft’ qualfier, the size of the union is the size of the longest member. For details of the changes, including new Figure 7-1, see the proposal here.

Type parameters can declare the same restrictions as typedefs.

Now a type parameter can be declared as specifically “type enum”, “type struct”, “type class”, and so on. For details of the new BNF and examples, see the proposal here.

Expressions on unpacked arrays with new “map” method

For example, instead of declaring a temp array, doing

foreach (A[i]) temp[i] = A[i] + B[i];

and calling f( temp ), you can directly call

f( A.map with (item + B[item.index]) )

There is no BNF change for this. It’s a new built-in array manipulation method described in 7.12.5. The examples there use an overly complicated syntax. I would recommend the style of 7.12.4, where the example is “q = arr.find with (item == item.index);”. There are no parentheses after the method name and no declaration of a new variable name instead of the default “item”.

No free will? Then no choice what to think about it or what to do about it.

In his new book Determined: A Science of Life Without Free Will Stanford University neurobiologist Robert Sapolsky argues that we have effectively no free will.

If there’s effectively no free will, then meat puppets like us are almost certainly going to believe what we’re destined to believe and our societies are almost certainly going to organize and reward and punish how they’re destined to organize and reward and punish.

If there’s absolutely no free will, then we have no choice at all about what to believe or what to do and questions about free will are both pointless and inevitable. If it’s all a fraud, a simulation, then what you believe about it is inevitable, as are the conversations about it, like chatbots spewing out a learned discourse, the proverbial “sound and fury”.

Free will — a question that might be important after all

As I mentioned here , the question of whether we have free will has long seemed to me to be among the silliest in philosophy, because either we do have free will, or we have no choice what to believe about the question, in which case we’ll believe whatever we’re destined to believe because we’re just wind up toys going through the motions of philosophizing.

Scientifically, it doesn’t seem like we have free will, but it’s tautological that the only accurate choice is to believe that we do. That is, if we have a choice, then the only accurate choice is to believe that we have a choice.

So what? Then the real question to answer is, given that we have a choice about believing in free will, what would be the most adaptive belief to choose?

Seeing reality accurately is not necessarily the most adaptive belief system. Even the most modest of human beings has a grandiose sense of self-importance compared to the great sweep of time and space in the cosmos, or even compared to the lifetime of our little blue planet. It’s plausible that without genes fostering that delusion, we wouldn’t have sufficient drive to survive and compete.

I tend to instinctively feel that believing in free will would be empowering and that we should promote that belief, but possibly that’s the genes talking again, and a strong belief in free will leads to unjustified shame and blame as here. It’s clear that even if we do have free will, we don’t have infinite free will, and our genes, upbringing, era we’re born, and many other factors put severe limits on our degrees of freedom. It could be that exaggerating our degrees of freedom both leads to shame and empowers us, and the shame is just another of the many ways that unjust individual pain is the price we pay for winning as a species.

“All of the codes matched.” Oct. 28, 1962, attempted rogue nuclear attack on China

According to Masakatsu Ota , regarding the 1962 Cuban missile crisis

“Oh, my God!,” Bordne recalled his colleagues as saying as they turned white with shock and surprise when they received a launch order before dawn on Oct. 28. The order was issued from Kadena to all four Mace B sites in Okinawa including Bolo Point, he said.

According to him, the three-level confirmation process was taken step-by-step in accordance with a manual by comparing codes in the launch order and codes given to his crew team in advance. All of the codes matched.

“So, we read the targets out loud. Out of the four missiles, we had only one headed toward Russia. The other three were not going to Russia. That, right away, gave us a start to wonder. Because the launch directive said you launch all the missiles,” Bordne said. His crew team was in charge of four out of eight missiles deployed at the site.

“And we figured, ‘Why hit these other countries?’ They’ve got nothing to do with this. That doesn’t make any sense,” Bordne said. “So, our captain, the launch officer, said to us ‘We’ve got to think this through in a logical, rational manner’.”

When the launch order was issued, the five-level “DEFCON” scale, or defense condition, remained at level 2, one step from starting a war. Theoretically, a launch order should not be issued unless DEFCON is raised to 1, which means initiating a military counterattack against enemy forces.

The order under DEFCON 2 made the crew team, especially the launch officer, so dubious about its authenticity that the officer ordered suspension of the ongoing launch procedures which Bordne was engaged in.

Finally, the launch officer figured out that the order had been mistakenly issued, Bordne said, but added he has no idea why such an order was issued. Even though Bordne did not specify which country had been targeted besides Russia under the order, it is believed to be China considering the Mace B missile range of 2,200-2,300 kilometers.

It is not clear what caused such a wrong launch order to be issued, but a U.S. U-2 spy plane was shot down over Cuba just a few hours before the order was conveyed to the Mace B sites in Okinawa.

Synthesizing EBC-46, the cancer-killing compound in rainforest blushwood fruit

A few years ago you may have seen reports of the cancer-killing blushwood fruit from the Austrailian rainforest. Injected into a tumor it provokes an inflammatory immune response. Recently, researchers at Stanford University have synthesized it from phorbol.

A good starting point for making EBC-46, Wender and colleagues realized, is the plant-derived compound phorbol. More than 7,000 plant species produce phorbol derivatives worldwide and phorbol-rich seeds are commercially inexpensive. The researchers selected Croton tiglium, commonly known as purging croton, an herb used in traditional Chinese medicine.

Wender, P.A., Gentry, Z.O., Fanelli, D.J. et al. Practical synthesis of the therapeutic leads tigilanol tiglate and its analogues. Nat. Chem. (2022). https://doi.org/10.1038/s41557-022-01048-2
News report from 2019

SV23: Nonblocking assignment across a task ref port

Following up to “SystemVerilog — always blocks are needed less and less“, which had an example of an assignment that should have been legal, but wasn’t.

Until now it hasn’t been legal to make a nonblocking assignment (NBA) to a static module variable across a reference port of a function or task. But in the 2023 revision of the standard that restriction has been lifted as long as the reference port has been annotated with the new static qualifier. Thanks to Steven Sharp for driving that enhancement. His enhancement also lifted the restriction against referring to such ports from within a forkjoin_any or forkjoin_none block, again given the new static qualifier.

So here’s the earlier example modified to be legal in SystemVerilog 2023

virtual class C#(type T);
  static task ff(const ref logic clk,
                 const ref T in,
                 ref static T out);
    forever @(posedge clk) out <= in;
  endtask
endclass

module test#(type T) (input logic clk, 
                      input T in,
                      output T out);
  initial C#(T)::ff(clk, in, out);
endmodule

SV23: Terms ‘master’ and ‘slave’ purged from next revision of SystemVerilog standard

In December 2020, the IEEE SA Standards Board resolved, “IEEE standards should be written in such a way as to avoid non-inclusive and insensitive terminology (see IEEE Policy 9.27) and other deprecated terminology (see clause 10 of the IEEE SA Style Manual) except when required by safety, legal, regulatory, and other similar considerations. Terms such as master/slave, blacklist, and whitelist should be avoided.”

John Byler in “What Is the Best Way to Purge Master and Slave Terms From Engineering Documents?” lists some proposed replacements, such as “initiator-target”, and writes

“Whatever terminology replaces master-slave, the critical matter is that a far less degrading alternative is agreed to and implemented as soon as possible.”

A special thanks should go to Don Mills, the SystemVerilog trainer and one of the driving participants in the 2023 revision of the standard, who was the first to raise this issue in the committee.

The SV23 committee eventually went with the “initiator-target” replacement terminology.

5-minute daily IMST lowers blood pressure as much as exercise or drugs

According to Lisa Marshall in https://www.colorado.edu/today/2021/06/29/5-minute-breathing-workout-lowers-blood-pressure-much-exercise-drugs

Working out just five minutes daily via a practice described as “strength training for your breathing muscles” lowers blood pressure and improves some measures of vascular health as well as, or even more than, aerobic exercise or medication, new CU Boulder research shows.

The study, published today in the Journal of the American Heart Association, provides the strongest evidence yet that the ultra-time-efficient maneuver known as High-Resistance Inspiratory Muscle Strength Training (IMST) could play a key role in helping aging adults fend off cardiovascular disease––the nation’s leading killer.

They used a POWERbreathe K3 inspiratory muscle training device https://www.powerbreathe.com/product/powerbreathe-k-series , but maybe even a cheap traditional breather used every day would have benefit.

Marshall also writes

Preliminary results from the same group suggest IMST also improved some measures of brain function and physical fitness. And previous studies from other researchers have shown it can be useful for improving sports performance.

and

In an editorial accompanying the journal publication, researchers not involved in the study called for more research on the myriad health benefits, including potentially mental health benefits, the practice may hold.

“Why build 600 new unprofitable coal plants?”

The subtitle of Stuart Braun’s article asks

Governments in Asia are planning 600 new coal plants that could lose investors $150 billion and derail efforts to limit temperature rise in line with climate targets, according to a new report. But why?

But why not?

In the end, taxpayers will have to bear much of the cost of the money-losing new plants, according to the report. Of the $150 billion that Carbon Tracker estimates says could be lost, consumers and taxpayers will foot the bill in countries where coal power is subsidized and propped up with public money. 

The selective advantage to seeing what’s over the next hill

In “Ten years of ancient genome analysis has taught scientists ‘what it means to be human’ ” about the peopling of the Americas, evolutionary biologist Professor Eske Willerslev says

We were taught in school that people would stay put until the population grew to a level where the resources were exhausted. But we found people were spreading around the world just to explore, to discover, to have adventures.

The last 10 years have shown us a lot about our history and what it means to be human. We won’t ever see that depth of human experience on this planet again – people entered new areas with absolutely no idea of what was in front of them. It tells us a lot about human adaptability and how humans behave.

and archaeologist Professor David Meltzer says

A lot of what has been discovered about the peopling of the Americas could not have been predicted. We have seen how rapidly people were moving around the world when they have a continent to themselves, there was nothing to hold them back. There was a selective advantage to seeing what was over the next hill.