OpenCores
URL https://opencores.org/ocsvn/ssbcc/ssbcc/trunk

Subversion Repositories ssbcc

[/] [ssbcc/] [trunk/] [core/] [9x8/] [macros/] [fetchram.py] - Blame information for rev 5

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 5 sinclairrf
# Copyright 2014, Sinclair R.F., Inc.
2
 
3
def fetchram(ad):
4
  """
5
  Built-in macro for the fetch instruction where the memory is specified by the
6
  variable name instead of the memory name.\n
7
  Usage:
8
    .fetchram(variable)
9
  where
10
    variable    is a variable\n
11
  The effect is:  T = variable\n
12
  ( u_addr - u_mem )
13
  """
14
 
15
  # Add the macro to the list of recognized macros.
16
  ad.AddMacro('.fetchram', 1, [ ['','symbol'] ]);
17
 
18
  # Define the macro functionality.
19
  def emitFunction(ad,fp,argument):
20
    (addr,ixBank,bankName) = ad.Emit_GetAddrAndBank(argument[0]);
21
    emitString = 'fetch(%s) -- %s' % (bankName,argument[0]['value'],);
22
    ad.EmitOpcode(fp,ad.specialInstructions['fetch'] | ixBank,emitString);
23
 
24
  ad.EmitFunction['.fetchram'] = emitFunction;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.