changeset 1620:a172f97d873f

Add the ability for a CPU definition to reference arbitrary C includes and use it to add a placeholder definition of svp_read_16
author Michael Pavone <pavone@retrodev.com>
date Thu, 04 Oct 2018 19:12:56 -0700
parents 0e8438a4c76f
children ca158bc091f9
files cpu_dsl.py svp.cpu svp_util.c
diffstat 3 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/cpu_dsl.py	Mon Oct 01 19:16:54 2018 -0700
+++ b/cpu_dsl.py	Thu Oct 04 19:12:56 2018 -0700
@@ -893,6 +893,7 @@
 		self.extra_tables = info.get('extra_tables', [])
 		self.context_type = self.prefix + 'context'
 		self.body = info.get('body', [None])[0]
+		self.includes = info.get('include', [])
 		self.flags = flags
 		self.lastDst = None
 		self.scopes = []
@@ -930,6 +931,8 @@
 	def build(self, otype):
 		body = []
 		pieces = []
+		for include in self.includes:
+			body.append('#include "{0}"\n'.format(include))
 		for table in self.instructions:
 			opmap = [None] * (1 << self.opsize)
 			bodymap = {}
--- a/svp.cpu	Mon Oct 01 19:16:54 2018 -0700
+++ b/svp.cpu	Thu Oct 04 19:12:56 2018 -0700
@@ -3,6 +3,7 @@
 	opcode_size 16
 	body svp_run_op
 	header svp.h
+	include svp_util.c
 	
 regs
 	internal 16 scratch1 x y scratch2 st pad pc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/svp_util.c	Thu Oct 04 19:12:56 2018 -0700
@@ -0,0 +1,5 @@
+
+void svp_read_16(svp_context *context)
+{
+	context->internal[0] = 0;
+}