Author Topic: Xilinx ISim: Display I2C as hex in simulations?  (Read 3032 times)

0 Members and 1 Guest are viewing this topic.

Offline Pack34Topic starter

  • Frequent Contributor
  • **
  • Posts: 753
Xilinx ISim: Display I2C as hex in simulations?
« on: September 11, 2015, 06:39:21 pm »
I have a feeling that I'm going to be out of luck here, but...

I'm trying to get back up to speed with FPGAs and I have some code running. In my testbench I have some I2C events going on and was wondering if there's a way to decode the I2C transmission to display what's going on in hex similar to what my Agilent does when I physically probe something.

I could actually put it on a dev board and probe what's physically happening but I want to get more comfortable with simulating.

Does anyone have some insight into this, or am I stuck with doing it by eye?

EDIT:// I'm using Xilinx ISE, and using VHDL.
 

Offline commie

  • Frequent Contributor
  • **
  • Posts: 278
  • Country: gb
Re: Xilinx ISim: Display I2C as hex in simulations?
« Reply #1 on: September 11, 2015, 07:36:03 pm »
Hi,

You want some sort of I2C probe, which decodes the I2C activity and displays it in  hex bytes on a e.g., 16x2LCD? If that's correct, then you are looking at a separate project in itself  for a micro-controller coupled with a good compiler which supports I2C commands.
 

Offline Pack34Topic starter

  • Frequent Contributor
  • **
  • Posts: 753
Re: Xilinx ISim: Display I2C as hex in simulations?
« Reply #2 on: September 11, 2015, 07:58:28 pm »
I was trying to figure out if there was a way to decode it directly in ISim. I have a physical I2C decoder on my desk but I was hoping that there was a way to display it in the simulator.

I know how to select a bus and change how it's displayed, just wasn't sure if there was a way to do decode it on a single SDA line. Unfortunately, it looks like I'm out of luck.
 

Offline Neilm

  • Super Contributor
  • ***
  • Posts: 1546
  • Country: gb
Re: Xilinx ISim: Display I2C as hex in simulations?
« Reply #3 on: September 11, 2015, 08:00:50 pm »
Have you thought about writing an I2C decoder in the simulator? Then you could put put into the ISim waveform and set the radix to hex. Bingo
Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe. - Albert Einstein
Tesla referral code https://ts.la/neil53539
 

Offline Pack34Topic starter

  • Frequent Contributor
  • **
  • Posts: 753
Re: Xilinx ISim: Display I2C as hex in simulations?
« Reply #4 on: September 11, 2015, 08:23:24 pm »
Have you thought about writing an I2C decoder in the simulator? Then you could put put into the ISim waveform and set the radix to hex. Bingo

I have not. Can you point me in the right direction on where to get started with this? I'm using VHDL.
 

Offline Neilm

  • Super Contributor
  • ***
  • Posts: 1546
  • Country: gb
Re: Xilinx ISim: Display I2C as hex in simulations?
« Reply #5 on: September 11, 2015, 08:41:09 pm »
Have a look at https://www.eewiki.net/display/LOGIC/I2C+Master+%28VHDL%29
It works pretty well as an I2C master (I have used it in the past). I would have thought you could modify this to do what you want.
Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe. - Albert Einstein
Tesla referral code https://ts.la/neil53539
 

Offline Bassman59

  • Super Contributor
  • ***
  • Posts: 2501
  • Country: us
  • Yes, I do this for a living
Re: Xilinx ISim: Display I2C as hex in simulations?
« Reply #6 on: September 14, 2015, 04:36:50 am »
Have you thought about writing an I2C decoder in the simulator? Then you could put put into the ISim waveform and set the radix to hex. Bingo

I have not. Can you point me in the right direction on where to get started with this? I'm using VHDL.

All you need is a behavioral (doesn't have to be synthesizable) bus monitor entity. It sits on the bus, with the SCL and SDA signals as inputs only. Then you look for the various bus conditions (START, STOP, etc). It's fairly simple to do -- IF you free yourself from a strictly-synthesizable RTL mentality. VHDL is actually a fairly expressive language. It was intended for simulation and modeling before synthesis entered the picture.  And this thing you want to do is sort of the simplest intro to pure test bench/verification coding you'll run into.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf