# HG changeset patch # User Michael Pavone # Date 1538705576 25200 # Node ID a172f97d873ff127947205ff1c3a65c3489f3f79 # Parent 0e8438a4c76fb5216a62ab37c3920d52a66e1351 Add the ability for a CPU definition to reference arbitrary C includes and use it to add a placeholder definition of svp_read_16 diff -r 0e8438a4c76f -r a172f97d873f cpu_dsl.py --- 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 = {} diff -r 0e8438a4c76f -r a172f97d873f svp.cpu --- 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 diff -r 0e8438a4c76f -r a172f97d873f svp_util.c --- /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; +}