inout ports 
Author Message
 inout ports

does anybody have experience using inout ports in verilog? i am
trying to use them but whenever i assign a value to them the
compiler flags an error.

matt debergalis



Tue, 07 Jan 1997 03:09:11 GMT  
 inout ports

Matt,

Does this help?

module InOut;
  inout diddle;
  reg   ididdle; assign diddle = ididdle;

// usage as an input
  initial
  begin
    if( diddle ) $display("I got a diddle");
  end

// usage as an output
  initial
  begin
    ididdle = 1; // diddle will track ididdle
  end

endmodule

Chris Starr
ASIC EDA Consultant



Tue, 07 Jan 1997 23:51:10 GMT  
 inout ports
this technique works fine, thanks. i have a question though.
if you write to the register and then later read the inout port,
will the register compete with the port? in other words, should i
first store a 'z' to the register before reading the port?

matt debergalis



Wed, 08 Jan 1997 04:23:00 GMT  
 inout ports
From "Digital Design and Synthesis with Verilog HDL", Sternheim, Singh,
Madhaven, and Trivedi, Automata Press, 1993, pp. 309-310:

"A bidirectional port is specified as a wire which accepts its value from a
"shadow register" through a continuous assignment.  When the port is
enabled as an output you set the value of the shadow register to the
desired output value.  When the port is disabled for output and should
operate as an input, simply set the shadow register to Z.  This enables the
other signal input to the port."



Wed, 08 Jan 1997 05:24:47 GMT  
 inout ports
Inout ports are wires, which means you can not perform procedural assignments
on them. You need to use a continuous assignment, if only to assign a register,
which can be assigned in a procedure:

module foo (bar);
inout bar;
reg bar_out;

assign #1 bar = bar_out; // I use this alot for order dependence coding.
                         // Much better performance than zillions of
                         // non blocking assignments.
initial
  begin
    bar_out = 1'hz;
  end

always
  begin

    casex (bar_out)
    1'b0: bar_out = 1'bz;
    1'bz: bar_out = 1'b1;
    1'b1: bar_out = 1'b0;
    endcase
  end
endmodule

                                                John Williams



Thu, 09 Jan 1997 15:48:38 GMT  
 inout ports
|> this technique works fine, thanks. i have a question though.
|> if you write to the register and then later read the inout port,
|> will the register compete with the port? in other words, should i
|> first store a 'z' to the register before reading the port?
|>
|> matt debergalis

Yep, you get the picture.
--
___________________________________________________________

Cadence Design, 270 Billerica Rd., Chelmsford MA 01824-4140
"I used to have Time. Now I have Twins"
___________________________________________________________



Sat, 11 Jan 1997 02:57:37 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. inout port connection question

2. INOUT port

3. how to do inout port simulation

4. inout port

5. use of inout port

6. Possible to MUX/DEMUX inout port??

7. Inout ports

8. How to write to inout port?

9. inout port problem

10. inout port

11. inout port problems

12. newbie: simulating inout ports

 

 
Powered by phpBB® Forum Software