• 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. Wand Wires to be driven by Program Block and Module blo...

Stats

  • Locked Locked
  • Replies 10
  • Subscribers 64
  • Views 17380
  • 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

Wand Wires to be driven by Program Block and Module block

archive
archive over 18 years ago

Hi All,

I have a design that have some bidirectional signals, driven one side by Verilog Module, next side by SV testbench.
But signals should have a functionality of wand (wire-and) type only
Both are interacting through SV Interfaces only.

Three combinations I tried:

  1. from SV testbenchn,  if I decleare  logic a , b , it give errors inout port must be a net type
  2. when I declare them as  wand a,b, and it give error while driving them through TB, it give error usage of 'intf_inst.b' inconsistent with 'net' object.
  3. when I declare with input and output types, it give error blocking and non-blocking assignments to heirarchical references in a program block are illegal
What's the solution?

Regards
Mayank

Sample code is as such

interface intf( input logic clock);
wand a,b;

modport port (inout a,b);

endinterface

program main (intf intf_inst);
 int count =0;
initial begin
    while (1) begin
    #10;
        intf_inst.b = 1'b1;
        count = count +1;
        if (count >1000) $finish;
    end
    
end
endprogram

module top;
    reg data_value, clock;
    intf intf_inst (clock);
    main m(intf_inst.port);
     assign  intf_inst.a = data_value;

    initial begin
          clock =0;
        forever begin
              #10 clock = ~clock;
        end
    end
endmodule


Originally posted in cdnusers.org by mayank
  • Cancel
Parents
  • archive
    archive over 18 years ago

    Even though this is SystemVerilog, you still have to deal with some of the restrictions enforced by the underlying Verilog language itself. In that language, you cannot make behavioral assignments directly to a "net" type. A net type like wand can have multiple drivers. You can only make behavioral assignments to a single driver of the net. Then Verilog will resolve the multiple drivers into their final value.

    interface intf( input logic clock);
    wand a,b;
    logic b_driver;

    assign b = b_driver;

    modport port (inout a,b);

    endinterface

    program main (intf intf_inst);
    int count =0;
    initial begin
    while (1) begin
    #10;
    intf_inst.b_driver = 1'b1;

    If you truely wanted the port to be bidirectional, you might want to put a control on the behavioral driver you are creating:

    interface intf( input logic clock);
    wand a,b;
    logic b_driver,b_ctrl;

    modport port (inout a,b);

    assign b = b_ctrl ? b_driver : 'bz;

    endinterface


    Originally posted in cdnusers.org by TAM
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • archive
    archive over 18 years ago

    Even though this is SystemVerilog, you still have to deal with some of the restrictions enforced by the underlying Verilog language itself. In that language, you cannot make behavioral assignments directly to a "net" type. A net type like wand can have multiple drivers. You can only make behavioral assignments to a single driver of the net. Then Verilog will resolve the multiple drivers into their final value.

    interface intf( input logic clock);
    wand a,b;
    logic b_driver;

    assign b = b_driver;

    modport port (inout a,b);

    endinterface

    program main (intf intf_inst);
    int count =0;
    initial begin
    while (1) begin
    #10;
    intf_inst.b_driver = 1'b1;

    If you truely wanted the port to be bidirectional, you might want to put a control on the behavioral driver you are creating:

    interface intf( input logic clock);
    wand a,b;
    logic b_driver,b_ctrl;

    modport port (inout a,b);

    assign b = b_ctrl ? b_driver : 'bz;

    endinterface


    Originally posted in cdnusers.org by TAM
    • 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