Avoid DSP in matmul master path
This commit is contained in:
@@ -5,7 +5,6 @@
|
||||
*/
|
||||
|
||||
#include <dma.h>
|
||||
#include <confreg_time.h>
|
||||
|
||||
/* ─── UART 16550 direct access (bypasses slow printf/picolibc) ──────── */
|
||||
#define UART_THR (*(volatile unsigned char *)0xbf000000)
|
||||
@@ -29,24 +28,6 @@ static void uart_puthex(unsigned int val) {
|
||||
}
|
||||
}
|
||||
|
||||
static void uart_putdec(unsigned int val) {
|
||||
char buf[10];
|
||||
int i = 0;
|
||||
|
||||
if (val == 0) {
|
||||
uart_tx('0');
|
||||
return;
|
||||
}
|
||||
|
||||
while (val != 0) {
|
||||
buf[i++] = (char)('0' + (val % 10));
|
||||
val /= 10;
|
||||
}
|
||||
while (i > 0) {
|
||||
uart_tx((unsigned char)buf[--i]);
|
||||
}
|
||||
}
|
||||
|
||||
/* ─── Configurable group count (default 5000) ──────────────────────── */
|
||||
#ifndef MATMUL_GROUP_NUM
|
||||
#define MATMUL_GROUP_NUM 5000
|
||||
@@ -54,9 +35,6 @@ static void uart_putdec(unsigned int val) {
|
||||
|
||||
/* ─── BSP globals ─────────────────────────────────────────────────── */
|
||||
unsigned long UART_BASE = 0xbf000000;
|
||||
unsigned long CONFREG_TIMER_BASE = 0xbf20f100;
|
||||
unsigned long CONFREG_CLOCKS_PER_SEC = 50000000L;
|
||||
unsigned long CORE_CLOCKS_PER_SEC = 33000000L;
|
||||
|
||||
/* ─── Memory layout ────────────────────────────────────────────────── */
|
||||
#define EXTRAM_BASE_PHYS 0x1c400000
|
||||
@@ -107,11 +85,9 @@ int main(void)
|
||||
volatile unsigned int *mat_crc = (volatile unsigned int *)MATMUL_CRC;
|
||||
|
||||
unsigned int crc;
|
||||
unsigned int cycle_start, cycle_end, cycles, time_us;
|
||||
|
||||
/* ── Start marker (must be first output) ──────────────────── */
|
||||
uart_puts("MATMUL_START\r\n");
|
||||
cycle_start = get_clock_count();
|
||||
|
||||
*(volatile unsigned int *)MATMUL_CRC = 0;
|
||||
*mat_status = STATUS_DMA_DONE | STATUS_DONE | STATUS_ERROR;
|
||||
@@ -123,19 +99,12 @@ int main(void)
|
||||
*mat_ctrl = CTRL_DMA_START;
|
||||
while (!(*mat_status & STATUS_DMA_DONE)) {}
|
||||
*mat_status = STATUS_DMA_DONE;
|
||||
cycle_end = get_clock_count();
|
||||
cycles = cycle_end - cycle_start;
|
||||
time_us = cycles / (CORE_CLOCKS_PER_SEC / 1000000UL);
|
||||
|
||||
/* ── Read hardware CRC32 ──────────────────────────────────── */
|
||||
crc = *mat_crc;
|
||||
|
||||
uart_puts("MATMUL_CRC32=");
|
||||
uart_puthex(crc);
|
||||
uart_puts("\r\nMATMUL_CYCLES=");
|
||||
uart_putdec(cycles);
|
||||
uart_puts("\r\nMATMUL_TIME_US=");
|
||||
uart_putdec(time_us);
|
||||
uart_puts("\r\nMATMUL_DONE\r\n");
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user