Results 1 to 2 of 2

Thread: Module output gives high impedence when connected to the inout port of another module

  1. #1
    Join Date
    Nov 2016
    Posts
    1
    Rep Power
    1

    Unhappy Module output gives high impedence when connected to the inout port of another module

    I have created a module which calls another module within it's body, and the final output of the output module gives me the desired output. But when I connect this output wire to the 'inout' port of another module(bidir_switch) ,the output of the former module(Outer) as well as inout port goes to high impedance. Please find the basic structure of the actual code below(sorry, the actual code is too big). Could you please provide some insight into this problem? I have been trying to debug this problem for almost a week now :-/

    module testbench();
    reg in1,in2,clk;
    wire out,d1;
    Outer O(.in1(in1),.in2(in2),.out.(out),.clk(clk));
    bidir_switch BS(.a1(d1),.a2(out),.control(1'b1));
    endmodule

    module bidir_switch(a1,a2,control);
    inout a1,a2;
    input control;
    tranif1(a1,a2,control);
    endmodule

    module Outer(in1,in2,out,clk);
    input in1,in2,clk;
    output out;
    inner1 I1(i1.(in1),i2.(in2),o.(out),.clk(clk));
    endmodule

    module inner1(i1,i2,o,clk);
    input i1,i2,clk;
    output o;
    inner2 I2(q1.(out1),q2.(in3),qo.(o),.clk(clk));
    endmodule

    inner2(q1,q2,qo,clk);
    input q1,q2,clk;
    output reg qo;
    always@(posedge clk)
    begin
    qo <= q1;
    end
    endmodule

  2. #2
    Join Date
    Dec 2015
    Location
    Belgium
    Posts
    97
    Rep Power
    1

    Default Re: Module output gives high impedence when connected to the inout port of another mo

    Hello Krish_pathi,
    From what I read you could be bumping into a similar problem I had some time ago reading from a GPIO port :
    FPGA's are a bit different from Computer programming.
    You do not 'CALL' a routine, you instantiate a hardware object.
    Therefore: if you connect 2 ports, 1 output and 1 inout port, you have to 'tell' the inout port that it needs to go into the state of high impedance in order to enable the port on the other side, to drive the line connecting the 2 ports. If both sides would want to drive the connecting line and 1 port wants high and other side low you end up with a short circuit.
    In practice: you assign 'z' of high impedance to the inout port you need to to read from.

    module tri_buf (a,b,enable);
    2input a;
    3output b;
    4input enable;
    5wire a,enable;
    6wire b;
    7
    8 assign b = (enable) ? a : 1'bz;
    9
    10 endmodule


    I hope this can help,
    Best regards,
    Johi

Similar Threads

  1. RAM 1-port mega function - Single Port Ram module
    By songa in forum Quartus II and EDA Tools Discussion
    Replies: 3
    Last Post: January 22nd, 2015, 01:05 AM
  2. Using high speed USB wifi module under µClinux
    By Mederick in forum Linux Forum
    Replies: 0
    Last Post: October 25th, 2014, 11:30 PM
  3. Using Single Port Ram module in a parent module
    By gates in forum Quartus II and EDA Tools Discussion
    Replies: 1
    Last Post: May 22nd, 2013, 09:47 AM
  4. modelsim: (vsim-3053) Illegal output or inout port connection
    By ramanandn in forum Quartus II and EDA Tools Discussion
    Replies: 2
    Last Post: December 7th, 2010, 12:08 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •