1
0
mirror of synced 2024-11-27 07:24:23 +01:00

Generate a hopefully correct version for CTAN

This commit is contained in:
Christian Dietrich 2014-10-13 13:47:14 +02:00
parent 37b98e547f
commit 8e6b161ad0
3 changed files with 90 additions and 4 deletions

View File

@ -12,8 +12,8 @@ test-simple: source/simple-testsuite.tex
test-%: source/test-suite/%.c test-%: source/test-suite/%.c
cd source/test-suite; ./test-suite single $(shell basename $<) cd source/test-suite; ./test-suite single $(shell basename $<)
avremu.tds.zip: source/avremu.pdf avremu.zip: source/avremu.pdf
rm -rf avremu avremu.tds.zip rm -rf avremu avremu.tds.zip avremu.zip
mkdir avremu mkdir avremu
# TeX Directory # TeX Directory
mkdir -p avremu/tex/latex/avremu mkdir -p avremu/tex/latex/avremu
@ -31,9 +31,20 @@ avremu.tds.zip: source/avremu.pdf
# Documenation directory # Documenation directory
mkdir -p avremu/doc/latex/avremu mkdir -p avremu/doc/latex/avremu
cp source/avremu.pdf avremu/doc/latex/avremu cp source/avremu.pdf avremu/doc/latex/avremu
cp README.md avremu/doc/latex/avremu/README cp README avremu/doc/latex/avremu/README
cd avremu; zip -r ../avremu.tds.zip * cd avremu; zip -r ../avremu.tds.zip *
rm -rf avremu rm -rf avremu
# Assemble a Flat version
mkdir avremu
cp tex/latex/avremu/*.tex avremu/
cp tex/latex/avremu/*.sty avremu/
cp source/simple-testsuite.tex avremu/
cp source/avremu.tex avremu/
cp source/avremu.pdf avremu/
cp README avremu/README
zip -r avremu.zip avremu/ avremu.tds.zip
rm -rf avremu
.PHONY: test-simple source/avremu.pdf avremu.tds.zip .PHONY: test-simple source/avremu.pdf avremu.zip

75
README Normal file
View File

@ -0,0 +1,75 @@
avremu: An AVR Emulator written in pure LaTeX
======================================================
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 problem. 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!
The newest source can be found at https://gitlab.brokenpipe.de/stettberger/avremu
The package is licensed under LPPL 1.3
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

BIN
imgs/mandelbrot-250x250.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB