Skip to content

Commit

Permalink
Add RVTEST enviorment configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
piotro888 committed Oct 5, 2023
1 parent c4acb21 commit dd1b762
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 0 deletions.
40 changes: 40 additions & 0 deletions test/external/rvtest_env/link.ld
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
OUTPUT_ARCH( "riscv" )
ENTRY(rvtest_entry_point)

MEMORY
{
text (rxai!w) : ORIGIN = 0x00000000, LENGTH = 2M
data (wxa!ri) : ORIGIN = 0x10000000, LENGTH = 1M
mmio (wa!rxi) : ORIGIN = 0x80000000, LENGTH = 1K
signature (wa!rxi) : ORIGIN = 0x81000000, LENGTH = 16K

}

PHDRS
{
text PT_LOAD;
data_init PT_LOAD;
data PT_NULL;
mmio PT_LOAD;
signature PT_LOAD;
}

SECTIONS
{
.text.init : { *(.text.init) } >text AT>text :text
. = ALIGN(0x1000);
.text : { *(.text) } >text AT>text :text

. = ALIGN(0x1000);
.data : { *(.data) } >data AT>data :data_init
.data.string : { *(.data.string)} >data AT>data :data_init
.bss : { *(.bss) } >data AT>data :data

. = ALIGN(0x1000);
.hostmmio : { *(.hostmmio) } >mmio AT>mmio :mmio

. = ALIGN(0x1000);
.signature : { *(.signature) } >signature AT>signature :signature

_end = .;
}
64 changes: 64 additions & 0 deletions test/external/rvtest_env/model_test.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#ifndef _COMPLIANCE_MODEL_H
#define _COMPLIANCE_MODEL_H
#define RVMODEL_DATA_SECTION \
.pushsection .hostmmio,"aw",@progbits; \
.align 8; .global tohost; tohost: .dword 0; \
.align 8; .global fromhost; fromhost: .dword 0; \
.popsection; \
.align 8; .global begin_regstate; begin_regstate: \
.word 128; \
.align 8; .global end_regstate; end_regstate: \
.word 4;

//RV_COMPLIANCE_HALT
#define RVMODEL_HALT \
li x1, 1; \
write_tohost: \
sw x1, tohost, t5; \
j write_tohost;

#define RVMODEL_BOOT

//RV_COMPLIANCE_DATA_BEGIN
#define RVMODEL_DATA_BEGIN \
RVMODEL_DATA_SECTION \
.pushsection .signature,"aw",@progbits; \
.align 2; \
.global begin_signature; begin_signature:

//RV_COMPLIANCE_DATA_END
#define RVMODEL_DATA_END \
.global end_signature; end_signature: \
.popsection;

//RVTEST_IO_INIT
#define RVMODEL_IO_INIT
//RVTEST_IO_WRITE_STR
#define RVMODEL_IO_WRITE_STR(_R, _STR)
//RVTEST_IO_CHECK
#define RVMODEL_IO_CHECK()
//RVTEST_IO_ASSERT_GPR_EQ
#define RVMODEL_IO_ASSERT_GPR_EQ(_S, _R, _I)
//RVTEST_IO_ASSERT_SFPR_EQ
#define RVMODEL_IO_ASSERT_SFPR_EQ(_F, _R, _I)
//RVTEST_IO_ASSERT_DFPR_EQ
#define RVMODEL_IO_ASSERT_DFPR_EQ(_D, _R, _I)

// empty macros to supress warnings
#define RVMODEL_SET_MSW_INT
#define RVMODEL_CLEAR_MSW_INT
#define RVMODEL_CLEAR_MTIMER_INT
#define RVMODEL_CLEAR_MEXT_INT
#define RVMODEL_CLR_MSW_INT
#define RVMODEL_CLR_MTIMER_INT
#define RVMODEL_CLR_MEXT_INT
#define RVMODEL_SET_SSW_INT
#define RVMODEL_CLR_SSW_INT
#define RVMODEL_CLR_STIMER_INT
#define RVMODEL_CLR_SEXT_INT
#define RVMODEL_SET_VSW_INT
#define RVMODEL_CLR_VSW_INT
#define RVMODEL_CLR_VTIMER_INT
#define RVMODEL_CLR_VEXT_INT

#endif // _COMPLIANCE_MODEL_H

0 comments on commit dd1b762

Please sign in to comment.