Comments (27)
This issue should be gone for the bare program mode.
For the data section address, the generated program is intended to be used for core level verification rater than SOC level, so it doesn't have any notion of memory space partition. I think this can be added by implement custom load/store instruction stream. For example, you can add label for each memory region, and use load/store to access these regions based on the region label + region address offset.
from riscv-dv.
We do core level verification , but the core includes internal memories, memory mapped interrupt controller we need to verify. L/S unit needs stimuli with mixed targets ...
from riscv-dv.
we also have a minimum MMU/MPU logic which defines memory characteristics based on address -
the LS transaction types differ depending it's I/O or just regular memory and we need to test these characteristics. The CPU RTL has various parameters, which define where these internal memories reside, so we have to tune code/data locations accordingly.
from riscv-dv.
Does the core support virtual address translation?
from riscv-dv.
from riscv-dv.
Right now the the program generate many data pages with label : data_page_{idx}. The default setting is 40 4KB data pages. One easy way to achieve your goal is to link these pages to the various regions in your memory map, so that existing load/store instruction can access different regions naturally. Another way to do it to name the data pages in a more meaningful way. Like
{
region_0_name : 4KB
region_1_name: 16KB
region_2_name: 512B
....
}
In your link script, you can link each region to corresponding address. This will complicate the page table setup though.
from riscv-dv.
from riscv-dv.
Let me give a try for the custom region setting. Use .org might be a better idea as it reduce the complexity of the link script.
{
data_section_0_name ,0x0001_0000, 4KB, instruction
data_section_1_name ,0x0002_0000, 16KB, data
data_section_2_name ,0x0003_F000, 16KB, data
....
}
from riscv-dv.
from riscv-dv.
The main complexity comes from setting up page tables for these scattered data pages. Especially if we want to inject error in the page table entry and do error recovery. I need to think about a clean way to do it. Right now the assumption is that all pages are equal size and continuously allocated in memory space. I think it makes sense to allow user customize the page location/size/access_type.
from riscv-dv.
from riscv-dv.
to my original complain - when you place code(exception handlers in this case) to data sections it confuses some tools
objdump for ex - it won't disassemble data sections. You can always place it in the code, by prepending it with .text - assembler collects all .text code from source to one .text section in obj file
you can have sections in the source file as layered cake:
.text
some code
.data
some data
.text
another code
.data
another data
at output all .text will be collected together and and all .data together too, forming one .text and one .data
from riscv-dv.
yes, this issue should have been fixed by this change.
68243cc#diff-f4e7ea3a932515dd6de98542c6c9754bR177
.text
user program
.data
user data
.text << this is missing
kernel program
.data
kernel data
from riscv-dv.
why it is section text.init and not just .text?
.macro init
.endm
.section .text.init <<<< ????
.globl _start
_start:
from riscv-dv.
I think this is inherited from riscv-tests, it's used by link script to link this section to beginning of the program. Maybe for your use case, you want it to be .text so that you can have your own init section?
from riscv-dv.
from riscv-dv.
With above changes, now each memory region as it's own section, You can link them to match the memory map. Memory region can be configured in the config class:
https://github.com/google/riscv-dv/blob/master/src/riscv_instr_gen_config.sv#L79
For the external memory, I'd suggest to specify a small range for simulation purpose, otherwise it might take a long time to randomly init the memory region.
[Nr] Name Type Address Offset
Size EntSize Flags Link Info Align
[ 0] NULL 0000000000000000 00000000
0000000000000000 0000000000000000 0 0 0
[ 1] .text PROGBITS 0000000080000000 00001000
000000000000a2ac 0000000000000000 AX 0 0 4096
[ 2] .tohost PROGBITS 000000008000b000 0000c000
0000000000000048 0000000000000000 WA 0 0 64
[ 3] .region_0 PROGBITS 000000008000c000 0000d000
0000000000001000 0000000000000000 WA 0 0 1
[ 4] .region_1 PROGBITS 000000008000d000 0000e000
0000000000004000 0000000000000000 WA 0 0 1
[ 5] .region_2 PROGBITS 0000000080011000 00012000
0000000000002000 0000000000000000 WA 0 0 1
[ 6] .region_3 PROGBITS 0000000080013000 00014000
0000000000000200 0000000000000000 WA 0 0 1
[ 7] .region_4 PROGBITS 0000000080013200 00014200
0000000000001000 0000000000000000 WA 0 0 1
[ 8] .user_stack PROGBITS 0000000080014200 00015200
0000000000009c40 0000000000000000 WA 0 0 64
[ 9] .kernel_stack PROGBITS 000000008001de40 0001ee40
from riscv-dv.
any idea, why am I getting region sections with zero data?
.pushsection .region_0,"aw",@progbits;
region_0:
.word 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000
.word 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000
.word 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000
from riscv-dv.
Because there are three data patterns for the data section
https://github.com/google/riscv-dv/blob/master/src/riscv_instr_pkg.sv#L616
typedef enum bit [1:0] {
RAND_DATA = 0,
ALL_ZERO,
INCR_VAL
} data_pattern_t;
from riscv-dv.
Is the data pattern randomly selected?
from riscv-dv.
One more thing
can you add _finish: label to the _exit, something like this:
_exit:
_finish:
j write_tohost
from riscv-dv.
one more idea:
print a sequence name before and after it is injected as a comment into the generated source
from riscv-dv.
Hi All
I was following this thread, and wondering if the best method is the tohost/fromhost idea.
I cannot recall whom, but I am pretty sure there has been talk regarding dropping the whole tohost/fromhost interface, in which case the ecall would seem the best approach.
If we were to simply follow the linux syscall style, we could test the syscall number, eg exit()
it would be trivial then to write a traphandler which interrogates the syscall number and does the appropriate action
@agrobman can I ask what is your execution environment which need to have the specific labels in the elf file to detect an END-OF-TEST scenario ?
Thx
Lee
from riscv-dv.
One more thing
can you add _finish: label to the _exit, something like this:
_exit:
_finish:
j write_tohost
Can you extend riscv_asm_program_gen::gen_program_end to add this? I don't want to add TB specific logic in the upstream code.
from riscv-dv.
I am closing this issue for now as I believe the original issue is solved. Please file a different issue for other feature requests. Thanks.
from riscv-dv.
one more idea:
print a sequence name before and after it is injected as a comment into the generated source
This is already implemented:
slt a4, a6, a3
lbu a6, 33(ra) #end riscv_hazard_instr_stream_5
la s9, region_4+319 #start riscv_hazard_instr_stream_11
lh t2, 59(s9)
from riscv-dv.
@eroom1966 , _finish label is used by our RTL verification environment .
we don't like ecall/syscall as end of test because we need to verify this instruction in randoms by itself .
Also some benchmarks use syscall to interact with host - we utilize this interface when run these benchmarks on the RTL model ..
from riscv-dv.
Related Issues (20)
- spike
- The spike simulation gets stuck in an endless loop HOT 2
- rv64gc failing spike due to exception trap_store_address_misaligned HOT 2
- riscv-dv breaks with riscv64-unknown-elf-gcc version tags 2023.04.18 and up HOT 5
- spike error:free(): invalid pointer: 0xxxxxxx
- Circular dependency within source files
- Error "SolveBeforeMustBeRand" while Elaborating with Dsim tool HOT 2
- Error: unrecognized opcode `csrr x5,0xf14', extension `zicsr' required HOT 8
- Error: illegal operands `sd s11,sub_4_stack_p(s5)'
- How to connect the test to my SV design file, and How do I get the feedback that the test has passed or failed? HOT 1
- Access Exception error while running spike for rv64imac instructions
- can't do riscv_csr_test HOT 1
- How to test Atomic Extension? HOT 3
- Guide lines to enable virtual address translation?
- Can't do S-mode test ( No delegation ) HOT 2
- Randomize CSR in main HOT 6
- Initial mret (from init_supervisor_mode) sends processor to untranslated address
- Request for detailed documentation HOT 1
- Can riscv-dv used with ucb rocket core/boom core? HOT 2
- Can I run this without install any external library?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from riscv-dv.