Giter Club home page Giter Club logo

msim's People

Contributors

ceresek avatar dependabot[bot] avatar hanyzpapu avatar martin-decky avatar vhotspur avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

msim's Issues

Interactive help does not give hint about devices

In interactive mode, msim should first print version and then suggest to use the 'help' command. When the 'help' command is used, it should also somehow give hint about existence of device commands.

Invalid status register shall not terminate simulation

If the status register is badly set (cp0_status_ksu == 3) MSIM may terminate on assertion in either convert_addr_kernel32 or convert_addr_kernel64 because of ASSERT(CPU_KERNEL_MODE(cpu)); (inside cpu.c, called from convert_addr).

It should probably be better to throw an exception (perhaps excCpU for Coprocessor Unusable) to allow the user debug the problem instead of aborting forcefully.

[Reproducible with Kalisto if one of the mfc0 $status is commented out in the context switch code.]

Allow randomization

MSIM is built as a deterministic simulator but for detecting race conditions in student assignments a bit of randomization might help.

This might include tiny changes to the counter registers so that timer interrupts are not coming always at the same time. Perhaps there are other sources (destinations) of randomness?

Tab completion broken

Tab completion does not work for second parameter.

Example session follows:

<msim> Alert: Configuration file "msim.conf" not found, skipping
<msim> Alert: MSIM 1.4.0
<msim> Alert: Entering interactive mode, type `help' for help.
[msim] add dcpu cpu
[msim] cpu <TAB>
bd     br     break  cp0d   goto   help   id     info ...
[msim] cpu b<TAB>
bd     br     break  
[msim] cpu bre<TAB>

Sub-command is not completed when it is the only option.

This is regression from 1.3.8.5 where this worked.

Add busy/ready bit to ddisk status

This bit shall signal the current state of the device (operation in progress) and could be used for simple implementations without a need for interrupt handling.

Wrong load in bats system tests

When running bats system tests with version Bats 1.2.0-dev all the tests are skipped.

Output:

$ bats tests/system/basic.bats 
bats: ~/msim/tests/system/common.bash.bash does not exist
bats: ~/msim/tests/system/common.bash.bash does not exist
bats: ~/msim/tests/system/common.bash.bash does not exist
bats: ~/msim/tests/system/common.bash.bash does not exist
bats: ~/msim/tests/system/common.bash.bash does not exist

5 tests, 0 failures, 5 not run

I think this problem is on line 3 of tests/system/basic.bats: load "common.bash".
It seems bats adds an extra .bash at the end of the filename.

Removing the .bash from the load fixes this problem for me.
(changing the line to load "common")

Calling `add ddisk disk' leads to SIGSEGV

echo "add ddisk disk" | ./msim

Terminates with

<msim> Alert: Configuration file "msim.conf" not found, skipping
<msim> Alert: MSIM 2.1.0
<msim> Alert: Entering interactive mode, type `help' for help.
[msim] add ddisk disk
<msim> Error: Missing parameter "register block address"
Segmentation fault      (core dumped)

rwm in dumpdev is wrongly aligned

dumpdev prints the following for a rwm device:

[  name  ] [  type  ] [ parameters...
mem        rwm        [Start    ] [Size      ] [Type]
00000000000            0 none

Rather it should be:

[  name  ] [  type  ] [ parameters...
mem        rwm        [Start    ] [Size      ] [Type]
                      00000000000            0 none

More debugging features

Copying this as-is from a TODO file (there is no context whether this refers to emulated memory, some part of some student assignments or MSIM's use of malloc):

add debug features
 - memory allocation
 - first and last block check
 - show all allocated memory blocks
 - check for unallocated memory at the end of the program or at the free function call
 - allocation information (function, file and the line number)

Way to prevent entering interactive mode when run from scripts

Code can use special instruction to enter interactive mode. When run from script, this usually creates issues (simulation may appear to hang when in fact it is just waiting for input). We should have a way to avoid this:

  • an extra command line switch that would make any attempt to enter interactive mode exit the simulator
  • checking whether we have interactive input using isatty
  • ... ?

Cannot compile in Alpine

Header file /usr/include/bits/limits.h in Alpine (tested in Docker on alpine:latest (b2aa39c304c2)) defines PAGESIZE.

This shadows the variable in device/cpu/riscv_rv32ima/cpu.c.

Fix is to rename this variable to lower case or something similar.

iregch configuration option ignored

This option should enable monitoring register changes in the assembler (during trace) but it does not do anything at the moment. As a matter of fact, the boolean variable associated with this flag is never read anywhere in the code.

Split drvcpu csrrd into more sections

The csrrd dump of RISC-V CPU is rather long and for debugging purposes in our courses most of the counters are not really needed (and only clutter the view).

It might make sense to split this into two commands and remove the performance counters from the basic dump.

Prevent having more devices with the same name

Following should raise an error and second device should not be added.

echo -e "add dr4kcpu one\nadd rwm one 0x0\ndumpdev" | ./msim

Instead, dumpdev prints the following:

[  name  ] [  type  ] [ parameters...
one        dr4kcpu    R4000
one        rwm        [Start    ] [Size      ] [Type]
00000000000            0 none

Maybe make printer device flush output immediately ?

The current implementation of the printer device (dprinter) flushes output inside printer_step4k, that is, only every 4096 simulator steps. Possibly, this was done to improve simulation speed, but as a result the print output is not visible when single stepping using the gdb interface. This is not a problem in the msim interface, because it uses the same output as the machine and flushes during command prompts.

(I can do the change, the reason for the ticket is I'm not sure there aren't other reasons for the delayed flush.)

Investigate proper handling when ERL bit is set

There seems to be a difference in handling translations between virtual and physical addresses in MSIM 1.3.8.5 and current HEAD when ERL bit is set.

Not yet sure which version behaves correctly, perhaps the old MSIM treats the condition for Cache error and ERL=1 for any exception.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.