• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Functional Verification
  3. NC-verilog logical bug

Stats

  • Locked Locked
  • Replies 5
  • Subscribers 65
  • Views 15005
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

NC-verilog logical bug

Aiya
Aiya over 13 years ago

 I found a logical bug of simulation RTL code using NC-verilog.

Here is the test RTL code of mux implementation,

the input data of mux options are all zeroes (1'b0) 

the select signal is unknown (2'bxx)

The output result of do0 = 1'bx, do1 = 1'bx,  do2 = 1'b0,

varies depending on the coding style,

 Is this a bug of NC-verilog tool ? Can it be fixed ?

module  muxa(
input   wire  [ 1:0]  sel   ,
input   wire          di0   ,
input   wire          di1   ,
input   wire          di2   ,
input   wire          di3   ,
output  reg           do0   ,
output  wire          do1   ,
output  wire          do2  
);

always@*
  case(sel)
    2'h0: do0 = di0;
    2'h1: do0 = di1;
    2'h2: do0 = di2;
    2'h3: do0 = di3;
  endcase

wire  [3:0] di    = {di3, di2, di1, di0};
assign      do1   = di[sel];
assign      do2   = sel[1] ? (sel[0] ? di3 : di2) : (sel[0] ? di1 : di0);

endmodule

  • Cancel
Parents
  • Aiya
    Aiya over 13 years ago

    Thank you Shalom, but could you explain in more detail ?

     Logically, the output of mux should 1'b0 right?

    But using case or index coding style for mux implementation is more readable and explicit

    Is the do2 is the only option if I want to get correct logic output ? Or any syntax can be added to solve this ?

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • Aiya
    Aiya over 13 years ago

    Thank you Shalom, but could you explain in more detail ?

     Logically, the output of mux should 1'b0 right?

    But using case or index coding style for mux implementation is more readable and explicit

    Is the do2 is the only option if I want to get correct logic output ? Or any syntax can be added to solve this ?

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
No Data

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information