ok, I have this code. is this c++?
atlasCODE
registers {
X /.8./, Y /.8./,
D /.12./,
uAR /.5./, // micro Address Reg.
uIR /.13./, // micro Instruction Reg.
uMEM [32] /.13./, // micro Memory
Xout /.9./, Yout /.9./;
}
variables {
radius /.8./,
ALU_in_A /.12./, ALU_in_B /.12./,
ALU_out /.12./,
octant /.3./; // Current octant
}
init {
let flags = 0;
let uAR = 0;
let octant = 0;
}
// modify ALU operation according
// the current octant
oct_encode {
if( uIR /.2..4./ != 6 )
return;
let uIR/.5..6./ = 0;
nxor( uIR/.1./, octant/.0./, uIR/.2./ );
not( uIR/.2./, uIR/.3./ );
let uIR/.4./ = 0;
if( uIR/.1./ == 1 )
let uIR/.1./ = octant/.2./;
else
xor( octant/.1./, octant/.2./, uIR/.1./ );
let uIR/.0./ = uIR/.1./;
}
sel_ALU_in {
decode ( uIR /.5..6./ ) {
0: let ALU_in_A = 0;
1: let ALU_in_A = X;
2: let ALU_in_A = Y;
3: let ALU_in_A = D;
}
decode ( uIR /.2..4./ ) {
0: let ALU_in_B = 0;
1: let ALU_in_B = X;
2: let ALU_in_B = Y;
3: shiftl0( X, 1, ALU_in_B );
4: shiftl0( X, 2, ALU_in_B );
5: { shiftl0( Y, 2, ALU_in_B );
let ALU_in_B /.0./ = 1;
}
}
}
sel_ALU_out {
decode ( uIR /.8..10./ ) {
1: let X = ALU_out;
2: let Y = ALU_out;
3: let D = ALU_out;
5: { let Xout = ALU_out;
trace.8
print( "Xout = ", %3.s (signed) Xout );
}
6: { let Yout = ALU_out;
trace.8 {
print( " Yout = ", %3.s (signed) Yout, / );
waitkey;
}
}
}
}
alu {
if ( uIR/.2..4./ == 7 ) {
inc ( octant, octant );
if( octant == 0 )
exit;
return;
}
call oct_encode;
call sel_ALU_in;
if( uIR /.1./ == 1 )
not( ALU_in_B, ALU_in_B );
let flagc = uIR /.0./;
addcf( ALU_in_A, ALU_in_B, ALU_out );
call sel_ALU_out;
}
run {
print( "enter radius (0-255) -->" );
read (radius);
forever {
on( fall( clock ) );
let uIR = uMEM [uAR];
inc ( uAR, uAR );
if( uIR /.7./ == 1 )
let X = radius;
else
xdecode ( uIR /.11..12./ ) {
%X 00: call alu;
%X 01: let uAR = uIR /.2..6./;
%X 1X: {
if ( flags == uIR /.11./ )
let uAR = uIR /.2..6./;
}
}
}
}
CODE
memory word /.13./;
PC /.5./;
separators ":=()>+-";
integers adr +/.5./;
index flag /.1./;
replacements {
d {
"X:=" = ,001,
"Y:=" = ,010,
"D:=" = ,011,
"" = ,000,
}
A {
"0" = ,00,
"X" = ,01,
"Y" = ,10,
"D" = ,11,
}
B {
"0" = ,000,
"X" = ,001,
"Y" = ,010,
"2X" = ,011,
"4X" = ,100,
"4Y+1" = ,101,
}
Pls_C {
"+1" = ,1,
"+0" = ,0,
"-0" = ,0,
"" = ,0,
}
Min_C {
"-1" = ,0,
"+0" = ,1,
"-0" = ,1,
"" = ,1,
}
}
instructions {
"X:=radius" =;0, 0, 001, 1, 00, 000, 0, 0;
"JUMP `adr`" =;0, 1, 000, 0, adr, 0, 0;
"(Sign=`flag`)=>JUMP `adr`" =;1,flag, 000, 0, adr, 0, 0;
"next octant" =;00, 000, 0, 00, 111, 0, 0;
"Xout" =;00, 101, 0, 00, 110, 0, 0;
"Yout" =;00, 110, 0, 00, 110, 1, 0;
"`d``A`+`B``Pls_C`" =;00, d, 0, A, B, 0, Pls_C;
"`d``A`-`B``Min_C`" =;00, d, 0, A, B, 1, Min_C;
}
CODE
BEGIN X:=radius
Y:=0+0
D:=0-2X-0
D:=D+0+1
D:=D+0+1
D:=D+0+1
AGAIN X-Y-0
(Sign = 0) => JUMP OUTPUT
next octant
JUMP BEGIN
OUTPUT Xout
Yout
D-0
(Sign = 1) => JUMP FORWARD
X:=X-0-1
D:=D-4X +0
FORWARD Y:=Y+0+1
D:=D+4Y+1+1
JUMP AGAIN