ika-musume / IKAOPM

A BSD-licensed YM2151 cycle-accurate Verilog core based on the die shot from siliconpr0n
BSD 2-Clause "Simplified" License
65 stars 5 forks source link

IKAOPM

YM2151 Verilog core for FPGA implementation. It was reverse-engineered with only Yamaha's datasheet and the die shot from siliconpr0n. This core does not reference any existing hard/soft core. © 2023 Sehyeon Kim(Raki)

header image

Copyrighted work. Permitted to be used as the header image. Painted by SEONGSU.

Features

Module instantiation

The steps below show how to instantiate the IKAOPM module in Verilog:

  1. Download this repository or add it as a submodule to your project.
  2. You can use the Verilog snippet below to instantiate the module.
//Verilog module instantiation example
IKAOPM #(
    .FULLY_SYNCHRONOUS          (1                          ),
    .FAST_RESET                 (0                          ),
    .USE_BRAM                   (0                          )
) u_ikaopm_0 (
    .i_EMUCLK                   (                           ),

    .i_phiM_PCEN_n              (                           ),
    //.i_phi1_PCEN_n              (                           ), //compilation option
    //.i_phi1_NCEN_n              (                           ),

    .i_IC_n                     (                           ),

    .o_phi1                     (                           ),

    //.o_EMU_BUSY_FLAG            (                           ), //compilation option
    .i_CS_n                     (                           ),
    .i_RD_n                     (                           ),
    .i_WR_n                     (                           ),
    .i_A0                       (                           ),

    .i_D                        (                           ),
    .o_D                        (                           ),
    .o_D_OE                     (                           ),

    .o_CT1                      (                           ),
    .o_CT2                      (                           ),

    .o_IRQ_n                    (                           ),

    .o_SH1                      (                           ),
    .o_SH2                      (                           ),

    .o_SO                       (                           ),

    .o_EMU_R_SAMPLE             (                           ),
    .o_EMU_R_EX                 (                           ),
    .o_EMU_R                    (                           ),

    .o_EMU_L_SAMPLE             (                           ),
    .o_EMU_L_EX                 (                           ),
    .o_EMU_L                    (                           )
);
  1. Attach your signals to the port. The direction and the polarity of the signals are described in the port names. The section below explains what the signals mean.

CT2 and CT1 port description

Pin number 8 and 9 of the YM2151 are used as GPO ports. They are referred to as CT2 and CT1 respectively, but unfortunately Yamaha doesn't seem to have taken the naming of them seriously. There are datasheets that have CT2 and CT1 reversed in order. Looking at the die shot, bit 7 of the 0x1B register is connected to the pin 8, and bit 6 is connected to the pin 9. I assume that in this core, bit 7 of the 0x1B register = CT2 = pin 8, bit 6 of the same register = CT1 = pin 9. In addition, the pin that the internal data lfo_clk flows out of when test mode is turned on is CT1 = pin 9.

Compilation options

FPGA resource usage