Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
13 years ago

ModelSIM and SPI

Hi

Can someone tell me how to show SPI data in ModelSim? I have the SCLK and MOSI plus CS but it would be nice to see the numerical value rather than having to check the value of MOSI on each rising edge of SCLK

I am sure this must be easy but I haven't been able to figure it out. :(

Thanks

4 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    what numerical value are you refering to? a real SPI controller has to load in the data bit by bit.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    In the Modelsim display I have 3 signals. The CS which goes low for the transmit period. I have 18 clock pulses at 25 MHz for the SCLK signal and then the data value which is shifted out of the MOSI. On my logic analyzer there is an option to decode the shift register train into a hex number based upon its alignment to the rising edges of the SCLK. I can quickly see the value without having to manually calculate the value. I just thought there would be a simple way to decode the SPI signal for display purposes in Modelsim.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    if you have the shiefted value, you can simply change its radix to hex in the wave window.

    Otherwise you can create dummy signals in your testbench to display it however you want.