litedram icon indicating copy to clipboard operation
litedram copied to clipboard

_CommandChooser logic selects unwanted commands

Open jedrzejboczar opened this issue 4 years ago • 0 comments

This has been initially mentioned in https://github.com/enjoy-digital/litedram/pull/173.

When writing tests for core.multiplexer._CommandChooser I've noticed that the request selection defined here:

https://github.com/enjoy-digital/litedram/blob/b06e946d09807f3ab9b2e72f9c599851ab8221b4/litedram/core/multiplexer.py#L42-L47

seems to work wrong in some cases, e.g.

  • with want_cmds=1 and want_activates=0, ACTIVATE commands will still be considered, because they have both is_write=0 and is_read=0 (and we have both want_reads=0 and want_writes=0), so read and write are true, and thus (read & write) is true, even though command is false
  • all want_* are 0, then both read and write are 1 for requests with request.is_cmd == 1 so the command is considered valid
  • with want_writes=1 and want_reads=1, both write and read commands will be considered invalid (but we never want both at the same time, so it is probably a minor problem)

This behaviour can be observed in the following tests from test_command_chooser.py that fail:

  • test_selects_cmds_without_act
  • test_selects_nothing
  • test_selects_nothing_when_want_activates_only
  • test_selects_writes_and_reads

jedrzejboczar avatar Apr 01 '20 14:04 jedrzejboczar