Merge pull request #131 from retroSoC/dev

Dev
This commit is contained in:
Yuchi Miao authored and GitHub committed 2025-11-18 11:00:38 +08:00
commit f4c2c736b9
14 files changed
+490 -83

No files matched your search

+2 -1
View File
@@ -51,4 +51,5 @@ user_design
*.tar*
ff16
lvgl-*
mpw
mpw
coremark-main
+160
View File
@@ -0,0 +1,160 @@
/*
Copyright 2018 Embedded Microprocessor Benchmark Consortium (EEMBC)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Original Author: Shay Gal-on
*/
#include "coremark.h"
#include "core_portme.h"
#include <stdint.h>
#include <tinytim.h>
#if VALIDATION_RUN
volatile ee_s32 seed1_volatile = 0x3415;
volatile ee_s32 seed2_volatile = 0x3415;
volatile ee_s32 seed3_volatile = 0x66;
#endif
#if PERFORMANCE_RUN
volatile ee_s32 seed1_volatile = 0x0;
volatile ee_s32 seed2_volatile = 0x0;
volatile ee_s32 seed3_volatile = 0x66;
#endif
#if PROFILE_RUN
volatile ee_s32 seed1_volatile = 0x8;
volatile ee_s32 seed2_volatile = 0x8;
volatile ee_s32 seed3_volatile = 0x8;
#endif
volatile ee_s32 seed4_volatile = ITERATIONS;
volatile ee_s32 seed5_volatile = 0;
/* Porting : Timing functions
How to capture time and convert to seconds must be ported to whatever is
supported by the platform. e.g. Read value from on board RTC, read value from
cpu clock cycles performance counter etc. Sample implementation for standard
time.h and windows.h definitions included.
*/
CORETIMETYPE
barebones_clock()
{
return tim1_get_value();
// #error // "You must implement a method to measure time in barebones_clock()! This function should return current time.\n"
}
/* Define : TIMER_RES_DIVIDER
Divider to trade off timer resolution and total time that can be
measured.
Use lower values to increase resolution, but make sure that overflow
does not occur. If there are issues with the return value overflowing,
increase this value.
*/
#define CLOCKS_PER_SEC 72000000
#define GETMYTIME(_t) (*_t = barebones_clock())
#define MYTIMEDIFF(fin, ini) ((fin) - (ini))
#define TIMER_RES_DIVIDER 1
#define SAMPLE_TIME_IMPLEMENTATION 1
#define EE_TICKS_PER_SEC (CLOCKS_PER_SEC / TIMER_RES_DIVIDER)
/** Define Host specific (POSIX), or target specific global time variables. */
static CORETIMETYPE start_time_val, stop_time_val;
/* Function : start_time
This function will be called right before starting the timed portion of
the benchmark.
Implementation may be capturing a system timer (as implemented in the
example code) or zeroing some system parameters - e.g. setting the cpu clocks
cycles to 0.
*/
void
start_time(void)
{
GETMYTIME(&start_time_val);
}
/* Function : stop_time
This function will be called right after ending the timed portion of the
benchmark.
Implementation may be capturing a system timer (as implemented in the
example code) or other system parameters - e.g. reading the current value of
cpu cycles counter.
*/
void
stop_time(void)
{
GETMYTIME(&stop_time_val);
}
/* Function : get_time
Return an abstract "ticks" number that signifies time on the system.
Actual value returned may be cpu cycles, milliseconds or any other
value, as long as it can be converted to seconds by <time_in_secs>. This
methodology is taken to accommodate any hardware or simulated platform. The
sample implementation returns millisecs by default, and the resolution is
controlled by <TIMER_RES_DIVIDER>
*/
CORE_TICKS
get_time(void)
{
CORE_TICKS elapsed
= (CORE_TICKS)(MYTIMEDIFF(stop_time_val, start_time_val));
return elapsed;
}
/* Function : time_in_secs
Convert the value returned by get_time to seconds.
The <secs_ret> type is used to accommodate systems with no support for
floating point. Default implementation implemented by the EE_TICKS_PER_SEC
macro above.
*/
secs_ret
time_in_secs(CORE_TICKS ticks)
{
secs_ret retval = ((secs_ret)ticks) / (secs_ret)EE_TICKS_PER_SEC;
return retval;
}
ee_u32 default_num_contexts = 1;
/* Function : portable_init
Target specific initialization code
Test for some common mistakes.
*/
void
portable_init(core_portable *p, int *argc, char *argv[])
{
// #error "Call board initialization routines in portable init (if needed), in particular initialize UART!\n"
(void)argc; // prevent unused warning
(void)argv; // prevent unused warning
tim1_init();
if (sizeof(ee_ptr_int) != sizeof(ee_u8 *))
{
ee_printf(
"ERROR! Please define ee_ptr_int to a type that holds a "
"pointer!\n");
}
if (sizeof(ee_u32) != 4)
{
ee_printf("ERROR! Please define ee_u32 to a 32b unsigned type!\n");
}
p->portable_id = 1;
}
/* Function : portable_fini
Target specific final code
*/
void
portable_fini(core_portable *p)
{
p->portable_id = 0;
}
+217
View File
@@ -0,0 +1,217 @@
/*
Copyright 2018 Embedded Microprocessor Benchmark Consortium (EEMBC)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Original Author: Shay Gal-on
*/
/* Topic : Description
This file contains configuration constants required to execute on
different platforms
*/
#ifndef CORE_PORTME_H
#define CORE_PORTME_H
#include <stddef.h>
#define ITERATIONS 36
#define STANDALONE
#define VALIDATION_RUN 1
int core_main(void);
// #define PERFORMANCE_RUN 1
/************************/
/* Data types and settings */
/************************/
/* Configuration : HAS_FLOAT
Define to 1 if the platform supports floating point.
*/
#ifndef HAS_FLOAT
#define HAS_FLOAT 0
#endif
/* Configuration : HAS_TIME_H
Define to 1 if platform has the time.h header file,
and implementation of functions thereof.
*/
#ifndef HAS_TIME_H
#define HAS_TIME_H 0
#endif
/* Configuration : USE_CLOCK
Define to 1 if platform has the time.h header file,
and implementation of functions thereof.
*/
#ifndef USE_CLOCK
#define USE_CLOCK 0
#endif
/* Configuration : HAS_STDIO
Define to 1 if the platform has stdio.h.
*/
#ifndef HAS_STDIO
#define HAS_STDIO 0
#endif
/* Configuration : HAS_PRINTF
Define to 1 if the platform has stdio.h and implements the printf
function.
*/
#ifndef HAS_PRINTF
#define HAS_PRINTF 1
#endif
/* Definitions : COMPILER_VERSION, COMPILER_FLAGS, MEM_LOCATION
Initialize these strings per platform
*/
#ifndef COMPILER_VERSION
#ifdef __GNUC__
#define COMPILER_VERSION "GCC"__VERSION__
#else
#define COMPILER_VERSION "Please put compiler version here (e.g. gcc 4.1)"
#endif
#endif
#ifndef COMPILER_FLAGS
#define COMPILER_FLAGS \
"-o3" /* "Please put compiler flags here (e.g. -o3)" */
#endif
#ifndef MEM_LOCATION
#define MEM_LOCATION "STACK"
#endif
/* Data Types :
To avoid compiler issues, define the data types that need ot be used for
8b, 16b and 32b in <core_portme.h>.
*Imprtant* :
ee_ptr_int needs to be the data type used to hold pointers, otherwise
coremark may fail!!!
*/
typedef signed short ee_s16;
typedef unsigned short ee_u16;
typedef signed int ee_s32;
typedef double ee_f32;
typedef unsigned char ee_u8;
typedef unsigned int ee_u32;
typedef ee_u32 ee_ptr_int;
typedef size_t ee_size_t;
#define NULL ((void *)0)
/* align_mem :
This macro is used to align an offset to point to a 32b value. It is
used in the Matrix algorithm to initialize the input memory blocks.
*/
#define align_mem(x) (void *)(4 + (((ee_ptr_int)(x)-1) & ~3))
/* Configuration : CORE_TICKS
Define type of return from the timing functions.
*/
#define CORETIMETYPE ee_u32
typedef ee_u32 CORE_TICKS;
/* Configuration : SEED_METHOD
Defines method to get seed values that cannot be computed at compile
time.
Valid values :
SEED_ARG - from command line.
SEED_FUNC - from a system function.
SEED_VOLATILE - from volatile variables.
*/
#ifndef SEED_METHOD
#define SEED_METHOD SEED_VOLATILE
#endif
/* Configuration : MEM_METHOD
Defines method to get a block of memry.
Valid values :
MEM_MALLOC - for platforms that implement malloc and have malloc.h.
MEM_STATIC - to use a static memory array.
MEM_STACK - to allocate the data block on the stack (NYI).
*/
#ifndef MEM_METHOD
#define MEM_METHOD MEM_STACK
#endif
/* Configuration : MULTITHREAD
Define for parallel execution
Valid values :
1 - only one context (default).
N>1 - will execute N copies in parallel.
Note :
If this flag is defined to more then 1, an implementation for launching
parallel contexts must be defined.
Two sample implementations are provided. Use <USE_PTHREAD> or <USE_FORK>
to enable them.
It is valid to have a different implementation of <core_start_parallel>
and <core_end_parallel> in <core_portme.c>, to fit a particular architecture.
*/
#ifndef MULTITHREAD
#define MULTITHREAD 1
#define USE_PTHREAD 0
#define USE_FORK 0
#define USE_SOCKET 0
#endif
/* Configuration : MAIN_HAS_NOARGC
Needed if platform does not support getting arguments to main.
Valid values :
0 - argc/argv to main is supported
1 - argc/argv to main is not supported
Note :
This flag only matters if MULTITHREAD has been defined to a value
greater then 1.
*/
#ifndef MAIN_HAS_NOARGC
#define MAIN_HAS_NOARGC 1
#endif
/* Configuration : MAIN_HAS_NORETURN
Needed if platform does not support returning a value from main.
Valid values :
0 - main returns an int, and return value will be 0.
1 - platform does not support returning a value from main
*/
#ifndef MAIN_HAS_NORETURN
#define MAIN_HAS_NORETURN 0
#endif
/* Variable : default_num_contexts
Not used for this simple port, must contain the value 1.
*/
extern ee_u32 default_num_contexts;
typedef struct CORE_PORTABLE_S
{
ee_u8 portable_id;
} core_portable;
/* target specific init/fini */
void portable_init(core_portable *p, int *argc, char *argv[]);
void portable_fini(core_portable *p);
#if !defined(PROFILE_RUN) && !defined(PERFORMANCE_RUN) \
&& !defined(VALIDATION_RUN)
#if (TOTAL_DATA_SIZE == 1200)
#define PROFILE_RUN 1
#elif (TOTAL_DATA_SIZE == 2000)
#define PERFORMANCE_RUN 1
#else
#define VALIDATION_RUN 1
#endif
#endif
int ee_printf(const char *fmt, ...);
#endif /* CORE_PORTME_H */
+15 -6
View File
@@ -4,11 +4,20 @@
void userip_main(int argc, char **argv) {
// user custom area
(void)argc;
// user custom area HACK:
(void)argv;
printf("[USER IP] archinfo test\n");
printf("[ARCHINFO SYS] %x\n", reg_user_ip_reg0);
printf("[ARCHINFO IDL] %x\n", reg_user_ip_reg1);
printf("[ARCHINFO IDH] %x\n", reg_user_ip_reg2);
if(argc == 0) {
printf("[FIXED IP] archinfo test\n");
printf("[ARCHINFO SYS] %x\n", reg_user_ip_reg0);
printf("[ARCHINFO IDL] %x\n", reg_user_ip_reg1);
printf("[ARCHINFO IDH] %x\n", reg_user_ip_reg2);
} else if(argc == 1) {
reg_user_ip_reg1 = 2;
printf("div val: %x\n", reg_user_ip_reg1);
reg_user_ip_reg2 = 0;
for(int i = 0; i < 6; ++i) printf("tim val: %d\n", reg_user_ip_reg2);
} else if(argc == 2) {
printf("[reg0] %x\n", reg_user_ip_reg0);
}
}
+4 -4
View File
@@ -54,12 +54,12 @@
#define reg_uart0_data (*(volatile uint32_t*)0x10001004)
// tim0
#define reg_tim0_cfg (*(volatile uint32_t*)0x10002000)
#define reg_tim0_val (*(volatile uint32_t*)0x10002004)
#define reg_tim0_dat (*(volatile uint32_t*)0x10002008)
#define reg_tim0_rld (*(volatile uint32_t*)0x10002004)
#define reg_tim0_val (*(volatile uint32_t*)0x10002008)
// tim1
#define reg_tim1_cfg (*(volatile uint32_t*)0x10003000)
#define reg_tim1_val (*(volatile uint32_t*)0x10003004)
#define reg_tim1_dat (*(volatile uint32_t*)0x10003008)
#define reg_tim1_rld (*(volatile uint32_t*)0x10003004)
#define reg_tim1_val (*(volatile uint32_t*)0x10003008)
// psram
#define reg_psram_wait (*(volatile uint32_t*)0x10004000)
#define reg_psram_chd (*(volatile uint32_t*)0x10004004)
+2
View File
@@ -2,5 +2,7 @@
#define TINYTIM_H__
void delay_ms(uint32_t val);
void tim1_init();
uint32_t tim1_get_value();
void ip_tim_test(int argc, char **argv);
#endif
+2 -3
View File
@@ -2,8 +2,7 @@
void main() {
uart0_init(CPU_FREQ, UART_BPS);
printf("hello test\n");
while(1);
tinybooter();
i2c0_init((uint8_t)(CPU_FREQ / 2 - 1));
qspi_dev_init();
@@ -28,8 +27,8 @@ void main() {
tinysh_register("pcf", "pcf8563b test", (uint8_t)1, pcf8563b_test);
tinysh_register("donut", "dount test", (uint8_t)0, donut_test);
tinysh_batch_run();
// video_show(0x60000000);
tinysh_launch();
// video_show(0x60000000);
// ip_norflash_test();
// ip_lcd_test(0, NULL);
+1 -1
View File
@@ -277,7 +277,7 @@ void ip_lcd_test(int argc, char **argv) {
// // lcd_wr_dc_cmd(0x01); // software reset
uint32_t pref_cnt = 0;
lcd_frame(1, pref_cnt);
for (int i = 0; i < 3; ++i) {
for (int i = 0; i < 12; ++i) {
lcd_fill_bg(0, 0, LCD_W, LCD_H, 0);
lcd_fill_bg(0, 0, LCD_W, LCD_H, 1);
lcd_fill_bg(0, 0, LCD_W, LCD_H, 2);
+10 -20
View File
@@ -98,34 +98,28 @@ void ip_psram_selftest(uint32_t addr, uint32_t range) {
int test_num = 8192;
printf("[range: %dB] 4-bytes wr/rd test\n", 4 * test_num);
for (int i = 0; i < test_num; ++i)
{
for (int i = 0; i < test_num; ++i) {
*(base_word + i) = (uint32_t)(0x12345678 + i);
}
for (int i = 0; i < test_num; ++i)
{
for (int i = 0; i < test_num; ++i) {
if (*(base_word + i) != ((uint32_t)(0x12345678 + i)))
printf("[error] rd: %x org: %x\n", *(base_word + i), (uint32_t)(0x12345678 + i));
}
printf("[range: %dB] 2-bytes wr/rd test\n", 2 * test_num);
for (int i = 0; i < test_num; ++i)
{
for (int i = 0; i < test_num; ++i) {
*(base_hword + i) = (uint16_t)(0x5678 + i);
}
for (int i = 0; i < test_num; ++i)
{
for (int i = 0; i < test_num; ++i) {
if (*(base_hword + i) != ((uint16_t)(0x5678 + i)))
printf("[error] rd: %x org: %x\n", *(base_hword + i), (uint16_t)(0x5678 + i));
}
printf("[range: %dB] 1-bytes wr/rd test\n", test_num);
for (int i = 0; i < test_num; ++i)
{
for (int i = 0; i < test_num; ++i) {
*(base_byte + i) = (uint8_t)(0x78 + i);
}
for (int i = 0; i < test_num; ++i)
{
for (int i = 0; i < test_num; ++i) {
if (*(base_byte + i) != ((uint8_t)(0x78 + i)))
printf("[error] rd: %x org: %x\n", *(base_byte + i), (uint8_t)(0x78 + i));
}
@@ -135,19 +129,15 @@ void ip_psram_selftest(uint32_t addr, uint32_t range) {
uint32_t state;
printf("[range: %dMB] stride increments wr/rd test\n", range / 1024 / 1024);
for (int i = 1; i <= cyc_count; i++)
{
for (int i = 1; i <= cyc_count; i++) {
state = i;
for (uint32_t word = 0; word < range / sizeof(int); word += stride)
{
for (uint32_t word = 0; word < range / sizeof(int); word += stride) {
*(base_word + word) = xorshift32(&state);
}
state = i;
for (uint32_t word = 0; word < range / sizeof(int); word += stride)
{
if (*(base_word + word) != xorshift32(&state))
{
for (uint32_t word = 0; word < range / sizeof(int); word += stride) {
if (*(base_word + word) != xorshift32(&state)) {
printf("***FAILED BYTE*** at %x\n", 4 * word);
while (1)
;
+9 -2
View File
@@ -8,6 +8,7 @@
#include <tinytim.h>
#include <ff.h>
#include <video_player.h>
#include <core_portme.h>
#ifdef IP_MDD
#include <userip.h>
#endif
@@ -554,6 +555,12 @@ void tinysh_app_image_cmd(int argc, char **argv) {
}
void tinysh_app_coremark_cmd(int argc, char **argv) {
(void)argc;
(void)argv;
core_main();
}
#ifdef IP_MDD
void tinysh_app_userip_cmd(int argc, char **argv) {
if(argc != 1 && argc != 2) {
@@ -569,7 +576,7 @@ void tinysh_app_userip_cmd(int argc, char **argv) {
if(user_id >= 0 && user_id <= 255) {
printf("switch to user ip id to [%03d...]\n", user_id);
reg_sysctrl_ipsel = (uint8_t)user_id;
userip_main(0, NULL);
userip_main(user_id, NULL); // HACK:
} else {
printf("error use id: %d\n", user_id);
return;
@@ -607,11 +614,11 @@ void tinysh_launch() {
tinysh_register("df", "report file system disk space usage", (uint8_t)0, tinysh_fat32_df_cmd);
tinysh_register("fatlabel", "set/get filesystem label or volume ID", (uint8_t)0, tinysh_fat32_fatlabel_cmd);
tinysh_register("image", "image viewer", (uint8_t)0, tinysh_app_image_cmd);
tinysh_register("coremark", "coremark test", (uint8_t)0, tinysh_app_coremark_cmd);
// video -i info
// audio -i info
// arduboy
// nes
// coremark
#ifdef IP_MDD
tinysh_register("userip", "run user ip program", (uint8_t)0, tinysh_app_userip_cmd);
#endif
+25 -11
View File
@@ -2,32 +2,46 @@
#include <tinyprintf.h>
#include <tinytim.h>
// 0x0011 = 0b0000000000010001
void delay_ms(uint32_t val) {
reg_tim0_dat = (uint32_t)(CPU_FREQ * val * 1000 - 1);
reg_tim0_val = (uint32_t)(CPU_FREQ * val * 1000 - 1);
reg_tim0_cfg = (uint32_t)0b0011; // irq disable, count down, oneshot mode, timer enable
while (reg_tim0_dat);
while (reg_tim0_val);
reg_tim0_cfg = (uint32_t)0b0000;
}
void tim1_init() {
reg_tim1_cfg = (uint32_t)0b0000;
reg_tim1_rld = (uint32_t)0xFFFFFFFF;
reg_tim1_val = (uint32_t)0;
// printf("tim1 cfg: %x\n", reg_tim1_cfg);
// printf("tim1 rld: %x\n", reg_tim1_rld);
// printf("tim1 val: %x\n", reg_tim1_val);
reg_tim1_cfg = (uint32_t)0b0111;
// printf("tim1 cfg: %d\n", reg_tim1_cfg);
}
uint32_t tim1_get_value() {
return reg_tim1_val;
}
void ip_tim_test(int argc, char **argv) {
(void) argc;
(void) argv;
printf("[NATV IP] counter timer test\n");
printf("[TIM0 VALUE] %x\n", reg_tim0_val);
printf("[TIM0 CONFIG] %x\n", reg_tim0_cfg);
printf("[TIM1 VALUE] %x\n", reg_tim1_val);
printf("[TIM1 CONFIG] %x\n", reg_tim1_cfg);
printf("[tim0 reload] %x\n", reg_tim0_rld);
printf("[tim0 config] %x\n", reg_tim0_cfg);
printf("[tim1 reload] %x\n", reg_tim1_rld);
printf("[tim1 config] %x\n", reg_tim1_cfg);
reg_tim0_val = (uint32_t)0xffffffff;
reg_tim0_rld = (uint32_t)0xffffffff;
reg_tim0_cfg = (uint32_t)0x0001; // irq disable, count down, continuous mode, timer enable
reg_tim1_val = (uint32_t)0x00ffffff;
reg_tim1_rld = (uint32_t)0x00ffffff;
reg_tim1_cfg = (uint32_t)0x0101; // irq disable, count up, continuous mode, timer enable
for (int i = 0; i < 10; ++i) {
printf("[TIM0 DATA] %x\n", reg_tim0_dat);
printf("[TIM1 DATA] %x\n", reg_tim1_dat);
printf("[tim0 val] %x\n", reg_tim0_val);
printf("[tim1 val] %x\n", reg_tim1_val);
}
}
+30 -30
View File
@@ -35,8 +35,8 @@
// verilog_format: off
`define SIMP_TIMER_CFG 8'h00
`define SIMP_TIMER_VAL 8'h04
`define SIMP_TIMER_DAT 8'h08
`define SIMP_TIMER_RLD 8'h04
`define SIMP_TIMER_VAL 8'h08
// verilog_format: on
`endif
@@ -58,9 +58,9 @@ module simple_timer (
logic s_tim_cfg_en;
logic [3:0] s_tim_cfg_d, s_tim_cfg_q;
logic s_tim_val_en;
logic s_tim_rld_en;
logic [31:0] s_tim_rld_d, s_tim_rld_q;
logic [31:0] s_tim_val_d, s_tim_val_q;
logic [31:0] s_tim_dat_d, s_tim_dat_q;
// enable (start) the counter/timer
// set s_bit_oneshot (1) mode or continuous (0) mode
// count up (1) or down (0)
@@ -93,56 +93,56 @@ module simple_timer (
);
assign s_tim_val_en = s_nmi_wr_hdshk && nmi.addr[7:0] == `SIMP_TIMER_VAL;
assign s_tim_rld_en = s_nmi_wr_hdshk && nmi.addr[7:0] == `SIMP_TIMER_RLD;
always_comb begin
s_tim_val_d = s_tim_val_q;
if (nmi.wstrb[0]) s_tim_val_d[7:0] = nmi.wdata[7:0];
if (nmi.wstrb[1]) s_tim_val_d[15:8] = nmi.wdata[15:8];
if (nmi.wstrb[2]) s_tim_val_d[23:16] = nmi.wdata[23:16];
if (nmi.wstrb[3]) s_tim_val_d[31:24] = nmi.wdata[31:24];
s_tim_rld_d = s_tim_rld_q;
if (nmi.wstrb[0]) s_tim_rld_d[7:0] = nmi.wdata[7:0];
if (nmi.wstrb[1]) s_tim_rld_d[15:8] = nmi.wdata[15:8];
if (nmi.wstrb[2]) s_tim_rld_d[23:16] = nmi.wdata[23:16];
if (nmi.wstrb[3]) s_tim_rld_d[31:24] = nmi.wdata[31:24];
end
dffer #(32) u_tim_val_dffer (
dffer #(32) u_tim_rld_dffer (
clk_i,
rst_n_i,
s_tim_val_en,
s_tim_val_d,
s_tim_val_q
s_tim_rld_en,
s_tim_rld_d,
s_tim_rld_q
);
always_comb begin
s_tim_dat_d = s_tim_dat_q;
s_tim_val_d = s_tim_val_q;
s_irq_d = s_irq_q;
if (s_nmi_wr_hdshk && nmi.addr[7:0] == `SIMP_TIMER_DAT) begin
if (nmi.wstrb[0]) s_tim_dat_d[7:0] = nmi.wdata[7:0];
if (nmi.wstrb[1]) s_tim_dat_d[15:8] = nmi.wdata[15:8];
if (nmi.wstrb[2]) s_tim_dat_d[23:16] = nmi.wdata[23:16];
if (nmi.wstrb[3]) s_tim_dat_d[31:24] = nmi.wdata[31:24];
if (s_nmi_wr_hdshk && nmi.addr[7:0] == `SIMP_TIMER_VAL) begin
if (nmi.wstrb[0]) s_tim_val_d[7:0] = nmi.wdata[7:0];
if (nmi.wstrb[1]) s_tim_val_d[15:8] = nmi.wdata[15:8];
if (nmi.wstrb[2]) s_tim_val_d[23:16] = nmi.wdata[23:16];
if (nmi.wstrb[3]) s_tim_val_d[31:24] = nmi.wdata[31:24];
end else if (s_bit_en) begin
if (s_bit_updown) begin
if (s_tim_dat_q == s_tim_val_q) begin
if (~s_bit_oneshot) s_tim_dat_d = '0;
if (s_tim_val_q == s_tim_rld_q) begin
if (~s_bit_oneshot) s_tim_val_d = '0;
s_irq_d = s_bit_irq_en;
end else begin
s_tim_dat_d = s_tim_dat_q + 1'b1;
s_tim_val_d = s_tim_val_q + 1'b1;
s_irq_d = '0;
end
end else begin
if (s_tim_dat_q == '0) begin
if (~s_bit_oneshot) s_tim_dat_d = s_tim_val_q;
if (s_tim_val_q == '0) begin
if (~s_bit_oneshot) s_tim_val_d = s_tim_rld_q;
s_irq_d = s_bit_irq_en;
end else begin
s_tim_dat_d = s_tim_dat_q - 1'b1;
s_tim_val_d = s_tim_val_q - 1'b1;
s_irq_d = '0;
end
end
end
end
dffr #(32) u_tim_dat_dffr (
dffr #(32) u_tim_val_dffr (
clk_i,
rst_n_i,
s_tim_dat_d,
s_tim_dat_q
s_tim_val_d,
s_tim_val_q
);
dffr #(1) u_irq_dffr (
@@ -166,8 +166,8 @@ module simple_timer (
s_nmi_rdata_d = s_nmi_rdata_q;
unique case (nmi.addr[7:0])
`SIMP_TIMER_CFG: s_nmi_rdata_d = {28'd0, s_tim_cfg_q};
`SIMP_TIMER_RLD: s_nmi_rdata_d = s_tim_rld_q;
`SIMP_TIMER_VAL: s_nmi_rdata_d = s_tim_val_q;
`SIMP_TIMER_DAT: s_nmi_rdata_d = s_tim_dat_q;
default: s_nmi_rdata_d = s_nmi_rdata_q;
endcase
end
+10 -2
View File
@@ -7,7 +7,7 @@ OBJC = $(CROSS)objcopy
DUMP = $(CROSS)objdump
CFLAGS := -Wall -Wextra \
-Wl,-Bstatic,-T,flash_$(EXEC_TYPE).lds,--strip-debug \
-Wl,-Bstatic,-T,flash_$(EXEC_TYPE).lds,--strip-debug -O3 \
-ffreestanding \
-nostdlib
@@ -74,11 +74,19 @@ APP_PATH := $(ROOT_PATH)/app/src/at24cxx.c \
$(ROOT_PATH)/app/src/fatfs/ff16/source/diskio.c \
$(ROOT_PATH)/app/src/fatfs/ff16/source/ff.c \
$(ROOT_PATH)/app/src/fatfs/ff16/source/ffsystem.c \
$(ROOT_PATH)/app/src/fatfs/ff16/source/ffunicode.c
$(ROOT_PATH)/app/src/fatfs/ff16/source/ffunicode.c \
$(ROOT_PATH)/app/src/coremark/coremark-main/core_main.c \
$(ROOT_PATH)/app/src/coremark/coremark-main/core_list_join.c \
$(ROOT_PATH)/app/src/coremark/coremark-main/core_matrix.c \
$(ROOT_PATH)/app/src/coremark/coremark-main/core_state.c \
$(ROOT_PATH)/app/src/coremark/coremark-main/core_util.c \
$(ROOT_PATH)/app/src/coremark/core_portme.c
INC_PATH := -I$(ROOT_PATH)/crt/inc \
-I$(ROOT_PATH)/app/inc \
-I$(ROOT_PATH)/app/src/fatfs/ff16/source \
-I$(ROOT_PATH)/app/src/coremark/coremark-main \
-I$(ROOT_PATH)/app/src/coremark \
-I$(ROOT_PATH)/app/src/lvgl/lvgl-9.4.0/src \
-I$(ROOT_PATH)/app/src/lvgl/lvgl-9.4.0/src/core \
-I$(ROOT_PATH)/app/src/lvgl/lvgl-9.4.0/src/display \
+3 -3
View File
@@ -295,10 +295,10 @@ module retrosoc_tb;
$fsdbDumpfile("retrosoc_tb.fsdb");
$fsdbDumpvars(0);
$fsdbDumpMDA();
// #398844962;
#398844962;
// #867652;
// #1667652;
#327820116;
// #327820116;
// #327179489;
// #836901000;
// #468320000;
@@ -339,7 +339,7 @@ module retrosoc_tb;
end
initial begin
r_core_sel = 5'd1;
r_core_sel = 5'd0;
if ($test$plusargs("pll_en")) r_pll_en = 1'b1;
else r_pll_en = 1'b0;