KimJorgensen/easyflash

Just a couple of questions for somebody else who has dived into this code.

Closed this issue · 3 comments

I'm trying to get it working in a test bench. However the reset line doesn't fire. I set the n_reset_io to '0' then wait a few Phi2 phase, then set it to 'H' however the internal resets never goes hi and hence the cart doesn't really kick off. And I keep going in circles looking at why it doesn't go hi.

Were you able to get it working in a ISE testbench?

I assume that you have looked at the code in reset_generator.vhdl
Sorry, I have never attempted to get it working in a test bench so this could be stupid, but shouldn't n_reset_io be set to 'Z' instead of 'H'?

Looked at it some more today.
I would think that 'Z' is not what is needed. This says the Commodore is not driving this anymore, and doesn't care what it is. Which is not the same as Commodore has lifted this and is pulling it to 1. In that the value needs to hit 1. If I just Z it won't, it just means that the its not being driven by the Commodore. That being said it seems 'U' overrides a 'H' while forcing it to '1' causes an 'X' case.

This might be a "it relies upon there being enough internal delay through gates so the value input can be read before the circuit will respond and drive to 0' kind of events." in a Post Fit simulation it behaviors differently but mostly just stays at 'U' while in a Behavioral it either locks to '0' or 'x' depending upon I set the reset line in the test bench. There are lots of other X and U as well though.

For those that come after :

The issues are, the counter is not initialized to a default value, while all states are valid, so on hardware "it works" but in a simulation it will 'XXX' as its technically invalid. So setting the counter to an explicit default value of say "111" is needed.
Then you need set the n_reset_in line to 'H' to simulate the Commodore lifting the reset. However the VHDL doesn't handle a 'H' case. If you are using ISE which only goes up to VHDL 200X and doesn't support the ?= operator you need to modify the source to explicitly check for 'H'

-- another 8 cycles later:
if n_reset_in = '1' or n_reset_in ='H' then
    ignore_reset <= '0';
end if;

The cart will then boot as expected.

Also not the schematic the buttons inputs are inverted from normal. So you need to set them to '0' not '1' as you would expect otherwise the cart will think they are pressed.