ayaz026
Newbie level 1
- Joined
- Mar 8, 2013
- Messages
- 1
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,296
I am using Spartan 6 FPGA SP605 Evaluation Kit and I am trying to use MicroBlaze soft processor core for implementing some DSP algorithms. Since I have never used MicroBlaze before, I first decided to measure the time required for performing some basic mathematical operations. For that I am using AXI timer peripheral and some of my findings are as below:
It took 23 cycles to multiply two integer type variables, 31 cycles to multiply two float type variables and 669 cycles to multiply two double type variables.
As mentioned before I am new to Micro Blaze, so I am not sure but what I am assuming is that, if the Processor Frequency is 100 MHZ then 23 cycles means that it takes (23/100M) = 0.23 μsec . Is it right?
And also I am not sure whether I am using the AXI timer peripheral in a correct manner, below are the details of the code
Xuint32 *TCSR0_reg, *TLR0_reg, *TCR0_reg;
TCSR0_reg = (Xuint32 *) XPAR_AXI_TIMER_0_BASEADDR;
TLR0_reg = ((Xuint32 *) XPAR_AXI_TIMER_0_BASEADDR) +0x01;
TCR0_reg = ((Xuint32 * ) XPAR_AXI_TIMER_0_BASEADDR) +0x02;
*(TLR0_reg) = 0x000000000; // timer initializing value
*(TCSR0_reg) = 0x00000030; // setting the load bit and ARHT (auto Reload/Hold timer) bit
*(TCSR0_reg) = 0x00000090; // enabling the timer
c= a * b;
*(TCSR0_reg) = 0x00000000; // disabling the timer
cyc = *(TCR0_reg); // reading the counter value
xil_printf("No. of clock cycles: %d\n\r",cyc); // Displaying through UART.
Is it ok? Does MicroBlaze take that much time or am I doing something wrong? Your help will be greatly appreciated. Thanks
It took 23 cycles to multiply two integer type variables, 31 cycles to multiply two float type variables and 669 cycles to multiply two double type variables.
As mentioned before I am new to Micro Blaze, so I am not sure but what I am assuming is that, if the Processor Frequency is 100 MHZ then 23 cycles means that it takes (23/100M) = 0.23 μsec . Is it right?
And also I am not sure whether I am using the AXI timer peripheral in a correct manner, below are the details of the code
Xuint32 *TCSR0_reg, *TLR0_reg, *TCR0_reg;
TCSR0_reg = (Xuint32 *) XPAR_AXI_TIMER_0_BASEADDR;
TLR0_reg = ((Xuint32 *) XPAR_AXI_TIMER_0_BASEADDR) +0x01;
TCR0_reg = ((Xuint32 * ) XPAR_AXI_TIMER_0_BASEADDR) +0x02;
*(TLR0_reg) = 0x000000000; // timer initializing value
*(TCSR0_reg) = 0x00000030; // setting the load bit and ARHT (auto Reload/Hold timer) bit
*(TCSR0_reg) = 0x00000090; // enabling the timer
c= a * b;
*(TCSR0_reg) = 0x00000000; // disabling the timer
cyc = *(TCR0_reg); // reading the counter value
xil_printf("No. of clock cycles: %d\n\r",cyc); // Displaying through UART.
Is it ok? Does MicroBlaze take that much time or am I doing something wrong? Your help will be greatly appreciated. Thanks