URL
https://opencores.org/ocsvn/ssbcc/ssbcc/trunk
[/] [ssbcc/] [trunk/] [core/] [9x8/] [macros/] [outport.py] - Blame information for rev 3
Go to most recent revision |
Details |
Compare with Previous |
View Log
Line No. |
Rev |
Author |
Line |
1 |
3 |
sinclairrf |
# Copyright 2014, Sinclair R.F., Inc.
|
2 |
|
|
|
3 |
|
|
def outport(ad):
|
4 |
|
|
"""
|
5 |
|
|
Built-in macro to write the top of the data stack to the specified output
|
6 |
|
|
port.\n
|
7 |
|
|
Usage:
|
8 |
|
|
.outport(O_name[,op])
|
9 |
|
|
where
|
10 |
|
|
O_name is the name of the output port
|
11 |
|
|
op is an optional argument to override the default "drop"
|
12 |
|
|
instruction\n
|
13 |
|
|
The effect is: Write T to the specified output port.\n
|
14 |
|
|
( u - )
|
15 |
|
|
"""
|
16 |
|
|
|
17 |
|
|
# Add the macro to the list of recognized macros.
|
18 |
|
|
ad.AddMacro('.outport', 3, [
|
19 |
|
|
['','symbol'],
|
20 |
|
|
['drop','instruction','singlemacro','singlevalue','symbol']
|
21 |
|
|
]);
|
22 |
|
|
|
23 |
|
|
# Define the macro functionality.
|
24 |
|
|
def emitFunction(ad,fp,argument):
|
25 |
|
|
outportName = argument[0]['value'];
|
26 |
|
|
if not ad.IsOutport(outportName):
|
27 |
|
|
raise asmDef.AsmException('Symbol "%s" is either not an output port or is a strobe-only outport at %s' % (outportName,argument[0]['loc']));
|
28 |
|
|
ad.EmitPush(fp,ad.OutportAddress(outportName) & 0xFF,outportName);
|
29 |
|
|
ad.EmitOpcode(fp,ad.InstructionOpcode('outport'),'outport');
|
30 |
|
|
ad.EmitOptArg(fp,argument[1]);
|
31 |
|
|
ad.EmitFunction['.outport'] = emitFunction;
|
© copyright 1999-2025
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.