Tunguska the ternary emulator

Balanced Ternary Numeral System - forum was moved from http://ternary.info

Moderator: haqreu

User avatar
Shaos
Admin
Posts: 23989
Joined: 08 Jan 2003 23:22
Location: Silicon Valley

Re: Tunguska the ternary emulator

Post by Shaos »

Shaos wrote:
Shaos wrote:
OK, and I'll check current code under MacOS X 10.4 on my PowerBook G4
I checked - bad news :(
MacOS X 10.4 has older bison version 1.28 that doesn't create cpp/hpp, instead it creates c/h files and I can't compile it even after renaming...
After installation from sources m4-1.4.13 (with symlink /usr/local/bin/gm4 to m4) and bison-2.4.1 Tunguska was compiled:
make
g++ `pkg-config sdl --cflags` -O3 -funroll-loops -Wall -c -o trit.o trit.cc
g++ `pkg-config sdl --cflags` -O3 -funroll-loops -Wall -c -o tryte.o tryte.cc
g++ `pkg-config sdl --cflags` -O3 -funroll-loops -Wall -c -o machine.o machine.cc
g++ `pkg-config sdl --cflags` -O3 -funroll-loops -Wall -c -o tunguska.o tunguska.cc
g++ `pkg-config sdl --cflags` -O3 -funroll-loops -Wall -c -o display.o display.cc
g++ `pkg-config sdl --cflags` -O3 -funroll-loops -Wall -c -o keyboard.o keyboard.cc
g++ `pkg-config sdl --cflags` -O3 -funroll-loops -Wall -c -o interrupt.o interrupt.cc
g++ `pkg-config sdl --cflags` -O3 -funroll-loops -Wall -c -o disk.o disk.cc
g++ `pkg-config sdl --cflags` -O3 -funroll-loops -Wall -c -o agdp.o agdp.cc
g++ `pkg-config sdl --cflags` -O3 -funroll-loops -Wall -c -o memory.o memory.cc
g++ trit.o tryte.o machine.o tunguska.o interrupt.o display.o keyboard.o disk.o agdp.o memory.o -o tunguska `pkg-config sdl --libs` -lfl -lz
bison -d parser.ypp
mv parser.tab.hpp parser.h
g++ `pkg-config sdl --cflags` -O3 -funroll-loops -Wall -c -o parser.tab.o parser.tab.cpp
In file included from /usr/include/gcc/darwin/4.0/c++/backward/iostream.h:31,
from /usr/include/FlexLexer.h:50,
from parser.ypp:25:
/usr/include/gcc/darwin/4.0/c++/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.
flex -+ scanner.l
g++ `pkg-config sdl --cflags` -O3 -funroll-loops -Wall -c -o lex.yy.o lex.yy.cc
In file included from /usr/include/gcc/darwin/4.0/c++/backward/iostream.h:31,
from /usr/include/FlexLexer.h:50,
from lex.yy.cc:241:
/usr/include/gcc/darwin/4.0/c++/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.
lex.yy.cc: In member function `virtual int yyFlexLexer::yylex()':
lex.yy.cc:633: warning: label 'find_rule' defined but not used
lex.yy.cc: At global scope:
lex.yy.cc:1613: warning: 'void* yy_flex_realloc(void*, yy_size_t)' defined but not used
g++ `pkg-config sdl --cflags` -O3 -funroll-loops -Wall -c -o assembler.o assembler.cc
In file included from /usr/include/gcc/darwin/4.0/c++/backward/iostream.h:31,
from /usr/include/FlexLexer.h:50,
from assembler.cc:28:
/usr/include/gcc/darwin/4.0/c++/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.
g++ trit.o tryte.o machine.o interrupt.o assembler.o parser.tab.o lex.yy.o memory.o agdp.o -o tg_assembler `pkg-config sdl --libs` -lfl -lz
it's working, but very slow (in the beginning 10-15 seconds per frame, then about 5 seconds per frame).
Speed of virtual machine on 1.67 GHz PowerPC G4 under MacOS X 10.4:

Code: Select all

Initial benchmark: 886.832 thousand operations per second
        Spread: 136.945
eudoxie
Maniac
Posts: 277
Joined: 17 Sep 2012 13:36
Location: 81.170.128.52

Re: Tunguska the ternary emulator

Post by eudoxie »

As you have no doubt noticed, not a lot has happened with this project for ages (well, in fact, nothing at all has happened). I've been quite busy with other projects and my physics studies, and now on top of that I'm working on my master's thesis, which is eating a lot of time, so things will likely remain slow at least until my thesis is finished (in January).

Just figured I'd make some sort of official statement, so you guys don't think I've been run over by a bus or something.
User avatar
Shaos
Admin
Posts: 23989
Joined: 08 Jan 2003 23:22
Location: Silicon Valley

Re: Tunguska the ternary emulator

Post by Shaos »

Good news! ;)
By the way, any ideas as to do Tunguska faster on Mac? :)
Mac Buster
Retired
Posts: 1474
Joined: 03 Aug 2003 22:37
Location: Moscow

Re: Tunguska the ternary emulator

Post by Mac Buster »

I am happy to know you're not dropped the project :) Will wait for new Tunguska releases.
Mac Buster
Retired
Posts: 1474
Joined: 03 Aug 2003 22:37
Location: Moscow

Re: Tunguska the ternary emulator

Post by Mac Buster »

By the way, any ideas as to do Tunguska faster on Mac? :)
It is fairly easy - take a faster Mac ;)
User avatar
Shaos
Admin
Posts: 23989
Joined: 08 Jan 2003 23:22
Location: Silicon Valley

Re: Tunguska the ternary emulator

Post by Shaos »

Mac Buster wrote:
By the way, any ideas as to do Tunguska faster on Mac? :)
It is fairly easy - take a faster Mac ;)
My Mac is relatively fast - it's PowerPC G4 1.67 GHz...
eudoxie
Maniac
Posts: 277
Joined: 17 Sep 2012 13:36
Location: 81.170.128.52

Re: Tunguska the ternary emulator

Post by eudoxie »

The work on my thesis sort took longer than I had planned. It's now mostly done, and the classes I'm taking now have been quite demanding, but hopefully I'll be able to put real work into Tunguska towards the end of this month.

It's very frustrating to be away from programming for this long. I have so many ideas, and my programming fingers are itching to get to work.

I'm doing some small performance testing work on various algorithms at the moment, to get hard figures on which method of doing ternary logic in host-native integers is the best.

As for mac performance, I honestly have no idea.
eudoxie
Maniac
Posts: 277
Joined: 17 Sep 2012 13:36
Location: 81.170.128.52

Re: Tunguska the ternary emulator

Post by eudoxie »

The people that were hosting the tunguska website has had a disk crash, so it's down for the time being. Apparently they're working on restoring stuff from the backups now.

Just figured I'd let you guys know I haven't disowned the page or anything.
eudoxie
Maniac
Posts: 277
Joined: 17 Sep 2012 13:36
Location: 81.170.128.52

Re: Tunguska the ternary emulator

Post by eudoxie »

I've moved the tunguska website to sourceforge hosting, as my acc.umu.se account will soon expire, as well as updated the freshmeat page to reflect this change.

I also patched some bit rot on the CVS so that it compiles with newer GCC versions.
User avatar
Shaos
Admin
Posts: 23989
Joined: 08 Jan 2003 23:22
Location: Silicon Valley

Re: Tunguska the ternary emulator

Post by Shaos »

eudoxie wrote: I've moved the tunguska website to sourceforge hosting, as my acc.umu.se account will soon expire, as well as updated the freshmeat page to reflect this change.

I also patched some bit rot on the CVS so that it compiles with newer GCC versions.

Code: Select all

bash-4.1$ make
g++ `pkg-config sdl --cflags` -O3 -funroll-loops -Wall    -c -o trit.o trit.cc
g++ `pkg-config sdl --cflags` -O3 -funroll-loops -Wall    -c -o tryte.o tryte.cc
g++ `pkg-config sdl --cflags` -O3 -funroll-loops -Wall    -c -o machine.o machine.cc
g++ `pkg-config sdl --cflags` -O3 -funroll-loops -Wall    -c -o tunguska.o tunguska.cc
g++ `pkg-config sdl --cflags` -O3 -funroll-loops -Wall    -c -o display.o display.cc
g++ `pkg-config sdl --cflags` -O3 -funroll-loops -Wall    -c -o keyboard.o keyboard.cc
g++ `pkg-config sdl --cflags` -O3 -funroll-loops -Wall    -c -o interrupt.o interrupt.cc
g++ `pkg-config sdl --cflags` -O3 -funroll-loops -Wall    -c -o disk.o disk.cc
g++ `pkg-config sdl --cflags` -O3 -funroll-loops -Wall    -c -o agdp.o agdp.cc
g++ `pkg-config sdl --cflags` -O3 -funroll-loops -Wall    -c -o memory.o memory.cc
g++ trit.o tryte.o machine.o tunguska.o interrupt.o display.o keyboard.o disk.o agdp.o memory.o -o tunguska `pkg-config sdl --libs` -lfl -lz 
bison -d parser.ypp
mv parser.tab.hpp parser.h
g++ `pkg-config sdl --cflags` -O3 -funroll-loops -Wall    -c -o parser.tab.o parser.tab.cpp
flex -+ scanner.l
g++ `pkg-config sdl --cflags` -O3 -funroll-loops -Wall    -c -o lex.yy.o lex.yy.cc
lex.yy.cc: In member function 'int yyFlexLexer::yyinput()':
lex.yy.cc:1402:14: error: 'EOF' was not declared in this scope
make: *** [lex.yy.o] Error 1
I have Slackware 13.37:

Code: Select all

bash-4.1$ uname -a
Linux monster 2.6.37.6-smp #2 SMP Sat Apr 9 23:39:07 CDT 2011 i686 Intel(R) Core(TM)2 Duo CPU     E4700  @ 2.60GHz GenuineIntel GNU/Linux
bash-4.1$ gcc --version
gcc (GCC) 4.5.2
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
eudoxie
Maniac
Posts: 277
Joined: 17 Sep 2012 13:36
Location: 81.170.128.52

Re: Tunguska the ternary emulator

Post by eudoxie »

Hm, I'm not quite sure what to do about that one, as it's code that has been generated by flex and not by me. Could be that slackware is using versions of gcc and flex that don't play nice together.

My flex version defines EOF as -1, I suppose you could compile with -DEOF=-1 as a temporary fix.
User avatar
Shaos
Admin
Posts: 23989
Joined: 08 Jan 2003 23:22
Location: Silicon Valley

Re: Tunguska the ternary emulator

Post by Shaos »

Code: Select all

bash-4.1$ flex --version
flex 2.5.35

bash-4.1$ bison --version
bison (GNU Bison) 2.4.3
Written by Robert Corbett and Richard Stallman.

Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
eudoxie
Maniac
Posts: 277
Joined: 17 Sep 2012 13:36
Location: 81.170.128.52

Re: Tunguska the ternary emulator

Post by eudoxie »

I have the same flex version, bison 2.4.1 and gcc 4.5.2.

What's your GCC version?

Also, try adding

Code: Select all

#ifndef EOF
# define EOF -1
#endif
just above "extern YYSTYPE yylval" in scanner.l, see if that works (it's a bit of an ugly fix, but my version doesn't complain about it and builds a working assembler)
User avatar
Shaos
Admin
Posts: 23989
Joined: 08 Jan 2003 23:22
Location: Silicon Valley

Re: Tunguska the ternary emulator

Post by Shaos »

yes, it's working

P.S. my gcc is 4.5.2
eudoxie
Maniac
Posts: 277
Joined: 17 Sep 2012 13:36
Location: 81.170.128.52

Re: Tunguska the ternary emulator

Post by eudoxie »

I pushed some minor changes to the CVS. Mostly moving a bunch of small objects off the heap to the stack, where good programming practice dictates they belong. Shouldn't affect performance or functionality.