summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices
diff options
context:
space:
mode:
author couriersud <couriersud@users.noreply.github.com>2022-07-05 08:23:45 +0200
committer GitHub <noreply@github.com>2022-07-05 08:23:45 +0200
commit93d60e7c6a00e1dbe0d8e78197532c66f0259dcd (patch)
treeba23ca90fccbb386f82f3ce324696e2c68834590 /src/devices
parentee66f0344f09072df22542def6426e3c5dda2b6d (diff)
netlist: gtrak10 performance and other improvements and fixes (#10032)
- added support parameter FORCE_TRISTATE_LOGIC on mk28000 - add system device SYS_PULSE to generate pulse based on input changes parameters are delay, pulse width, input polarity and output polarity - add USE_SPEED_HACKS define to gtrak10 to enable the use of the above Brings gtrak10 from 18% to 120%. - Improved interlaced video support in fixfreq.cpp Added two interlace modes: progressive and interlaced which can be selected in machine configuration. - more clang format work - rename link to connection - introduced typed aliases. This information may be used later to rewrite netlists. - added a three terminal base device This will allow the analog code to be more easily comparable to literature about MNA (Modal node analysis). BJT code is now a lot better readable. - fix doxygen consistency - added an example for a cmos inverter based on NMOS/PMOS fets. - TRUTHTABLE_START was renamed to TRUTH_TABLE - truth tables are now enclosed in braces - netlists are now enclosed in braces - TRUTHTABLE_END() and NETLIST_END() removed from files - Fixed static solver script - Add file path to includes in nltool
Diffstat (limited to 'src/devices')
-rw-r--r--src/devices/machine/netlist.cpp6
-rw-r--r--src/devices/video/fixfreq.cpp72
-rw-r--r--src/devices/video/fixfreq.h7
3 files changed, 64 insertions, 21 deletions
diff --git a/src/devices/machine/netlist.cpp b/src/devices/machine/netlist.cpp
index af55f7338d0..b5e2ae547c9 100644
--- a/src/devices/machine/netlist.cpp
+++ b/src/devices/machine/netlist.cpp
@@ -498,7 +498,7 @@ void netlist_mame_analog_output_device::custom_netlist_additions(netlist::nlpars
pstring dname = pstring("OUT_") + pin;
parser.register_dev(dname, dname);
- parser.register_link(dname + ".IN", pin);
+ parser.register_connection(dname + ".IN", pin);
}
void netlist_mame_analog_output_device::pre_parse_action(netlist::nlparse_t &parser)
@@ -548,7 +548,7 @@ void netlist_mame_logic_output_device::custom_netlist_additions(netlist::nlparse
pstring dname = pstring("OUT_") + pin;
parser.register_dev(dname, dname);
- parser.register_link(dname + ".IN", pin);
+ parser.register_connection(dname + ".IN", pin);
}
void netlist_mame_logic_output_device::pre_parse_action(netlist::nlparse_t &parser)
@@ -852,7 +852,7 @@ void netlist_mame_stream_output_device::custom_netlist_additions(netlist::nlpars
pstring dname = plib::pfmt("STREAM_OUT_{1}")(m_channel);
parser.register_dev(dname, dname);
- parser.register_link(dname + ".IN", pstring(m_out_name));
+ parser.register_connection(dname + ".IN", pstring(m_out_name));
}
void netlist_mame_stream_output_device::process(netlist::netlist_time_ext tim, netlist::nl_fptype val)
diff --git a/src/devices/video/fixfreq.cpp b/src/devices/video/fixfreq.cpp
index 2b6ea328f9a..37fc6d3b44c 100644
--- a/src/devices/video/fixfreq.cpp
+++ b/src/devices/video/fixfreq.cpp
@@ -45,7 +45,8 @@ DEFINE_DEVICE_TYPE(FIXFREQ, fixedfreq_device, "fixfreq", "Fixed-Frequency Monoch
#define PORT_ADJUSTERX(_id, _name, _min, _max) \
PORT_START(# _id) \
configurer.field_alloc(IPT_ADJUSTER, (static_cast<fixedfreq_device &>(owner).monitor_val(_id)), 0xffff, ("Monitor - " _name)); \
- PORT_MINMAX(_min, _max) PORT_CHANGED_MEMBER(DEVICE_SELF, fixedfreq_device, port_changed, _id) \
+ PORT_MINMAX(_min, _max) \
+ PORT_CHANGED_MEMBER(DEVICE_SELF, fixedfreq_device, port_changed, _id) \
PORT_CONDITION("ENABLE", 0x01, EQUALS, 0x01)
#define IOPORT_ID(_id) ioport(# _id)
@@ -91,12 +92,12 @@ void fixedfreq_monitor_state::update_sync_channel(const time_type &time, const d
m_sig_field = avg_line_dur * 0.75 > m_last_line_duration;
LOG("%d %f %f %f\n", m_sig_field, m_last_line_duration, avg_line_dur, time);
}
- if (!has_fields || (m_sig_field == 0))
- {
- m_intf.vsync_end_cb(time - m_last_vsync_time);
- m_last_vsync_time = time;
- }
- m_last_y = 0; //m_desc.vbackporch_width();
+
+ // notify the controlling device about the vsync and the field.
+ m_intf.vsync_end_cb(time - m_last_vsync_time, m_sig_field);
+ m_last_vsync_time = time;
+
+ m_last_y = 0;
}
else if (last_vsync && !m_sig_vsync)
{
@@ -145,8 +146,9 @@ void fixedfreq_monitor_state::update_bm(const time_type &time)
if (!m_sig_vsync && !m_sig_composite)
{
+ //uint32_t mask = m_sig_field ? 0xffffffff : 0xffff0000;
m_fragments.push_back({static_cast<float>(m_last_y + m_sig_field * has_fields),
- m_last_x * fhscale, pixels * fhscale, m_col});
+ m_last_x * fhscale, pixels * fhscale, m_col}); // & mask});
}
//m_intf.plot_hline(m_last_x, m_last_y + m_sig_field * has_fields, pixels, col);
m_last_x = pixels;
@@ -219,6 +221,7 @@ fixedfreq_device::fixedfreq_device(const machine_config &mconfig, device_type ty
m_enable(*this, "ENABLE"),
m_vector(*this, "VECTOR"),
m_scanline_height(1.0),
+ m_last_rt(0.0),
m_monitor(),
m_state(m_monitor, *this)
{
@@ -233,6 +236,19 @@ void fixedfreq_device::device_config_complete()
{
if (!has_screen())
return;
+ // Video signal processing will be moved into netlist to avoid
+ // aborting cpu slices. When this is done, the monitor specifications
+ // need to move to the netlist as well.
+ //
+ // At the time of device_config_complete the monitor specification will
+ // not be known - the netlist is parsed during device_start.
+ // In this case we have to use some temporary fixed values, e.g.
+ // screen().set_raw(7158196, 454, 0, 454, 262, 0, 262);
+ // This will be overwritten during the first vblank anyhow.
+ //
+ // However the width and height determine the width of the mame window.
+ // It is therefore recommended to use `set_raw` in the mame driver
+ // to specify the window size.
if (!screen().refresh_attoseconds())
screen().set_raw(m_monitor.m_monitor_clock, m_monitor.htotal(), 0,
m_monitor.htotal(), m_monitor.vtotal(), 0,
@@ -244,6 +260,8 @@ void fixedfreq_device::device_config_complete()
void fixedfreq_device::device_start()
{
+ LOG("start\n");
+
m_state.start();
// FIXME: will be done by netlist going forward
@@ -259,11 +277,11 @@ void fixedfreq_device::device_start()
/* sync separator */
save_item(NAME(m_state.m_vsync_filter));
-
save_item(NAME(m_state.m_sig_vsync));
save_item(NAME(m_state.m_sig_composite));
save_item(NAME(m_state.m_sig_field));
- LOG("start\n");
+
+ save_item(NAME(m_last_rt));
}
void fixedfreq_device::device_reset()
@@ -337,7 +355,8 @@ static void draw_testpat(screen_device &screen, bitmap_rgb32 &bitmap, const rect
uint32_t fixedfreq_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
- //printf("%f %f\n", m_state.m_fragments[0].y, m_state.m_fragments[m_state.m_fragments.size()-1].y);
+ //printf("%f\n", machine().time().as_double());
+ //printf("%d %lu %f %f\n", m_state.m_sig_vsync, m_state.m_fragments.size(), m_state.m_fragments[0].y, m_state.m_fragments[m_state.m_fragments.size()-1].y);
bool force_vector = screen.screen_type() == SCREEN_TYPE_VECTOR || (m_vector->read() & 1);
bool debug_timing = (m_enable->read() & 2) == 2;
bool test_pat = (m_enable->read() & 4) == 4;
@@ -411,17 +430,33 @@ uint32_t fixedfreq_device::screen_update(screen_device &screen, bitmap_rgb32 &bi
return 0;
}
-void fixedfreq_device::vsync_end_cb(double refresh_time)
+void fixedfreq_device::vsync_end_cb(double refresh_time, uint32_t field)
{
const auto expected_frame_period(m_monitor.clock_period() * m_monitor.vtotal() * m_monitor.htotal());
+ bool progressive = (m_enable->read() & 8) == 8;
+
+ double mult = 0.5;
+
+ if (!progressive && (m_monitor.m_fieldcount == 2))
+ {
+ if (field == 0)
+ {
+ m_last_rt = refresh_time;
+ return;
+ }
+ else
+ mult = 1.0;
+ }
const auto refresh_limited(std::min(4.0 * expected_frame_period,
- std::max(refresh_time, 0.25 * expected_frame_period)));
+ std::max((refresh_time + m_last_rt) * mult, 0.25 * expected_frame_period)));
+ m_last_rt = refresh_time;
rectangle visarea(m_monitor.minh(), m_monitor.maxh(), m_monitor.minv(), m_monitor.maxv());
- screen().configure(m_monitor.htotal_scaled(), m_monitor.vtotal(), visarea, DOUBLE_TO_ATTOSECONDS(refresh_limited));
+ // reset_origin must be called first.
screen().reset_origin(m_state.m_last_y-(m_monitor.vsync_width() + m_monitor.vbackporch_width()), 0);
+ screen().configure(m_monitor.htotal_scaled(), m_monitor.vtotal(), visarea, DOUBLE_TO_ATTOSECONDS(refresh_limited));
}
NETDEV_ANALOG_CALLBACK_MEMBER(fixedfreq_device::update_composite_monochrome)
@@ -478,6 +513,10 @@ static INPUT_PORTS_START(fixedfreq_base_ports)
PORT_CONFSETTING( 0x00, DEF_STR( Off ) )
PORT_CONFSETTING( 0x04, DEF_STR( On ) )
+ PORT_CONFNAME( 0x08, 0x00, "Interlace mode" ) PORT_CONDITION("VECTOR", 0x01, EQUALS, 0x00)
+ PORT_CONFSETTING( 0x00, "Interlaced" )
+ PORT_CONFSETTING( 0x08, "Progressive" )
+
PORT_ADJUSTERX(HVISIBLE, "H Visible", 10, 1000)
PORT_ADJUSTERX(HFRONTPORCH, "H Front porch width", 1, 100)
PORT_ADJUSTERX(HSYNC, "H Sync width", 1, 100)
@@ -489,7 +528,6 @@ static INPUT_PORTS_START(fixedfreq_base_ports)
PORT_ADJUSTERX(SYNCTHRESHOLD, "Sync threshold mV", 10, 2000)
PORT_ADJUSTERX(VSYNCTHRESHOLD, "V Sync threshold mV", 10, 1000)
PORT_ADJUSTERX(GAIN, "Signal Gain", 10, 1000)
- PORT_ADJUSTERX(SCANLINE_HEIGHT, "Scanline Height", 10, 300)
INPUT_PORTS_END
@@ -501,10 +539,14 @@ static INPUT_PORTS_START(fixedfreq_raster_ports)
PORT_INCLUDE(fixedfreq_base_ports)
+ PORT_ADJUSTERX(SCANLINE_HEIGHT, "Scanline Height", 10, 300)
+
INPUT_PORTS_END
static INPUT_PORTS_START(fixedfreq_vector_ports)
PORT_INCLUDE(fixedfreq_base_ports)
+
+ PORT_ADJUSTERX(SCANLINE_HEIGHT, "Scanline Height", 10, 300)
INPUT_PORTS_END
ioport_constructor fixedfreq_device::device_input_ports() const
diff --git a/src/devices/video/fixfreq.h b/src/devices/video/fixfreq.h
index bb2fdde34a9..22b84d12779 100644
--- a/src/devices/video/fixfreq.h
+++ b/src/devices/video/fixfreq.h
@@ -105,7 +105,7 @@ private:
struct fixedfreq_monitor_intf
{
virtual ~fixedfreq_monitor_intf() = default;
- virtual void vsync_end_cb(double refresh_time) = 0;
+ virtual void vsync_end_cb(double refresh_time, uint32_t field) = 0;
};
struct fixedfreq_monitor_line
@@ -174,7 +174,7 @@ struct fixedfreq_monitor_state
m_fragments.clear();
- m_intf.vsync_end_cb(m_desc.clock_period() * m_desc.vtotal() * m_desc.htotal());
+ //m_intf.vsync_end_cb(m_desc.clock_period() * m_desc.vtotal() * m_desc.htotal(), 0);
}
void reset()
@@ -304,12 +304,13 @@ protected:
virtual ioport_constructor device_input_ports() const override;
- void vsync_end_cb(double refresh_time) override;
+ void vsync_end_cb(double refresh_time, uint32_t field) override;
private:
required_ioport m_enable;
required_ioport m_vector;
float m_scanline_height;
+ double m_last_rt;
/* adjustable by drivers */
fixedfreq_monitor_desc m_monitor;