ES5506: optimize more
This commit is contained in:
parent
6a9c2d6c77
commit
c0190b81cb
|
@ -23,7 +23,7 @@ void es5504_core::tick()
|
||||||
// /CAS low, E low: fetch sample
|
// /CAS low, E low: fetch sample
|
||||||
if (!m_e.current_edge())
|
if (!m_e.current_edge())
|
||||||
{
|
{
|
||||||
m_voice[m_voice_cycle].fetch(m_voice_cycle, m_voice_fetch);
|
m_voice[m_voice_cycle].fetch(m_voice_fetch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ void es5504_core::tick()
|
||||||
if (m_e.falling_edge()) // Voice memory
|
if (m_e.falling_edge()) // Voice memory
|
||||||
{
|
{
|
||||||
m_host_intf.clear_host_access();
|
m_host_intf.clear_host_access();
|
||||||
m_voice[m_voice_cycle].fetch(m_voice_cycle, m_voice_fetch);
|
m_voice[m_voice_cycle].fetch(m_voice_fetch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (m_e.current_edge()) // Host interface
|
if (m_e.current_edge()) // Host interface
|
||||||
|
@ -81,7 +81,7 @@ void es5504_core::tick_perf()
|
||||||
m_intf.e_pin(false);
|
m_intf.e_pin(false);
|
||||||
m_host_intf.clear_host_access();
|
m_host_intf.clear_host_access();
|
||||||
m_host_intf.clear_strobe();
|
m_host_intf.clear_strobe();
|
||||||
m_voice[m_voice_cycle].fetch(m_voice_cycle, m_voice_fetch);
|
m_voice[m_voice_cycle].fetch(m_voice_fetch);
|
||||||
voice_tick();
|
voice_tick();
|
||||||
// rising edge
|
// rising edge
|
||||||
m_e.edge().set(true);
|
m_e.edge().set(true);
|
||||||
|
@ -92,7 +92,7 @@ void es5504_core::tick_perf()
|
||||||
m_intf.e_pin(false);
|
m_intf.e_pin(false);
|
||||||
m_host_intf.clear_host_access();
|
m_host_intf.clear_host_access();
|
||||||
m_host_intf.clear_strobe();
|
m_host_intf.clear_strobe();
|
||||||
m_voice[m_voice_cycle].fetch(m_voice_cycle, m_voice_fetch);
|
m_voice[m_voice_cycle].fetch(m_voice_fetch);
|
||||||
voice_tick();
|
voice_tick();
|
||||||
// rising edge
|
// rising edge
|
||||||
m_e.edge().set(true);
|
m_e.edge().set(true);
|
||||||
|
@ -126,11 +126,11 @@ void es5504_core::voice_tick()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void es5504_core::voice_t::fetch(u8 voice, u8 cycle)
|
void es5504_core::voice_t::fetch(u8 cycle)
|
||||||
{
|
{
|
||||||
m_alu.set_sample(
|
m_alu.set_sample(
|
||||||
cycle,
|
cycle,
|
||||||
m_host.m_intf.read_sample(voice,
|
m_host.m_intf.read_sample(
|
||||||
bitfield(m_cr.ca(), 0, 3),
|
bitfield(m_cr.ca(), 0, 3),
|
||||||
bitfield(m_alu.get_accum_integer() + cycle, 0, m_alu.m_integer)));
|
bitfield(m_alu.get_accum_integer() + cycle, 0, m_alu.m_integer)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ class es5504_core : public es550x_shared_core
|
||||||
|
|
||||||
// internal state
|
// internal state
|
||||||
virtual void reset() override;
|
virtual void reset() override;
|
||||||
virtual void fetch(u8 voice, u8 cycle) override;
|
virtual void fetch(u8 cycle) override;
|
||||||
virtual void tick(u8 voice) override;
|
virtual void tick(u8 voice) override;
|
||||||
|
|
||||||
// setters
|
// setters
|
||||||
|
|
|
@ -97,7 +97,7 @@ void es5505_core::tick()
|
||||||
// /CAS low, E low: fetch sample
|
// /CAS low, E low: fetch sample
|
||||||
if (!m_e.current_edge())
|
if (!m_e.current_edge())
|
||||||
{
|
{
|
||||||
m_voice[m_voice_cycle].fetch(m_voice_cycle, m_voice_fetch);
|
m_voice[m_voice_cycle].fetch(m_voice_fetch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ void es5505_core::tick()
|
||||||
else if (m_e.falling_edge()) // Voice memory
|
else if (m_e.falling_edge()) // Voice memory
|
||||||
{
|
{
|
||||||
m_host_intf.clear_host_access();
|
m_host_intf.clear_host_access();
|
||||||
m_voice[m_voice_cycle].fetch(m_voice_cycle, m_voice_fetch);
|
m_voice[m_voice_cycle].fetch(m_voice_fetch);
|
||||||
}
|
}
|
||||||
if (m_e.current_edge()) // Host interface
|
if (m_e.current_edge()) // Host interface
|
||||||
{
|
{
|
||||||
|
@ -159,7 +159,7 @@ void es5505_core::tick_perf()
|
||||||
m_intf.e_pin(false);
|
m_intf.e_pin(false);
|
||||||
m_host_intf.clear_host_access();
|
m_host_intf.clear_host_access();
|
||||||
m_host_intf.clear_strobe();
|
m_host_intf.clear_strobe();
|
||||||
m_voice[m_voice_cycle].fetch(m_voice_cycle, m_voice_fetch);
|
m_voice[m_voice_cycle].fetch(m_voice_fetch);
|
||||||
voice_tick();
|
voice_tick();
|
||||||
// rising edge
|
// rising edge
|
||||||
m_e.edge().set(true);
|
m_e.edge().set(true);
|
||||||
|
@ -170,7 +170,7 @@ void es5505_core::tick_perf()
|
||||||
m_intf.e_pin(false);
|
m_intf.e_pin(false);
|
||||||
m_host_intf.clear_host_access();
|
m_host_intf.clear_host_access();
|
||||||
m_host_intf.clear_strobe();
|
m_host_intf.clear_strobe();
|
||||||
m_voice[m_voice_cycle].fetch(m_voice_cycle, m_voice_fetch);
|
m_voice[m_voice_cycle].fetch(m_voice_fetch);
|
||||||
voice_tick();
|
voice_tick();
|
||||||
// rising edge
|
// rising edge
|
||||||
m_e.edge().set(true);
|
m_e.edge().set(true);
|
||||||
|
@ -211,12 +211,12 @@ void es5505_core::voice_tick()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void es5505_core::voice_t::fetch(u8 voice, u8 cycle)
|
void es5505_core::voice_t::fetch(u8 cycle)
|
||||||
{
|
{
|
||||||
m_alu.set_sample(
|
m_alu.set_sample(
|
||||||
cycle,
|
cycle,
|
||||||
m_host.m_intf.read_sample(voice,
|
m_host.m_intf.read_sample(
|
||||||
bitfield(m_cr.bs(), 0),
|
bitfield(m_cr.m_bs, 0),
|
||||||
bitfield(m_alu.get_accum_integer() + cycle, 0, m_alu.m_integer)));
|
bitfield(m_alu.get_accum_integer() + cycle, 0, m_alu.m_integer)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -112,7 +112,7 @@ class es5505_core : public es550x_shared_core
|
||||||
|
|
||||||
// internal state
|
// internal state
|
||||||
virtual void reset() override;
|
virtual void reset() override;
|
||||||
virtual void fetch(u8 voice, u8 cycle) override;
|
virtual void fetch(u8 cycle) override;
|
||||||
virtual void tick(u8 voice) override;
|
virtual void tick(u8 voice) override;
|
||||||
|
|
||||||
// setters
|
// setters
|
||||||
|
|
|
@ -134,7 +134,7 @@ void es5506_core::tick()
|
||||||
// sample
|
// sample
|
||||||
if (m_mode.master())
|
if (m_mode.master())
|
||||||
{
|
{
|
||||||
m_voice[m_voice_cycle].fetch(m_voice_cycle, m_voice_fetch);
|
m_voice[m_voice_cycle].fetch(m_voice_fetch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (m_e.current_edge())
|
else if (m_e.current_edge())
|
||||||
|
@ -142,7 +142,7 @@ void es5506_core::tick()
|
||||||
// dual OTTO slave mode, /CAS low, E high: fetch sample
|
// dual OTTO slave mode, /CAS low, E high: fetch sample
|
||||||
if (m_mode.dual() && (!m_mode.master()))
|
if (m_mode.dual() && (!m_mode.master()))
|
||||||
{ // Dual OTTO, slave mode
|
{ // Dual OTTO, slave mode
|
||||||
m_voice[m_voice_cycle].fetch(m_voice_cycle, m_voice_fetch);
|
m_voice[m_voice_cycle].fetch(m_voice_fetch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -228,8 +228,7 @@ void es5506_core::tick_perf()
|
||||||
m_host_intf.clear_host_access();
|
m_host_intf.clear_host_access();
|
||||||
m_host_intf.clear_strobe();
|
m_host_intf.clear_strobe();
|
||||||
}
|
}
|
||||||
m_voice[m_voice_cycle].fetch(m_voice_cycle, 0);
|
m_voice[m_voice_cycle].fetch(0);
|
||||||
m_voice[m_voice_cycle].fetch(m_voice_cycle, 1);
|
|
||||||
voice_tick();
|
voice_tick();
|
||||||
if (bounce) {
|
if (bounce) {
|
||||||
// rising edge
|
// rising edge
|
||||||
|
@ -250,19 +249,19 @@ void es5506_core::voice_tick()
|
||||||
{
|
{
|
||||||
m_voice_end = true;
|
m_voice_end = true;
|
||||||
m_voice_cycle = 0;
|
m_voice_cycle = 0;
|
||||||
for (output_t &elem : m_ch)
|
for (int i=0; i<6; i++)
|
||||||
{
|
{
|
||||||
elem.reset();
|
m_ch[i].reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (voice_t &elem : m_voice)
|
for (int i=0; i<32; i++)
|
||||||
{
|
{
|
||||||
const u8 ca = elem.cr().ca()&7;
|
const u8 ca = m_voice[i].cr().ca()&7;
|
||||||
if (ca < 6)
|
if (ca < 6)
|
||||||
{
|
{
|
||||||
m_ch[ca] += elem.ch();
|
m_ch[ca] += m_voice[i].ch();
|
||||||
}
|
}
|
||||||
elem.ch().reset();
|
m_voice[i].ch().reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -271,16 +270,24 @@ void es5506_core::voice_tick()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void es5506_core::voice_t::fetch(u8 voice, u8 cycle)
|
void es5506_core::voice_t::fetch(u8 cycle)
|
||||||
{
|
{
|
||||||
m_alu.set_sample(
|
m_alu.set_sample(
|
||||||
cycle,
|
0,
|
||||||
m_host.m_intf.read_sample(voice,
|
m_host.m_intf.read_sample(m_cr.m_bs,
|
||||||
m_cr.bs(),
|
(m_alu.get_accum_integer())&((1<<m_alu.m_integer)-1)));
|
||||||
(m_alu.get_accum_integer() + cycle)&((1<<m_alu.m_integer)-1)));
|
|
||||||
if (m_cr.cmpd())
|
if (m_cr.cmpd())
|
||||||
{ // Decompress (Upper 8 bit is used for compressed format)
|
{ // Decompress (Upper 8 bit is used for compressed format)
|
||||||
m_alu.set_sample(cycle, decompress((m_alu.sample(cycle)>>8)&255));
|
m_alu.set_sample(0, decompress((m_alu.sample(0)>>8)&255));
|
||||||
|
}
|
||||||
|
|
||||||
|
m_alu.set_sample(
|
||||||
|
1,
|
||||||
|
m_host.m_intf.read_sample(m_cr.m_bs,
|
||||||
|
(m_alu.get_accum_integer() + 1)&((1<<m_alu.m_integer)-1)));
|
||||||
|
if (m_cr.cmpd())
|
||||||
|
{ // Decompress (Upper 8 bit is used for compressed format)
|
||||||
|
m_alu.set_sample(1, decompress((m_alu.sample(1)>>8)&255));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -152,7 +152,7 @@ class es5506_core : public es550x_shared_core
|
||||||
|
|
||||||
// internal state
|
// internal state
|
||||||
virtual void reset() override;
|
virtual void reset() override;
|
||||||
virtual void fetch(u8 voice, u8 cycle) override;
|
virtual void fetch(u8 cycle) override;
|
||||||
virtual void tick(u8 voice) override;
|
virtual void tick(u8 voice) override;
|
||||||
|
|
||||||
// Setters
|
// Setters
|
||||||
|
|
|
@ -41,7 +41,7 @@ class es550x_intf : public vgsound_emu_core
|
||||||
|
|
||||||
virtual void adc_w(u16 data) {} // ADC output
|
virtual void adc_w(u16 data) {} // ADC output
|
||||||
|
|
||||||
virtual s16 read_sample(u8 voice, u8 bank, u32 address) { return 0; }
|
virtual s16 read_sample(u8 bank, u32 address) { return 0; }
|
||||||
};
|
};
|
||||||
|
|
||||||
// Shared functions for ES5504/ES5505/ES5506
|
// Shared functions for ES5504/ES5505/ES5506
|
||||||
|
@ -137,7 +137,7 @@ class es550x_shared_core : public vgsound_emu_core
|
||||||
|
|
||||||
inline bool cmpd() { return m_cmpd; }
|
inline bool cmpd() { return m_cmpd; }
|
||||||
|
|
||||||
protected:
|
public:
|
||||||
// Channel assign -
|
// Channel assign -
|
||||||
// 4 bit (16 channel or Bank) for ES5504
|
// 4 bit (16 channel or Bank) for ES5504
|
||||||
// 2 bit (4 stereo channels) for ES5505
|
// 2 bit (4 stereo channels) for ES5505
|
||||||
|
@ -456,7 +456,7 @@ class es550x_shared_core : public vgsound_emu_core
|
||||||
|
|
||||||
// internal state
|
// internal state
|
||||||
virtual void reset();
|
virtual void reset();
|
||||||
virtual void fetch(u8 voice, u8 cycle) = 0;
|
virtual void fetch(u8 cycle) = 0;
|
||||||
virtual void tick(u8 voice) = 0;
|
virtual void tick(u8 voice) = 0;
|
||||||
|
|
||||||
void irq_update(es550x_intf &intf, es550x_irq_t &irqv)
|
void irq_update(es550x_intf &intf, es550x_irq_t &irqv)
|
||||||
|
|
|
@ -101,14 +101,14 @@ void es550x_shared_core::es550x_voice_t::es550x_alu_t::loop_exec()
|
||||||
s32 es550x_shared_core::es550x_voice_t::es550x_alu_t::interpolation()
|
s32 es550x_shared_core::es550x_voice_t::es550x_alu_t::interpolation()
|
||||||
{
|
{
|
||||||
// SF = S1 + ACCfr * (S2 - S1)
|
// SF = S1 + ACCfr * (S2 - S1)
|
||||||
return m_sample[0] + ((bitfield<s32>(m_accum, m_fraction_m9, 9) *
|
return m_sample[0] + (((((int)m_accum>>(int)2)&(int)511) *
|
||||||
(m_sample[1] - m_sample[0])) >>
|
(m_sample[1] - m_sample[0])) >>
|
||||||
9);
|
9);
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 es550x_shared_core::es550x_voice_t::es550x_alu_t::get_accum_integer()
|
u32 es550x_shared_core::es550x_voice_t::es550x_alu_t::get_accum_integer()
|
||||||
{
|
{
|
||||||
return bitfield(m_accum, m_fraction, m_integer);
|
return (m_accum>>m_fraction)&((1<<m_integer)-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void es550x_shared_core::es550x_voice_t::es550x_alu_t::irq_exec(es550x_intf &intf,
|
void es550x_shared_core::es550x_voice_t::es550x_alu_t::irq_exec(es550x_intf &intf,
|
||||||
|
|
|
@ -285,7 +285,7 @@ class DivPlatformES5506: public DivDispatch, public es550x_intf {
|
||||||
public:
|
public:
|
||||||
virtual void e_pin(bool state) override; // E output
|
virtual void e_pin(bool state) override; // E output
|
||||||
virtual void irqb(bool state) override; // IRQB output
|
virtual void irqb(bool state) override; // IRQB output
|
||||||
virtual s16 read_sample(u8 voice, u8 bank, u32 address) override {
|
virtual s16 read_sample(u8 bank, u32 address) override {
|
||||||
if (sampleMem==NULL) return 0;
|
if (sampleMem==NULL) return 0;
|
||||||
return sampleMem[((bank&3)<<21)|(address&0x1fffff)];
|
return sampleMem[((bank&3)<<21)|(address&0x1fffff)];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue