Part 7: Assignments – RTL Design Success

Author: Craig Maiman – Principal RTL Design Consultant

Welcome to the RTL Design Success series — Part 7 of 9

6.3 Default Assignments

Whenever you have a process block (both sequential and combinatorial) you run the risk of creating unintentional loops.  Particularly if you have conditional statements in the process.

The best way I’ve found to avoid these is to have default assignments at the beginning of the process block.  Doing it this way you only need to specify the places where the signals get asserted, not having to worry about all the conditions where they are not.

A code snippet showing this:

always_comb begin

      // Defaults

      frame_fifo_rd         = 1’b0;

      hdr_w0_wen            = 1’b0;

      hdr_w1_wen            = 1’b0;

      hdr_w2_wen            = 1’b0;

      hdr_w3_wen            = 1’b0;

      unique case (current_state)

        `FEF_PREP_IDLE     : begin

           if ( !frame_fifo_empty && !soft_resetq ) begin

              frame_fifo_rd = 1’b1;

              next_state    = `FEF_PREP_HDR_IN0;


           else next_state  = `FEF_PREP_IDLE;


        `FEF_PREP_HDR_IN0    : begin             // W0 at FIFO output

           hdr_w0_wen       = 1’b1;              // Save W0

           if ( !frame_fifo_empty ) begin

              frame_fifo_rd = 1’b1;              // Get the next word

              next_state    = `FEF_PREP_HDR_IN1;


           else next_state  = `FEF_PREP_HDR_IN0;


6.4 Instrument Your RTL

When running a unit-level testbench, especially when running long randomized tests, I have often found it useful to instrument my code so that I can more easily debug issues (Only turn these on when actively debugging an issue, so your log file doesn’t blow up).  It can also be useful to see what randomized tests do to the state flow and patterns of behavior of the unit under test.

Trying to sort through hours of waves and thousands of signals may be intractable, so instrumenting the code can be extremely useful.

Instrumenting can be as simple as printing out what state a FSM is in or if a certain combination of signals and/or states is detected.  As you get closer to a bug, your instrumenting can get more specific.

Here is example of instrumentation:

   always_ff @(posedge clock) begin

      if (opb_tmr_timer_info_q3.valid && opb_tmr_timer_info_q3.remove_match_a)

$display($time, ”  Instance %m  OPB TIMER:        REMOVE Match on A for Addr(CID/SEQ#): %h”, opb_tmr_timer_data_q3.address);

      if (opb_tmr_timer_info_q3.valid && opb_tmr_timer_info_q3.remove_match_b)

$display($time, ”  Instance %m  OPB TIMER:        REMOVE Match on B for Addr(CID/SEQ#): %h”, opb_tmr_timer_data_q3.address);

      if (opb_tmr_timer_info_q3.valid && opb_tmr_timer_info_q3.restart_match_a)

$display($time, ”  Instance %m  OPB TIMER:        RESTART Match on A for Addr(CID/SEQ#): %h”, opb_tmr_timer_data_q3.address);

      if (opb_tmr_timer_info_q3.valid && opb_tmr_timer_info_q3.restart_match_b)

$display($time, ”  Instance %m  OPB TIMER:        RESTART Match on B for Addr(CID/SEQ#): %h”, opb_tmr_timer_data_q3.address);

if (opb_tmr_timer_info_q3.valid && (opb_tmr_timer_info_q3.change_to_get_match_a || opb_tmr_timer_info_q3.change_to_get_match_b))

$display($time, ”  Instance %m  OPB TIMER:        CGT Timer for Addr(CID/SEQ#): %h”, opb_tmr_timer_data_q3.address);


An example of testbench output from instrumenting:

105300  Instance opb_tb.opb_top_inst.opb_buffer_inst OPB BUFFER:       Req:  1   Resp: 1   Src: 0   Addr(CID/SEQ#): 01011111   Data.cqid: feed   Data.swtag: 0000000000000000   Data.isget: 0   Data.isack: 0   Data.wfgd: 0

118300  Instance opb_tb.opb_top_inst.opb_buffer_inst OPB BUFFER:       Req:  1   Resp: 1   Src: 0   Addr(CID/SEQ#): 01011112   Data.cqid: feed   Data.swtag: 0000000000000000   Data.isget: 0   Data.isack: 0   Data.wfgd: 0

Of course I also recommend the usage of SystemVerilog Assertions for checking protocols and detecting illegal conditions and transitions.

XtremeEDA is an experienced partner you can trust!!

Cadence Design Systems helps engineers pick up the development tempo. A leader in the market for electronic design automation (EDA) software, Cadence sells and leases software and hardware products used to design integrated circuits (ICs), printed circuit boards (PCBs), and other electronic systems. Semiconductor and electronics systems manufacturers use its products to build components for wireless devices, networking equipment, and other applications. The company also provides maintenance and support, and offers design and methodology consulting services. Customers have included Pegatron, Silicon Labs, and Texas Instruments. Cadence gets more than half of its sales from customers outside the US.

Synopsys, Inc. (Nasdaq:SNPS) provides products and services that accelerate innovation in the global electronics market. As a leader in electronic design automation (EDA) and semiconductor intellectual property (IP), Synopsys’ comprehensive, integrated portfolio of system-level, IP, implementation, verification, manufacturing, optical and field-programmable gate array (FPGA) solutions help address the key challenges designers face such as power and yield management, system-to-silicon verification and time-to-results. These technology-leading solutions help give Synopsys customers a competitive edge in quickly bringing the best products to market while reducing costs and schedule risk. For more than 25 years, Synopsys has been at the heart of accelerating electronics innovation with engineers around the world having used Synopsys technology to successfully design and create billions of chips and systems. The company is headquartered in Mountain View, California, and has approximately 90 offices located throughout North America, Europe, Japan, Asia and India.

asicNorth was established in January 2000 with one purpose in mind: deliver the highest quality design services possible. In an industry that can be quite volatile at times, it is important to have a design partner that you can depend upon to deliver the skills you need when you need them. A project can only be successful if there are:

Top quality skills on the team
Communication with the customer
Attention to detail
Cost sensitivity
Focus on the schedule

Today, asicNorth is enabling high-tech industry leaders and startups alike with a combination of digital, analog, and mixed-signal design capabilities. Driven to produce successful results, asicNorth is Making Chips Happen™.

Codasip delivers leading-edge RISC-V processor IP and high-level processor design tools, providing IC designers with all the advantages of the RISC-V open ISA, along with the unique ability to customize the processor IP. As a founding member of RISC-V International and a long-term supplier of LLVM and GNU-based processor solutions, Codasip is committed to open standards for embedded and application processors. Formed in 2014 and headquartered in Munich, Germany, Codasip currently has R&D centers in Europe and sales representatives worldwide. For more information about our products and services, visit For more information about RISC-V, visit

Founded in 1999, Avery Design Systems, Inc. enables system and SOC design teams to achieve dramatic functional verification productivity improvements through the use of

Formal analysis applications for RTL and gate-level X verification;

Robust Verification IP for PCI Express, USB, AMBA, UFS, MIPI, DDR/LPDDR, HBM, HMC, ONFI/Toggle, NVM Express, SCSI Express, SATA Express, eMMC, SD/SDIO, Unipro, CSI/DSI, Soundwire, and CAN FD standards.

Siemens EDA
The pace of innovation in electronics is constantly accelerating. To enable our customers to deliver life-changing innovations to the world faster and to become market leaders, we are committed to delivering the world’s most comprehensive portfolio of electronic design automation (EDA) software, hardware, and services.