tum-ei-eda / etiss

Extendable Translating Instruction Set Simulator
https://tum-ei-eda.github.io/etiss/
Other
29 stars 36 forks source link

Dynamic memory segment configuration for `simple_mem_system` #61

Closed wysiwyng closed 3 years ago

wysiwyng commented 3 years ago

This adds dynamic configuration to simple_mem_system, allowing specification of up to 99 memory segments via .ini files or command line parameters. The following options are used (XX being a number from 00 to 99, must be double digits):

If mode is omitted, RWX is assumed. If image is omitted, the segment will be initialized to zero. If either origin or length is missing, the segment will be ignored regardless of other present parameters.

Access modes R and W are checked within simple_mem_system and warnings are thrown when they are violated. Throwing exceptions or simply ignoring the violating call is an open discussion point, please provide ideas. The X access mode is provided for completeness's sake, it currently has no use within ETISS.

If vp.elf_file is present in the configuration, segments in the specified ELF file will be matched against configured segments. If an ELF segment matches a configured segment, this segment's image and access mode is then updated from the ELF file, overwriting values specified by mode or image options.

If a segment is present in the ELF-File which was not specified in the configuration, depending on the configuration option simple_mem_system.error_on_seg_mismatch two things can happen:

edit The configuration parameter arch.cpu determines the target CPU architecture used. If an ELF file is in use, ETISS tries to find a matching target architecture for the ELF file. If no built-in architecture matches, a fatal error is thrown and ETISS terminates. The target architecture can be overridden by specifying arch.cpu in a configuration file, in this case the target architecture is not read from the ELF file. This feature is useful for implementing architectures other than RISC-V or OpenRISC in ETISS without changing ETISS internals. /edit

edit 2 The start address of the target code is extracted from the ELF file, if one is present. Alternatively it can be forced by the configuration parameter vp.entry_point. /edit 2

Further changes:

JoGei commented 3 years ago

While you are refining the startup behavior. I've found that the architecture specific reset signaling is still fixed to 0x80 for all architectures. Since you introduced this setting we could also use it for the reset handling there: