Use TDS Layout
This commit is contained in:
parent
84f4c7f55c
commit
8d320f3744
15
Makefile
15
Makefile
@ -1,3 +1,12 @@
|
|||||||
test:
|
export TEXINPUTS := $(shell pwd)//:${TEXINPUTS}
|
||||||
pdflatex -halt-on-error avr.tex
|
|
||||||
cd tests; ./test-suite
|
test: test-simple
|
||||||
|
cd source/test-suite; ./test-suite
|
||||||
|
|
||||||
|
test-simple: source/simple-testsuite.tex
|
||||||
|
pdflatex -halt-on-error $<
|
||||||
|
|
||||||
|
test-%: source/test-suite/%.c
|
||||||
|
cd source/test-suite; ./test-suite single $(shell basename $<)
|
||||||
|
|
||||||
|
.PHONY: test-simple
|
||||||
|
121
avr.draw.tex
121
avr.draw.tex
@ -1,121 +0,0 @@
|
|||||||
|
|
||||||
% We define 2 IO Registers to communicate from AVR to the Drawing
|
|
||||||
% mechanism
|
|
||||||
|
|
||||||
\usepackage{tikz}
|
|
||||||
|
|
||||||
% TWAR
|
|
||||||
\newcount\avr@draw@argc
|
|
||||||
\csdef{avr@io@000010@set}#1{%
|
|
||||||
\avr@bin@tocount{#1}{\avr@accA}%
|
|
||||||
\avr@log{DRAW CMD: \the\avr@accA}%
|
|
||||||
\avr@draw@command{\the\avr@accA}%
|
|
||||||
\avr@draw@argc = 0\relax
|
|
||||||
}
|
|
||||||
|
|
||||||
\csdef{avr@io@000011@set}#1{%
|
|
||||||
\avr@bin@tocount{#1}{\avr@accA}%
|
|
||||||
\avr@debug{AVR DRAW PUSH: \the\avr@accA}%
|
|
||||||
\csxdef{avr@draw@stack@\the\avr@draw@argc}{\the\avr@accA}%
|
|
||||||
\advance\avr@draw@argc by 1\relax
|
|
||||||
}
|
|
||||||
|
|
||||||
\def\avr@draw@stack#1{\csuse{avr@draw@stack@#1}}
|
|
||||||
|
|
||||||
|
|
||||||
\def\avr@draw@command#1{%
|
|
||||||
\ifcsdef{avr@draw@command@#1}{%
|
|
||||||
\csuse{avr@draw@command@#1}%
|
|
||||||
}{%
|
|
||||||
\avr@error{AVR DRAW: Unkown Command #1}%
|
|
||||||
}%
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
\def\avr@draw@canvas{}
|
|
||||||
|
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
||||||
% Draw Commands
|
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
||||||
\csdef{avr@draw@command@0}{} % NOP
|
|
||||||
|
|
||||||
% Set Draw Color
|
|
||||||
\definecolor{avrdraw}{rgb}{255,255,255}
|
|
||||||
\csdef{avr@draw@command@1}{%
|
|
||||||
\ifnum \avr@draw@argc < 3%
|
|
||||||
\avr@debug{DRAW: Set Draw COLOR, Not enough arguments}%
|
|
||||||
\fi%
|
|
||||||
\edef\@@append{%
|
|
||||||
\detokenize{\definecolor{avrdraw}}%
|
|
||||||
{rgb}{\avr@draw@stack{0},\avr@draw@stack{1},\avr@draw@stack{2}}%
|
|
||||||
}
|
|
||||||
\eappto\avr@draw@canvas{\@@append}
|
|
||||||
}
|
|
||||||
|
|
||||||
% Set Fill Color
|
|
||||||
\definecolor{avrfill}{rgb}{255,255,255}
|
|
||||||
\csdef{avr@draw@command@2}{%
|
|
||||||
\ifnum \avr@draw@argc < 3%
|
|
||||||
\avr@debug{DRAW: Set Fill COLOR, Not enough arguments}%
|
|
||||||
\fi%
|
|
||||||
\edef\@@append{%
|
|
||||||
\detokenize{\definecolor{avrfill}}%
|
|
||||||
{rgb}{\avr@draw@stack{0},\avr@draw@stack{1},\avr@draw@stack{2}}%
|
|
||||||
}
|
|
||||||
\eappto\avr@draw@canvas{\@@append}
|
|
||||||
}
|
|
||||||
|
|
||||||
\csdef{avr@draw@command@3}{%
|
|
||||||
\avr@draw@command{1}% Set Draw Color
|
|
||||||
\avr@draw@command{2}% Set Fill Color
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
% Rectangle
|
|
||||||
\csdef{avr@draw@command@4}{%
|
|
||||||
\ifnum \avr@draw@argc < 4%
|
|
||||||
\avr@debug{DRAW: Rectangle, Not enough arguments (4 required)}
|
|
||||||
\fi%
|
|
||||||
\edef\@@append{%
|
|
||||||
\detokenize{\node}%
|
|
||||||
[minimum height = \avr@draw@stack{2}mm,%
|
|
||||||
minimum width = \avr@draw@stack{3}mm,%
|
|
||||||
inner sep=0,%
|
|
||||||
anchor=north west,
|
|
||||||
draw=avrdraw,fill=avrfill]
|
|
||||||
at (\avr@draw@stack{0}mm,\avr@draw@stack{1}mm) {};%
|
|
||||||
}%
|
|
||||||
\eappto\avr@draw@canvas{\@@append}%
|
|
||||||
}
|
|
||||||
|
|
||||||
% Small Rectangle
|
|
||||||
\csdef{avr@draw@command@5}{%
|
|
||||||
\ifnum \avr@draw@argc < 2%
|
|
||||||
\avr@debug{DRAW: Short Rectangle, Not enough arguments (2 required)}
|
|
||||||
\fi%
|
|
||||||
\edef\@@append{%
|
|
||||||
\detokenize{\node}%
|
|
||||||
[minimum size = 1mm,%
|
|
||||||
inner sep=0,%
|
|
||||||
anchor=north west,
|
|
||||||
draw=avrdraw,fill=avrfill]
|
|
||||||
at (\avr@draw@stack{0}mm,\avr@draw@stack{1}mm) {};%
|
|
||||||
}%
|
|
||||||
\eappto\avr@draw@canvas{\@@append}%
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
\newcommand{\avrdrawcanvas}{%
|
|
||||||
\begin{tikzpicture}
|
|
||||||
\scantokens\expandafter{\avr@draw@canvas}%
|
|
||||||
\end{tikzpicture}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
%%% Local Variables:
|
|
||||||
%%% mode: latex
|
|
||||||
%%% TeX-master: "avr.tex"
|
|
||||||
%%% End:
|
|
33
avr.tex
33
avr.tex
@ -1,33 +0,0 @@
|
|||||||
\documentclass{article}
|
|
||||||
|
|
||||||
\usepackage{etoolbox}
|
|
||||||
\usepackage{tabularx}
|
|
||||||
\parindent=0pt
|
|
||||||
|
|
||||||
\makeatletter
|
|
||||||
|
|
||||||
\errorcontextlines=23
|
|
||||||
|
|
||||||
\input{avr.numbers}
|
|
||||||
\input{avr.binary}
|
|
||||||
\input{avr.bitops}
|
|
||||||
\input{avr.memory}
|
|
||||||
\input{avr.instr}
|
|
||||||
\input{avr.io}
|
|
||||||
\input{avr.testsuite}
|
|
||||||
|
|
||||||
\begin{document}
|
|
||||||
|
|
||||||
\makeatletter
|
|
||||||
|
|
||||||
\avr@test
|
|
||||||
|
|
||||||
\avr@dump@totex
|
|
||||||
|
|
||||||
|
|
||||||
\end{document}
|
|
||||||
|
|
||||||
%%% Local Variables:
|
|
||||||
%%% mode: latex
|
|
||||||
%%% TeX-master: t
|
|
||||||
%%% End:
|
|
@ -1,42 +1,8 @@
|
|||||||
%% This is the test suite for my avr Implementation
|
\documentclass{article}
|
||||||
\def\avr@test@setup#1{%
|
\usepackage{avremu}
|
||||||
\typeout{---- Test: #1 ----}%
|
|
||||||
\typeout{-> Initialize the AVR}%
|
|
||||||
\avr@init%
|
|
||||||
}
|
|
||||||
|
|
||||||
\def\avr@test@SREG#1{% Tests SREG for value
|
|
||||||
\avr@sreg@get{\@@SREG}%
|
|
||||||
\expandafter\ifstrequal\expandafter{\@@SREG}{#1}{%Success
|
|
||||||
}{%
|
|
||||||
\avr@error{SREG unequal: #1 != \@@SREG}%
|
|
||||||
}%
|
|
||||||
}
|
|
||||||
|
|
||||||
\def\avr@test@REG#1#2{% Tests SREG for value
|
|
||||||
\avr@reg@get{\csuse{avr@#1}}{\@@REG}%
|
|
||||||
\expandafter\ifstrequal\expandafter{\@@REG}{#2}{%Success
|
|
||||||
}{%
|
|
||||||
\avr@error{REG unequal: #2 != \@@REG}%
|
|
||||||
}%
|
|
||||||
}
|
|
||||||
|
|
||||||
\def\avr@test@MEM#1#2{% Tests MEM for value
|
|
||||||
\avr@mem@get{#1}{\@@MEM}%
|
|
||||||
\expandafter\ifstrequal\expandafter{\@@MEM}{#2}{%Success
|
|
||||||
}{%
|
|
||||||
\avr@error{MEM unequal: #2 != \@@MEM}%
|
|
||||||
}%
|
|
||||||
}
|
|
||||||
|
|
||||||
\def\avr@test@UDR#1{% Tests UDR output
|
|
||||||
\ifdefstring{\avr@UDR}{#1}{%Success
|
|
||||||
}{%
|
|
||||||
\avr@error{UDR unequal: #1 != \avr@UDR}%
|
|
||||||
}%
|
|
||||||
\def\avr@UDR{}%
|
|
||||||
}
|
|
||||||
|
|
||||||
|
\begin{document}
|
||||||
|
\makeatletter
|
||||||
% Hook Macro for the tests
|
% Hook Macro for the tests
|
||||||
\def\avr@test{}
|
\def\avr@test{}
|
||||||
|
|
||||||
@ -532,9 +498,14 @@
|
|||||||
}
|
}
|
||||||
\preto\avr@test{\avr@test@ADIW}
|
\preto\avr@test{\avr@test@ADIW}
|
||||||
|
|
||||||
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
% Run the test-suite
|
||||||
|
|
||||||
|
\avr@test
|
||||||
|
|
||||||
|
\end{document}
|
||||||
%%% Local Variables:
|
%%% Local Variables:
|
||||||
%%% mode: latex
|
%%% mode: latex
|
||||||
%%% TeX-master: "avr.tex"
|
%%% TeX-master: t
|
||||||
%%% End:
|
%%% End:
|
||||||
|
|
8
source/test-suite/HEADER
Normal file
8
source/test-suite/HEADER
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
\documentclass{article}
|
||||||
|
|
||||||
|
\usepackage{avremu}
|
||||||
|
|
||||||
|
\errorcontextlines=23
|
||||||
|
|
||||||
|
\begin{document}
|
||||||
|
\makeatletter
|
@ -9,34 +9,23 @@
|
|||||||
|
|
||||||
#include <avr/io.h>
|
#include <avr/io.h>
|
||||||
|
|
||||||
#define SET_DRAW_COLOR 1
|
#define CMD_COLOR 1
|
||||||
#define SET_FILL_COLOR 2
|
#define CMD_DOT 2
|
||||||
#define SET_ALL_COLOR 3
|
|
||||||
|
|
||||||
#define CMD_RECTANGLE 4
|
|
||||||
#define CMD_SHORT_RECTANGLE 5
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static
|
static
|
||||||
void setcolor(uint8_t color, uint8_t r, uint8_t g, uint8_t b) {
|
void setcolor(uint8_t r, uint8_t g, uint8_t b) {
|
||||||
TWDR = r;
|
TWDR = r;
|
||||||
TWDR = g;
|
TWDR = g;
|
||||||
TWDR = b;
|
TWDR = b;
|
||||||
TWAR = color;
|
TWAR = CMD_COLOR;
|
||||||
}
|
|
||||||
|
|
||||||
static
|
|
||||||
void rectangle(uint8_t x, uint8_t y, uint8_t w, uint8_t h) {
|
|
||||||
TWDR = x, TWDR = y;
|
|
||||||
TWDR = w, TWDR = h;
|
|
||||||
TWAR = CMD_RECTANGLE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
void dot(uint8_t x, uint8_t y) {
|
void dot(uint8_t x, uint8_t y) {
|
||||||
TWDR = x, TWDR = y;
|
TWDR = x, TWDR = y;
|
||||||
TWAR = CMD_SHORT_RECTANGLE;
|
TWAR = CMD_DOT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -67,33 +56,37 @@ char color_B[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
|||||||
int main() {
|
int main() {
|
||||||
|
|
||||||
float x,xx,y,cx,cy;
|
float x,xx,y,cx,cy;
|
||||||
uint16_t iteration;
|
uint8_t iteration;
|
||||||
uint8_t hx,hy;
|
uint8_t hx,hy;
|
||||||
const uint8_t itermax = 100; /* how many iterations to do */
|
#define itermax 100 /* how many iterations to do */
|
||||||
float magnify=2.0; /* no magnification */
|
#define magnify 4.0 /* no magnification */
|
||||||
uint8_t hxres = 20; /* horizonal resolution */
|
#define hxres 128 /* horizonal resolution */
|
||||||
uint8_t hyres = 20; /* vertical resolution */
|
#define hyres 128 /* vertical resolution */
|
||||||
uint8_t i;
|
#define ydelta 0
|
||||||
|
#define xdelta -0.75
|
||||||
|
|
||||||
|
uint8_t i;
|
||||||
for (hy=1;hy<=hyres;hy++) {
|
for (hy=1;hy<=hyres;hy++) {
|
||||||
for (hx=1;hx<=hxres;hx++) {
|
for (hx=1;hx<=hxres;hx++) {
|
||||||
cx = (((float)hx)/((float)hxres)-0.5)/magnify*3.0-0.7;
|
cx = (((float)hx)/((float)hxres)-0.5)/magnify*3.0-0.7;
|
||||||
cy = (((float)hy)/((float)hyres)-0.5)/magnify*3.0;
|
cy = (((float)hy)/((float)hyres)-0.5)/magnify*3.0;
|
||||||
|
cx += xdelta;
|
||||||
|
cy += ydelta;
|
||||||
x = 0.0; y = 0.0;
|
x = 0.0; y = 0.0;
|
||||||
for (iteration=1;iteration<itermax;iteration++) {
|
for (iteration=1; iteration < itermax; iteration++) {
|
||||||
xx = x*x-y*y+cx;
|
xx = x*x-y*y+cx;
|
||||||
y = 2.0*x*y+cy;
|
y = 2.0*x*y+cy;
|
||||||
x = xx;
|
x = xx;
|
||||||
if (x*x+y*y>100.0) {
|
if (x*x+y*y>128.0){
|
||||||
i = iteration;
|
i = iteration;
|
||||||
iteration = 0xff;
|
iteration = itermax + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (iteration<0xff) {
|
// Print a dot
|
||||||
setcolor(SET_ALL_COLOR, 0,0,0);
|
if (iteration<itermax+1) {
|
||||||
|
setcolor(0,0,0);
|
||||||
} else {
|
} else {
|
||||||
setcolor(SET_ALL_COLOR,
|
setcolor(color_R[i],
|
||||||
color_R[i],
|
|
||||||
color_G[i],
|
color_G[i],
|
||||||
color_B[i]);
|
color_B[i]);
|
||||||
}
|
}
|
||||||
@ -105,18 +98,36 @@ int main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
check-name: Complex Memory Operations
|
check-name: Mandelbrot Set
|
||||||
|
compiler-opts: -O3
|
||||||
check-long: 1
|
check-long: 1
|
||||||
check-start:
|
check-start:
|
||||||
\def\avr@debug#1{}
|
\def\avr@debug#1{}
|
||||||
|
|
||||||
|
\newcommand{\mydot}[3]{%
|
||||||
|
\definecolor{avrfill}{RGB}{#3}%
|
||||||
|
\node[minimum size = 1mm,%
|
||||||
|
anchor=north west,
|
||||||
|
inner sep=0,
|
||||||
|
draw=avrfill,fill=avrfill]
|
||||||
|
at (#1 mm,#2 mm) {};%
|
||||||
|
}
|
||||||
|
|
||||||
\avr@instr@run
|
\avr@instr@run
|
||||||
|
|
||||||
\avrdrawcanvas
|
% Dump to .dat file
|
||||||
|
\newwrite\coords
|
||||||
|
\openout\coords=\jobname.coords.dat
|
||||||
|
\newcommand{\mydump}[3]{%
|
||||||
|
\edef\@tempa{#1,#2,#3}%
|
||||||
|
\expandafter\write\expandafter\coords\expandafter{\@tempa}%
|
||||||
|
}
|
||||||
|
\avrdrawiter{\mydump}
|
||||||
|
\closeout\coords
|
||||||
|
|
||||||
\newwrite\commentfile
|
\begin{tikzpicture}[every node/.style={draw}]
|
||||||
\openout\commentfile=\jobname.tikz.tex
|
\avrdrawiter{\mydot}
|
||||||
\write\commentfile{\avr@draw@canvas}
|
\end{tikzpicture}
|
||||||
\closeout\commentfile
|
|
||||||
|
|
||||||
check-end:
|
check-end:
|
||||||
*/
|
*/
|
@ -16,6 +16,7 @@ ok_tests=0
|
|||||||
ko_tests=0
|
ko_tests=0
|
||||||
known_ko_tests=0
|
known_ko_tests=0
|
||||||
|
|
||||||
|
|
||||||
# defaults to not verbose
|
# defaults to not verbose
|
||||||
[ -z "$V" ] && V=0
|
[ -z "$V" ] && V=0
|
||||||
|
|
||||||
@ -105,7 +106,7 @@ do_test()
|
|||||||
|
|
||||||
|
|
||||||
# grab the actual output & exit value
|
# grab the actual output & exit value
|
||||||
pdflatex -halt-on-error -shell-escape "$file".tex 1> $file.output 2> $file.error
|
stdbuf -oL pdflatex -halt-on-error -shell-escape "$file".tex 1> $file.output 2> $file.error
|
||||||
actual_exit_value=$?
|
actual_exit_value=$?
|
||||||
rm -f *.log *.aux
|
rm -f *.log *.aux
|
||||||
|
|
18
tests/HEADER
18
tests/HEADER
@ -1,18 +0,0 @@
|
|||||||
\documentclass{article}
|
|
||||||
\usepackage{etoolbox}
|
|
||||||
\usepackage{tabularx}
|
|
||||||
|
|
||||||
\makeatletter
|
|
||||||
\errorcontextlines=23
|
|
||||||
|
|
||||||
\input{../avr.numbers}
|
|
||||||
\input{../avr.binary}
|
|
||||||
\input{../avr.bitops}
|
|
||||||
\input{../avr.memory}
|
|
||||||
\input{../avr.instr}
|
|
||||||
\input{../avr.io}
|
|
||||||
\input{../avr.testsuite}
|
|
||||||
\input{../avr.draw}
|
|
||||||
|
|
||||||
\begin{document}
|
|
||||||
\makeatletter
|
|
File diff suppressed because one or more lines are too long
99
tex/latex/avremu/avr.draw.tex
Normal file
99
tex/latex/avremu/avr.draw.tex
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
|
||||||
|
% We define 2 IO Registers to communicate from AVR to the Drawing
|
||||||
|
% mechanism
|
||||||
|
|
||||||
|
\usepackage{tikz}
|
||||||
|
|
||||||
|
|
||||||
|
\newcount\avr@draw@x
|
||||||
|
\newcount\avr@draw@y
|
||||||
|
\newcount\avr@draw@maxx
|
||||||
|
\newcount\avr@draw@maxy
|
||||||
|
|
||||||
|
\def\avr@draw@init{%
|
||||||
|
\avr@draw@maxx = 0%
|
||||||
|
\avr@draw@maxy = 0%
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
% TWAR
|
||||||
|
\newcount\avr@draw@argc
|
||||||
|
\csdef{avr@io@000010@set}#1{%
|
||||||
|
\avr@bin@tocount{#1}{\avr@accA}%
|
||||||
|
\avr@log{DRAW CMD: \the\avr@accA}%
|
||||||
|
\avr@draw@command{\the\avr@accA}%
|
||||||
|
\avr@draw@argc = 0\relax
|
||||||
|
}
|
||||||
|
|
||||||
|
\csdef{avr@io@000011@set}#1{%
|
||||||
|
\avr@bin@tocount{#1}{\avr@accA}%
|
||||||
|
\avr@debug{AVR DRAW PUSH: \the\avr@accA}%
|
||||||
|
\csxdef{avr@draw@stack@\the\avr@draw@argc}{\the\avr@accA}%
|
||||||
|
\advance\avr@draw@argc by 1\relax
|
||||||
|
}
|
||||||
|
|
||||||
|
\def\avr@draw@stack#1{\csuse{avr@draw@stack@#1}}
|
||||||
|
|
||||||
|
|
||||||
|
\def\avr@draw@command#1{%
|
||||||
|
\ifcsdef{avr@draw@command@#1}{%
|
||||||
|
\csuse{avr@draw@command@#1}%
|
||||||
|
}{%
|
||||||
|
\avr@error{AVR DRAW: Unkown Command #1}%
|
||||||
|
}%
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
% Draw Commands
|
||||||
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
\csdef{avr@draw@command@0}{} % NOP
|
||||||
|
|
||||||
|
% Set Color
|
||||||
|
\def\avr@draw@color{0,0,0}
|
||||||
|
\csdef{avr@draw@command@1}{%
|
||||||
|
\ifnum \avr@draw@argc < 3%
|
||||||
|
\avr@debug{DRAW: Set Draw COLOR, Not enough arguments}%
|
||||||
|
\fi%
|
||||||
|
\xdef\avr@draw@color{\avr@draw@stack{0},\avr@draw@stack{1},\avr@draw@stack{2}}%
|
||||||
|
}
|
||||||
|
|
||||||
|
% Small Rectangle
|
||||||
|
\csdef{avr@draw@command@2}{%
|
||||||
|
\ifnum \avr@draw@argc < 2%
|
||||||
|
\avr@debug{DRAW: Dot, Not enough arguments (2 required)}%
|
||||||
|
\fi%
|
||||||
|
\edef\@@X{\avr@draw@stack{0}}%
|
||||||
|
\edef\@@Y{\avr@draw@stack{1}}%
|
||||||
|
\ifnum \@@X > \avr@draw@maxx%
|
||||||
|
\avr@draw@maxx=\@@X%
|
||||||
|
\fi%
|
||||||
|
\ifnum \@@Y > \avr@draw@maxy%
|
||||||
|
\avr@draw@maxy=\@@Y%
|
||||||
|
\fi%
|
||||||
|
\csxdef{avr@draw@\@@X @\@@Y}{\avr@draw@color}%
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
\newcommand{\avrdrawiter}[1]{%
|
||||||
|
\avr@draw@x=0%
|
||||||
|
\loop%
|
||||||
|
\unless\ifnum \avr@draw@x > \avr@draw@maxx
|
||||||
|
\avr@draw@y=0%
|
||||||
|
{\loop%
|
||||||
|
\unless\ifnum \avr@draw@y > \avr@draw@maxy
|
||||||
|
\ifcsdef{avr@draw@\the\avr@draw@x @\the\avr@draw@y}{%
|
||||||
|
#1{\the\avr@draw@x}{\the\avr@draw@y}{\csuse{avr@draw@\the\avr@draw@x @\the\avr@draw@y}}%
|
||||||
|
}{}%
|
||||||
|
\advance \avr@draw@y by 1\relax%
|
||||||
|
\repeat}%
|
||||||
|
\advance \avr@draw@x by 1\relax%
|
||||||
|
\repeat%
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
%%% Local Variables:
|
||||||
|
%%% mode: latex
|
||||||
|
%%% TeX-master: "avr.tex"
|
||||||
|
%%% End:
|
@ -3,7 +3,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
\def\avr@debug#1{%
|
\def\avr@debug#1{%
|
||||||
\typeout{\the\avr@pc: #1}%
|
\typeout{\the\avr@instr@executed:\the\avr@pc: #1}%
|
||||||
}
|
}
|
||||||
|
|
||||||
\def\avr@error#1{%
|
\def\avr@error#1{%
|
||||||
@ -12,9 +12,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
\newif\ifavrbreak
|
||||||
|
\avrbreakfalse
|
||||||
\newcount\avr@instr@executed
|
\newcount\avr@instr@executed
|
||||||
\def\avr@instr@init{%
|
\def\avr@instr@init{%
|
||||||
\avr@instr@executed=0%
|
\avr@instr@executed=0%
|
||||||
|
\avrbreakfalse%
|
||||||
}
|
}
|
||||||
|
|
||||||
% Execution Engine
|
% Execution Engine
|
||||||
@ -1053,6 +1056,7 @@
|
|||||||
\csdef{avr@instr@1001010110011000}\@nnil{%
|
\csdef{avr@instr@1001010110011000}\@nnil{%
|
||||||
\avr@debug{BREAK: (\the\avr@instr@executed) instructions}%
|
\avr@debug{BREAK: (\the\avr@instr@executed) instructions}%
|
||||||
\avr@instr@steps=0\relax%
|
\avr@instr@steps=0\relax%
|
||||||
|
\avrbreaktrue%
|
||||||
\avr@pc@inc%
|
\avr@pc@inc%
|
||||||
}
|
}
|
||||||
|
|
44
tex/latex/avremu/avr.testsuite.tex
Normal file
44
tex/latex/avremu/avr.testsuite.tex
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
%% These Functions are used within the test-suite
|
||||||
|
|
||||||
|
\def\avr@test@setup#1{%
|
||||||
|
\typeout{---- Test: #1 ----}%
|
||||||
|
\typeout{-> Initialize the AVR}%
|
||||||
|
\avr@init%
|
||||||
|
}
|
||||||
|
|
||||||
|
\def\avr@test@SREG#1{% Tests SREG for value
|
||||||
|
\avr@sreg@get{\@@SREG}%
|
||||||
|
\expandafter\ifstrequal\expandafter{\@@SREG}{#1}{%Success
|
||||||
|
}{%
|
||||||
|
\avr@error{SREG unequal: #1 != \@@SREG}%
|
||||||
|
}%
|
||||||
|
}
|
||||||
|
|
||||||
|
\def\avr@test@REG#1#2{% Tests SREG for value
|
||||||
|
\avr@reg@get{\csuse{avr@#1}}{\@@REG}%
|
||||||
|
\expandafter\ifstrequal\expandafter{\@@REG}{#2}{%Success
|
||||||
|
}{%
|
||||||
|
\avr@error{REG unequal: #2 != \@@REG}%
|
||||||
|
}%
|
||||||
|
}
|
||||||
|
|
||||||
|
\def\avr@test@MEM#1#2{% Tests MEM for value
|
||||||
|
\avr@mem@get{#1}{\@@MEM}%
|
||||||
|
\expandafter\ifstrequal\expandafter{\@@MEM}{#2}{%Success
|
||||||
|
}{%
|
||||||
|
\avr@error{MEM unequal: #2 != \@@MEM}%
|
||||||
|
}%
|
||||||
|
}
|
||||||
|
|
||||||
|
\def\avr@test@UDR#1{% Tests UDR output
|
||||||
|
\ifdefstring{\avr@UDR}{#1}{%Success
|
||||||
|
}{%
|
||||||
|
\avr@error{UDR unequal: #1 != \avr@UDR}%
|
||||||
|
}%
|
||||||
|
\def\avr@UDR{}%
|
||||||
|
}
|
||||||
|
|
||||||
|
%%% Local Variables:
|
||||||
|
%%% mode: latex
|
||||||
|
%%% TeX-master: "avr.tex"
|
||||||
|
%%% End:
|
10
tex/latex/avremu/avremu.sty
Normal file
10
tex/latex/avremu/avremu.sty
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
\RequirePackage{etoolbox}
|
||||||
|
\RequirePackage{tabularx}
|
||||||
|
|
||||||
|
\input{avr.numbers}
|
||||||
|
\input{avr.binary}
|
||||||
|
\input{avr.bitops}
|
||||||
|
\input{avr.memory}
|
||||||
|
\input{avr.instr}
|
||||||
|
\input{avr.io}
|
||||||
|
\input{avr.testsuite}
|
Loading…
Reference in New Issue
Block a user