Giter VIP home page Giter VIP logo

fx68k's People

Contributors

ijor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fx68k's Issues

Enumerated value used on its own in if condition

SRMC_RES is defined as:

fx68k/fx68k.sv

Line 2305 in 0602ee4

enum int unsigned { SRESET = 0, SIDLE, S0, S2, S4, S6, SRMC_RES} busPhase, next;

So it must have a value of 6 and at least 3 bits. Then it is used in this if condition:

fx68k/fx68k.sv

Line 2397 in 0602ee4

else if( Clks.enPhi2 & bcComplete & ~SRMC_RES)

What is the meaning of that? Clks.enPhi2 and bcComplete are single bits, the SRMC_RES is, well, 32 bit as an integer with a value of 6. What is the meaning of having it in the expression?

Possible issue with UNLK

Toni Wilen's cputest flags a possible issue with UNLK instruction.

CPUlvl=0, Mask=00ffffff Code=007c0000 SP=007ffbc0 ISP=00800000
 Low: 00000000-00008000 High: 00ff8000-01000000
Test: 00780000-00800000 Safe: ffffffff-ffffffff
UNLK.L:
data/68000/UNLK.L/0000.dat. 0...

8:	4e5f    unlk     sp
A7: expected f01f007c but got e993f600
Registers before:
D0: 00000010 D1: 00000000 D2: ffffffff D3: ffffff00
D4: ffff0000 D5: 80008080 D6: 7fff7fff D7: aaaaaaaa
A0: 00000000 A1: 00000080 A2: 00008000 A3: 00007fff
A4: fffffffe A5: ffffff00 A6: 007bff00 A7:*007ffbc0
SR: 0000   PC: 007c0000 ISP: 007fff80
T1=0 T0=0 S=0 M=0 X=0 N=0 Z=0 V=0 C=0
000   PC: 007c0000 ISP: 007fff80
T1=0 T0=0 S=0 M=0 X=0 N*0 Z!0 V*0 C=0

Registers after:
SR:*000e   PC: 007c0002 ISP: 007fff80
T1=0 T0=0 S=0 M=0 X=0 N*1 Z!1 V*1 C=0
OK: No exception generated
Registers after:
SR:*000e   PC: 007c0002 ISP: 007fff80
T1=0 T0=0 S=0 M=0 X=0 N*1 Z!1 V*1 C=0
OK: No exception generated
Registers after:
A4: fffffffe A5: ffffff00 A6: 007bff00 A7:*e993f600
SR: 0000   PC: 007c0002 ISP: 007fff80
T1=0 T0=0 S=0 M=0 X=0 N=0 Z=0 V=0 C=0
OK: No exception generated ```

Usage of synthesis on / off

With respect to the following comments:

	// Simulation problem
	// Sometimes (like in MULM1) DBH is not set. AU is used in these cases just as a 6 bits counter testing if bits 5-0 are zero.
	// But when adding something like 32'hXXXX0000, the simulator (incorrectly) will set *all the 32 bits* of the result as X.

If you look at IEEE1800-2017, you will see the following, in section 11.4.3 Arithmetic operators :

For the arithmetic operators, if any operand bit value is the unknown value x or the high-impedance value z,
then the entire result value shall be x.

That means that although in your case you naturally expect the low 16 output bits to not be affected by Xs on the upper 16 bits, this is not what the SystemVerilog spec says, so this is not a simulator bug, but more like a SystemVerilog gotcha.

Other than that, I would avoid the use of `synthesis translate_off altogether, and replace them with an `ifdef ... `endif:

  1. They are not defined by the language spec
  2. They do not nest.
  3. (My personal opinion) They are ugly, because we should never carry information in comments that cannot be ignored. (but it's OK to put optimization hints, for example, because you can safely ignore it).

Not compatible with iVerilog

Icarus Verilog cannot be used for simulation with fx68k, even when using the -g2005-sv option. As Icarus Verilog is the main FOSS tool for verilog simulation, it would be good to be able to use it.

HALT input signal.

Will support for the HALT input signal and RESET/HALT signals combination be added?

Warnings by GoWin IDE

I am running fx68k on a Tang Nano 20k. It worked out of the box and at least boots a MiSTery core to the desktop. Still there are a few warnings which might be worth looking at:

WARN  (EX2420) : Latch inferred for net 'ccrMask[4]'; We do not recommend the use of latches in FPGA designs, as they may lead to timing problems("fx68k/fx68kAlu.sv":830)
WARN  (EX3101) : 'ccrMask' inside always_comb block does not represent combinational logic("fx68k/fx68kAlu.sv":830)

This warning only refers to bit 4. But from similar cases i've learned that this may also apply to lower bits which aren't reported. This is related to the default case in line 805 in fx68kAlu being commented out:

			row[14]:	ccrMask = KNZ00;
			row[15]:	ccrMask = 5'b0;			// TAS/Scc, not used in col 3
			// default:	ccrMask = CUNUSED;
			endcase		

Why is this commented? Enabling line 805 will at least still boot to the TOS desktop. So it doesn't break the CPU completely.

A similar warning is

WARN  (EX2420) : Latch inferred for net 'stype[1]'; We do not recommend the use of latches in FPGA designs, as they may lead to timing problems("fx68k/fx68kAlu.sv":742)
WARN  (EX3101) : 'stype' inside always_comb block does not represent combinational logic("fx68k/fx68kAlu.sv":742)

Why is stype a reg? Isn't it all supposed to be just combinatorics? And instead of

				reg [1:0] stype;
				
				if( size11)					// memory shift/rotate
					stype = ird[ 10:9];
				else						// register shift/rotate
					stype = ird[ 4:3];

				case( {stype, ird[8]})

use something like

case( { (size11?ird[ 10:9]:ird[ 4:3]), ird[8]})

This change also doesn't seem to affect the very basic functionality and the resulting CPU also boots to TOS desktop.

Hidden bug

I have been trying to catch a bug in a new arcade core I'm working on. In one stage, the game enters a loop and stays there for 20 minutes or more until it eventually gets out, and the gameplay continues.

I am starting to think that this could be a bug in the fx68k softcore. I don't have any replacement I can just swap and test, and I am not sure what the best way to debug this is.

Maybe you have some reference emulator that you can simulate side by side with your core in a system Verilog environment. If that's the case, please share it and I will try to reproduce the problem in simulation so we can catch the discrepancy.

Is BGACKn behavior correct?

More a question than a verified bug...

I inadvertently left BGACKn input unassigned (0) (BRn=1'b1) and the processor wouldn't start out of reset because the busArbiter dmaPhase transitioned to dBA and spun there.

Is that how a real 68000 would behave, given there was no prior bus request or bus granted?

How to request the bus?

I am trying to implement DMA in a system with fx68k (CAPCOM SYSTEM 1). I have read the MC68000 manual about the signals, and I have tried to replicate them as follows:

imagen

The CPU starts by signalling data available to the DMA controller (signal obj_dma_ok at the bottom). Then the DMA controller requests the bus: busreq. This gets translated into signal BRn going down, soon after BGn goes down too and BGACKn goes down and stays down during the whole DMA transaction.

I am not sure whether the fx68k core is expecting this signals to occur at specific times or right at the clock edges, or whether anytime is ok. Once I implement this scheme, some games continue working normally (like 1941) but others like Mercs or Street Fighter 2 just fail. Nemo shows a "1111 EXCEPTION" message on screen. Ghouls'n Ghosts fails the OBJ memory check.

I would like to understand better what are the assumptions made on the fx68k core about bus arbitrion and what signals are expected for the handshaking. Could you comment, please?

Thank you

subq instruction bug

The subq instruction in the code:

image

is not executed correctly by fx68k. Look at the following signal dump:

image

The CPU has to read the value in memory address $FFF310, decreased it by one and write it back. The value read is $8401, but the value written back is $0000 instead of $8400.

This is how the same instructions look like through the J68_CPU module, to serve as a reference:

image

You can see how the ram_data bus is decreased by one in this case.

Could you please look into this bug?

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.