Skip to content

Instantly share code, notes, and snippets.

@himerzi
Last active August 29, 2015 14:10
Show Gist options
  • Save himerzi/721c13f108b8107d390d to your computer and use it in GitHub Desktop.
Save himerzi/721c13f108b8107d390d to your computer and use it in GitHub Desktop.
my_sc
#systemic start
// define the functions
#function NOP %b00000000000000000000000000000000
#function ADD %b10000000000000000000000000000000
#function ADDe %b01000000000000000000000000000000
#function SUBTRACT %b11000000000000000000000000000000
#function SUBTRACTe %b00100000000000000000000000000000
#function MULT %b10100000000000000000000000000000
#function MULTe %b01100000000000000000000000000000
#function DIV %b11100000000000000000000000000000
#function DIVe %b00010000000000000000000000000000
#function MOD %b10010000000000000000000000000000
#function MODe %b01010000000000000000000000000000
#function AND %b11010000000000000000000000000000
#function OR %b00110000000000000000000000000000
#function EOR %b10110000000000000000000000000000
#function ZERO %b01110000000000000000000000000000
#function ESCAPE %b11110000000000000000000000000000
#function CAPTURE %b00001000000000000000000000000000
#function PRINT %b10001000000000000000000000000000
#function COPY %b01001000000000000000000000000000
#function ISZERO %b11001000000000000000000000000000
#function ISEQUAL %b00101000000000000000000000000000
#function CAPTUREINHERIT %b10101000000000000000000000000000
#function POW %b00000100000000000000000000000000
#function ROOT %b10000100000000000000000000000000
// define some useful labels
#label first %b10101010000000000000000000000000
#label second %b01001001000000000000000000000000
#label num %b10000000000000000000000000000000
#label zero %b00000000000000000000000000000000
#label one %b10000000000000000000000000000000
#label two %b01000000000000000000000000000000
#label three %b11000000000000000000000000000000
#label four %b00100000000000000000000000000000
#label zerotofour %b???00000000000000000000000000000
#label dontcare %b????????????????????????????????
#label onetwoeight %b???????1????????????????????????
#label nooutput %b????????0???????????????????????
// and the program begins here:
main (%d0 %d0 %d0)
a1 (one zero four)
a2 (two zero three)
a3 (one zero four)
a4 (two zero two)
minus ([one zero dontcare] SUBTRACTe(0,0) [two zero dontcare])
times ([one zero dontcare] MULT(0,0) [two zero dontcare])
output ([dontcare zero dontcare] PRINT(0,0) [dontcare zero dontcare])
c1 (%d256 %d255 %d256)
c2 (%d256 %d255 %d256)
#chain times
{
($L output $R)
}
// set up the scopes
#scope c1
{
a1
a2
minus
}
#scope c2
{
a3
a4
minus
}
#scope main
{
c1
c2
times
output
}
#systemic end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment