Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
17241 Discussions

The question about bidirectional port

Altera_Forum
Honored Contributor II
1,492 Views

In my design, I have a inout port. Then I search it, found most examples, they only put the high impedance for output direction as (case 1): 

 

inout [7:0 ]data_io; 

 

reg [7:0] out_a; 

wire [7:0] in_b; 

reg rnw; 

 

assign data_io = (rnw==1'b0) out_a : 8'bZ; /// when read, assign io as high impedance 

assign in_b = data_io;  

 

 

But I think we may also put high impedance in both direction like (case 2): 

 

inout [7:0 ]data_io; 

 

reg [7:0] out_a; 

wire [7:0] in_b; 

reg rnw; 

 

assign data_io = (rnw==1'b0) out_a : 8'bZ; /// when read, assign io as high impedance 

assign in_b = (rnw==1'b1) data_io : 8'bZ; /// when write, read high impedance  

 

 

 

So my question is, will put high impedance in both directions (like case 2) cause problems?  

My understanding is it won't cause problem. The difference between case 1 and case 2 is, in case 1, the "in_b" will equal the output date during write operation. 

 

Thanks.
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
695 Views

 

--- Quote Start ---  

In my design, I have a inout port. Then I search it, found most examples, they only put the high impedance for output direction as (case 1): 

 

inout [7:0 ]data_io; 

 

reg [7:0] out_a; 

wire [7:0] in_b; 

reg rnw; 

 

assign data_io = (rnw==1'b0) out_a : 8'bZ; /// when read, assign io as high impedance 

assign in_b = data_io;  

 

 

But I think we may also put high impedance in both direction like (case 2): 

 

inout [7:0 ]data_io; 

 

reg [7:0] out_a; 

wire [7:0] in_b; 

reg rnw; 

 

assign data_io = (rnw==1'b0) out_a : 8'bZ; /// when read, assign io as high impedance 

assign in_b = (rnw==1'b1) data_io : 8'bZ; /// when write, read high impedance  

 

 

 

So my question is, will put high impedance in both directions (like case 2) cause problems?  

My understanding is it won't cause problem. The difference between case 1 and case 2 is, in case 1, the "in_b" will equal the output date during write operation. 

 

Thanks. 

--- Quote End ---  

 

 

the idea of two directions is: 

(1) pin as output, so you drive it, external device is meant to apply z 

(2) pin as input, external device drives it and you just read it so use z in order not to read your own drive(in contention with external drive) 

so in short either you drive it or external device but never both. But either can read it anytime. 

you can if it helps your design apply z to input buffer if available at io block.
0 Kudos
Reply