% SMSFM v2.2 logic (AHDL) Tim Worthington 2015 % SUBDESIGN smsfm2 ( d0 : BIDIR; d1 : BIDIR; d2 : OUTPUT; a0 : INPUT; a1 : INPUT; a2 : INPUT; a6 : INPUT; a7 : INPUT; /rd : INPUT; /wr : INPUT; /reset : INPUT; /ym_reset : OUTPUT; /ym_cs : OUTPUT; /iorq : INPUT; /kbsel : INPUT; -- unused input, must go somewhere killg : OUTPUT; /fm_en : INPUT; /jpfm_en : INPUT; mode : INPUT; -- region switch mode /psg_mute : OUTPUT; /psg_mute_disable : INPUT; /iorq_out : OUTPUT; ) VARIABLE reg[1..0] : DFF; fm_addr : NODE; d_tri[2..0] : TRI; killg_tri : TRI; kbsel_int : NODE; fmsel_int : NODE; BEGIN --FM fmsel_int = !/fm_en or (!/jpfm_en and mode); kbsel_int = !/iorq and a6 and a7; fm_addr = !a2 and kbsel_int and fmsel_int; d0 = d_tri[0].out; d1 = d_tri[1].out; d2 = d_tri[2].out; d_tri[0].in = reg[0].q; d_tri[2..1].in = gnd; d_tri[2..0].oe = !/rd and fm_addr; -- the value of reg[] is set to default to 0 in the assignment editor --reg[].clrn = /reset; reg[].clk = a1 and !/wr and /rd and fm_addr; reg[0].d = d0; reg[1].d = d1; /ym_reset = /reset; !/ym_cs = !a1 and !/wr and /rd and fm_addr; !/psg_mute = !reg[1].q and reg[0].q and /psg_mute_disable; --JP killg_tri.oe = !a7 and !a6 and a0 and !/wr and !/iorq and !/jpfm_en; killg_tri.in = vcc; killg = killg_tri.out; /iorq_out = /iorq or (!/jpfm_en and !a6 and !a7 and a0); END;