UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Explorer
Explorer
863 Views
Registered: ‎11-23-2017

Simple behavioral Simulation does not match run

Hi!

I am trying to simulate a simple microblaze system with GPIO output to LEDs. The LEDs are being blinked by the microblaze.

My simulation either shows nothing, or I am misguided about the waveforms I should be looking at, since nothing seems to be happening on the GPIO - but this works in reality!  I can control blinking of the LEDs when programming the AC701 directly.

I am attaching my testbench, waveform, and block diagram.

module test_bench(
);
    
    reg sys_clk_pin_p;
    reg sys_clk_pin_n;
    reg sys_rst_pin;
    //wire [3:0] LED;
    
    design_1_wrapper DUT(
        .led_4bits_tri_o(), 
        .reset(),
        .rs232_uart_rxd(),
        .rs232_uart_txd(),
        .sys_diff_clock_clk_n(sys_clk_pin_n),
        .sys_diff_clock_clk_p(sys_clk_pin_p)
        );
    
    initial
          begin
          
            sys_clk_pin_p <= 1'b0;
            sys_clk_pin_n <= 1'b1;
              
            sys_rst_pin <= 1'b1;
            #1000 sys_rst_pin <= 1'b0;
            $display("INITIAL");
          end
//This sets our clock frequency          
    always #2.5 sys_clk_pin_p <= ~sys_clk_pin_p;
    always #2.5 sys_clk_pin_n <= ~sys_clk_pin_n;
endmodule

working_GPIO.pngworking_GPIO_waveform.png

Tags (1)
0 Kudos
4 Replies
Scholar dpaul24
Scholar
848 Views
Registered: ‎08-07-2014

Re: Simple behavioral Simulation does not match run

@simchask,

 

I really cannot tell how your design works in real hardware.

 

But the sim problem is clear.

You have NOT properly port-mapped your design! Only your differential clock is connected.

The uB reset needs to be properly connected.

--------------------------------------------------------------------------------------------------------
FPGA enthusiast!
All PMs will be ignored
--------------------------------------------------------------------------------------------------------
0 Kudos
Explorer
Explorer
836 Views
Registered: ‎11-23-2017

Re: Simple behavioral Simulation does not match run

Thank you, you are right, but I already noticed this.

Fixing that did not correct the problem of no output.

 

"I really cannot tell how your design works in real hardware."

I'm not sure if you are saying that you don't understand why it should work, or if you need more information.

I will post my SDK code as well:

#include "xparameters.h"
#include "xil_printf.h"
#include "xstatus.h"
#include "xil_cache.h"
#include "xgpio.h"
#include "gpio_header.h"
#define LED_CHANNEL 1

#if SIM
	#define LED_DELAY 1
#else
	#define LED_DELAY 10000000
#endif


int main () 
{
   Xil_ICacheEnable();
   Xil_DCacheEnable();


   XGpio GpioOutput;

   XGpio_Initialize(&GpioOutput, XPAR_AXI_GPIO_0_DEVICE_ID);
   XGpio_SetDataDirection(&GpioOutput, LED_CHANNEL, 0x0); //All 0 is all output

   {
     	  u32 Delay = 0;

	  xil_printf("starting\n\r");
      while (1) {
      		/* Set the LED to High */
      		XGpio_DiscreteWrite(&GpioOutput, LED_CHANNEL, 0x7);
      		xil_printf("flash\n\r");

      		/* Wait a small amount of time so the LED is visible */
      		for (Delay = 0; Delay < LED_DELAY; Delay++);

      		/* Clear the LED bit */
      		XGpio_DiscreteClear(&GpioOutput, LED_CHANNEL, 0x7);

      		/* Wait a small amount of time so the LED is visible */
      		for (Delay = 0; Delay < LED_DELAY; Delay++);

      	}
      
   }

   xil_printf("---Exiting main---\n\r");
   Xil_DCacheDisable();
   Xil_ICacheDisable();
   return 0;
}
0 Kudos
Explorer
Explorer
825 Views
Registered: ‎11-23-2017

Re: Simple behavioral Simulation does not match run

Looking at the ILMB_readdbus signal, I see only two values alternating between themselves.

If I guess correctly that this is the bus transferring commands to the microblaze from BRAM, then this seems off.

But I have no idea why.

0 Kudos
Explorer
Explorer
820 Views
Registered: ‎11-23-2017

Re: Simple behavioral Simulation does not match run

And the inst_addr signal from the microblaze is going from 0, to 4, to 8 and then repeats itself. So clearly the microblaze is not processing the program. But since I loaded the ELF file into the simulation sources, and it seems I am providing the necessary signals to the top level wrapper...I am clueless as to why.

0 Kudos