Home > Community > Forums > Functional Verification > Differences b/w logic , reg & wire

Email

* Required Fields

Recipients email * (separate multiple addresses with commas)

Your name *

Your email *

Message *

Contact Us

* Required Fields
First Name *

Last Name *

Email *

Company / Institution *

Comments: *

 Differences b/w logic , reg & wire 

Last post Fri, Aug 24 2007 6:40 AM by archive. 7 replies.
Started by archive 24 Aug 2007 06:40 AM. Topic has 7 replies and 2724 views
Page 1 of 1 (8 items)
Sort Posts:
  • Fri, Aug 24 2007 6:40 AM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,930
    Differences b/w logic , reg & wire Reply

    hi,

    1.      i  know the differences between reg & wire...but i what to know the differences between logic , reg & wire clearly.

    2.     When iam writing code in systemverilog using URM ..... i got a simple bug.. which iam pasting below & please let me know where to use reg , wire & logic in systemverilog coding.....


      
          

    ncelab: *W,ENUMERR (./sv_module/sips_apb_env.sv,53|66): This
    assignment is a violation of SystemVerilog strong typing rules for
    enumeration datatypes.
                .PWRITE(dut_if.PWRITE),
                      |
    ncelab: *E,ICDPAV (./sv_module/sips_apb_dut_wrap.sv,25|19): Illegal combination
    of driver and procedural assignment to variable dut_if.PWRITE detected.
                .PADDR(dut_if.PADDR),
                     |
    ncelab: *E,ICDPAV (./sv_module/sips_apb_dut_wrap.sv,26|18): Illegal combination
    of driver and procedural assignment to variable dut_if.PADDR detected.
                .PWDATA(dut_if.PWDATA),      


    ... Raghavendra


    Originally posted in cdnusers.org by raghavendrap
    • Post Points: 0
  • Fri, Aug 24 2007 7:17 AM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,930
    RE: Differences b/w logic , reg & wire Reply

    I think it would help the discussion if you would add the following info:
    1. The declaration for dut_if.PWRITE
    2. The port declaration for .PWRITE


    Originally posted in cdnusers.org by TAM
    • Post Points: 0
  • Fri, Aug 24 2007 7:22 AM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,930
    RE: Differences b/w logic , reg & wire Reply

    ncelab: *W,ENUMERR (./sv_module/sips_apb_env.sv,53|66): This
    assignment is a violation of SystemVerilog strong typing rules for
    enumeration datatypes.
    .PWRITE(dut_if.PWRITE),


    You need to show us the declaration of:

    PWRITE inside the DUT and
    dut_if.PWRITE



    ncelab: *E,ICDPAV (./sv_module/sips_apb_dut_wrap.sv,25|19): Illegal combination
    of driver and procedural assignment to variable dut_if.PWRITE detected.



    Again we need full declaration that shows:

    1. Data type
    2. Direction (I/O/IO)

    to comment properly. From the clear error message it is clear that you have a "procedural assignment" - say inside task/function/initial PWRITE and perhaps a "net" connection from a block beneath.

    Show us full code to help better. If it is too many lines, consider posting a tar ball or send via email ajeetha <> gmail.com

    Interestingly I was doing some revamp of our (CVC, www.noveldv.com) SystemVerilog training material this week and found similar examples that we show during our classes.

    Regards
    Ajeetha, CVC
    www.noveldv.com


    Originally posted in cdnusers.org by ajeetha
    • Post Points: 0
  • Sat, Aug 25 2007 12:03 AM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,930
    RE: Differences b/w logic , reg & wire Reply

    thanks for your cooperation in helping me Tam..
               i have declared as
                        dut.v file....ouput reg PWRITE
                   dut_interface.sv...logic PWRITE
                    dut_wrap.sv--------- .PWRITE(dut_if.PWRITE)

                                 dut_if is the dut interface name..........


    Originally posted in cdnusers.org by raghavendrap
    • Post Points: 0
  • Mon, Aug 27 2007 9:53 AM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,930
    RE: Differences b/w logic , reg & wire Reply

    I've run a couple of tests using an interface, an always block and a submodule connection and I can't duplicate all of the behavior that you are seeing. :-(

    One thing that has been explained to me that the SystemVerilog has two properties associated with a signal, its "type" and its "kind." The "kind" is the familiar Verilog "reg", "var" or "wire". The "type" is the data type, 4-state "logic", 2-state "bit", integer and real. You can leave out the "kind", as long as you have specified the "type". But if you do, then "reg" is assumed.

    "logic PWRITE" is thus the same as "reg logic PWRITE".

    In SystemVerilog, you are allowed one continuous assignment to a "reg", so you can connect that interface signal to a submodule's port. But if you also try to drive it using a behavioral assignment or connect it to a second port, you will get an error. So I can easily get the tool to complain about different combinations of drivers on a PWRITE signal that is implicitly declared as a "reg". But I can't quite get it to complain in the same way that you are seeing, so I can't really be sure what you might have done.

    See what happens if you try declaring the signal as a wire.

    wire logic PWRITE;

    Or go thru your assignments and connections to that signal and make sure that they are all consistant with a "reg" kind of signal.


    Originally posted in cdnusers.org by TAM
    • Post Points: 0
  • Tue, Aug 28 2007 12:10 AM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,930
    RE: Differences b/w logic , reg & wire Reply

    This is not quite correct.

    In SystemVerilog, logic and reg are both data types. In fact, they are the same data type.

    So 'logic PWRITE' is like 'var logic PWRITE' and 'reg PWRITE' is like 'var reg PWRITE'.


    Originally posted in cdnusers.org by shalom
    • Post Points: 0
  • Tue, Aug 28 2007 4:53 AM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,930
    RE: Differences b/w logic , reg & wire Reply


    i.e inorder to avoid the confusion of reg & wire....here in SV we are using "logic".


    Originally posted in cdnusers.org by raghavendrap
    • Post Points: 0
  • Tue, Aug 28 2007 12:11 PM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,930
    RE: Differences b/w logic , reg & wire Reply

    Try making the PWRITE signal as "wire" instead of "logic" - "logic" doesn't allow multiple drivers while wire does. I just now fixed a similar problem in our inhouse code. I didn't do a thorough analysis so can't give you the exact rationale, maybe will do that tomorrow if I get time.

    Cheers
    Ajeetha, CVC
    www.noveldv.com


    Originally posted in cdnusers.org by ajeetha
    • Post Points: 0
Page 1 of 1 (8 items)
Sort Posts:
Started by archive at 24 Aug 2007 06:40 AM. Topic has 7 replies.