From 84f4c7f55c14e8937b7a2cf8b7c5ea2f052ec342 Mon Sep 17 00:00:00 2001 From: Christian Dietrich Date: Tue, 30 Sep 2014 14:48:31 +0200 Subject: [PATCH] Added README file --- README.md | 70 ++++++++++++++++++++++++++++++++ avr.tex | 1 - imgs/mandelbrot-20x20.png | Bin 0 -> 2777 bytes tests/mandelbrot.20x20.tikz.tex | 7 ++++ 4 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 README.md create mode 100644 imgs/mandelbrot-20x20.png create mode 100644 tests/mandelbrot.20x20.tikz.tex diff --git a/README.md b/README.md new file mode 100644 index 0000000..63deaf7 --- /dev/null +++ b/README.md @@ -0,0 +1,70 @@ +avr-tex: An AVR Emulator written in pure LaTeX +====================================================== + +![A Mandelbrot Set. The image took 40 Minute so be calculated](imgs/mandelbrot-20x20.png)[5] + +LaTeX is known as a typesetting system. But the underlying TeX system +is a powerful macro processor. In fact, TeX is a Turing-complete +programming language. TeX can compute anything, that is +computable. Computeability is a concept from theoretical computer +science. After visiting a theoretical CS course, you will know that +there are things that cannot be solved by a machine. Never. Look out +for the halting machine. So, Turing-complete does not say "It's a +proper programming language", but more "someone can write a proper +interpreter for any programming language in it, theoretically". + +So back to TeX. To be honest, TeX is a horrible language to code +in. After writing my master thesis in LaTex, after crafting every +graphic within with TiKz[1] and pgfplots[2], and after writing my +first LaTeX package[3], I can honestly say: TeX is the Quasimodo of +all widely used programming languages. If you can avoid it, avoid it. +But if you are forced to use it, you can abstract from TeX, since it +is a "proper" programming language. + +Let's say we want to program our document in C on Top of Tex. Then +there would be the need to interpret the C semantic. Basically we +would have to write a compiler for C in TeX. Not a very promising +future, if you start this. But, we can use a normal C compiler to +compile the C code to some simple platform. Like AVR[4]. Since I have +other things to do than writing an AVR Emulator in TeX, here it is! + +## You are writing an CPU emulator in TeX, the TYPESETTING system? ## + +Yep. + +## What Microcontroller is emulated? ## + +I aimed for an ATmega8. The AVR platform is an 8 Bit Processor with 16 +Bit memory addresses. The hardware version is shipped with 1 KByte of +RAM and 8 Kbyte Flash memory, but of course, the emulated processor +can handle more memory. + +## Are you insane? ## + +Not that anybody knows of. + +## Are all OP codes implemented? ## + +Unfortunately not. I'm still missing 5 opcodes (MULS, MULSU, FMUL, +FMULS, FMULSU), but until now I did not encounter a C file, the +AVR-GCC emits these opcodes. The fractional multiply opcodes are also +somewhat arcane. + +## Is it fast? ## + +Ok, you are asking me, whether a CPU simulator written in TeX, that +simulates an 8-Bit microcontroller is fast? Propably not. On my +notebook I could achieve 2.5 KHz, so this is a factor 10000 slower +than the actual hardware with the highest supported clock rate. + +----- + +[1] http://www.ctan.org/pkg/pgf + +[2] http://pgfplots.sourceforge.net/ + +[3] http://www.ctan.org/pkg/dataref + +[4] http://en.wikipedia.org/wiki/Atmel_AVR + +[5] A Mandelbrot Set. The image took 40 Minute to be calculated diff --git a/avr.tex b/avr.tex index 65f4fbf..5e4339a 100644 --- a/avr.tex +++ b/avr.tex @@ -16,7 +16,6 @@ \input{avr.io} \input{avr.testsuite} - \begin{document} \makeatletter diff --git a/imgs/mandelbrot-20x20.png b/imgs/mandelbrot-20x20.png new file mode 100644 index 0000000000000000000000000000000000000000..aa2fe4cdfc540abaeefcb01ba5a5f8941e512b71 GIT binary patch literal 2777 zcmV;~3MTc5P);ex6_ASBo1e*c(RM>?;yMje&g||wW<(n03iMc6d zY-aU1F4WVu!|1Kn#HKY0jhc#UKlf;)QUc&8`D5J`X)uqrWc%b@urF8#({17syLJt0 zVVoH)m$XKwe-n|` zS~IR;yCOZSv0K)#$YDE<9#z=6`MNBt&!dmBoBp8oZ(`GLzR6x@Gw*7>wLKBpTxz;i zjWjo>MgrgndARI~G#I}k*^Hvkv8)5kDf$)5tj~!mSVZn~hL+uAtMvgtR1-Gl06*nV zgArqEXZ_I>;QV<87cQ7|tA*e1)7srN`jI1rdRm_|1$g~+daIR5t2kmb_+xkH=5PuS z5+1o@ea?ION7~bIWXWIj!<9bgkw+L)^eZ!wuJk#W;Yby0d`_JNm_gRMU1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