Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Simulating a bi-directional port

Status
Not open for further replies.

mauromj

Newbie level 1
Joined
Aug 3, 2015
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
12
I am using VHDL to try and simulate an I2C master and slave.

My slave has an inout port named i2c_sda.

My master has a in port named i2c_sda_in and a output port named i2c_sda_out.

In actual hardware, this assignment is very easy to do. All that needs to be done is the following:


Code dot - [expand]
1
2
3
4
5
6
7
8
i2c_sda <= '0' when i2c_sda_out = '0' else 'Z';
 
i2c_master_instance : i2c
port map
(
  master_sda_in  => i2c_sda,
  master_sda_out => i2c_sda_out
)



This does not work however for simulations. What is the work around for this? I have attempted to "switch" between the assignments using a mux but have not found a working solution yet.

Thanks
 
Last edited by a moderator:

This does not work however for simulations.
As it's nicely mentioned in Edaboard forum rules Only you know what "doesn't work" means... Please clarify.

Presumed the slave is also modelling an open drain output, you have to add a weak pull-up driver in the testbench. If the slave is not clearly driving '0' and 'Z' only, a resolution function may be needed to connect both ports.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top