1
0
mirror of synced 2024-11-22 13:04:23 +01:00
This commit is contained in:
Christian Dietrich 2014-09-28 23:41:36 +02:00
parent d59eab62e6
commit 8af57575ef
2 changed files with 42 additions and 16 deletions

View File

@ -16,6 +16,7 @@
%\avr@reg@get{\csuse{avr@r28}}{\@@B}% %\avr@reg@get{\csuse{avr@r28}}{\@@B}%
%\avr@reg@get{\csuse{avr@r29}}{\@@C}% %\avr@reg@get{\csuse{avr@r29}}{\@@C}%
%\avr@debug{{r24=\@@A} {r28=\@@B} {r29=\@@C}}% %\avr@debug{{r24=\@@A} {r28=\@@B} {r29=\@@C}}%
\avr@debug{\avr@instr@current}%
% Dispatch Instruction by prefix % Dispatch Instruction by prefix
\expandafter\avr@instr@dispatch\avr@instr@current\@nnil% \expandafter\avr@instr@dispatch\avr@instr@current\@nnil%
\relax% \relax%
@ -853,16 +854,16 @@
\avr@bin@tocount{{\avr@bit@negate #3}#3#1#2#8}{\avr@addr}% \avr@bin@tocount{{\avr@bit@negate #3}#3#1#2#8}{\avr@addr}%
\def\avr@RD{1#4#5#6#7}% \def\avr@RD{1#4#5#6#7}%
} }
\csdef{avr@instr@10010}#1\@nnil{% \csdef{avr@instr@10100}#1\@nnil{%
\avr@instr@LDSTS#1\@nnil% \avr@instr@LDSTS#1\@nnil%
\avr@debug{LDS - \avr@RD <- (\the\avr@addr)}% \avr@debug{LDSS - \avr@RD <- (\the\avr@addr)}%
\avr@mem@get{\the\avr@addr}{\@@value}% \avr@mem@get{\the\avr@addr}{\@@value}%
\avr@reg@set{\@@value}{\avr@RD}% \avr@reg@set{\@@value}{\avr@RD}%
\avr@pc@inc% \avr@pc@inc%
} }
\csdef{avr@instr@10101}#1\@nnil{% \csdef{avr@instr@10101}#1\@nnil{%
\avr@instr@LDSTS#1\@nnil% \avr@instr@LDSTS#1\@nnil%
\avr@debug{STS - \avr@RD <- (\the\avr@addr)}% \avr@debug{STSS - \avr@RD <- (\the\avr@addr)}%
\avr@reg@get{\avr@RD}{\@@value}% \avr@reg@get{\avr@RD}{\@@value}%
\avr@mem@set{\@@value}{\the\avr@addr}% \avr@mem@set{\@@value}{\the\avr@addr}%
\avr@pc@inc% \avr@pc@inc%
@ -1129,6 +1130,16 @@
\def\avr@instr@SBRC#1#2#3{\avr@code@set{1111110#20#3}{#1}} \def\avr@instr@SBRC#1#2#3{\avr@code@set{1111110#20#3}{#1}}
\def\avr@instr@SBRS#1#2#3{\avr@code@set{1111111#20#3}{#1}} \def\avr@instr@SBRS#1#2#3{\avr@code@set{1111111#20#3}{#1}}
\def\avr@skip@instr@eq#1#2{%
\ifdefstrequal{#1}{#2}{%
\avr@pc@inc%
\avr@instr@length{\the\avr@pc}{\@@length}
\avr@debug{SKIP (\@@length) instruction}%
\avr@pc@add{\@@length}%
}{%
\avr@pc@inc%
}%
}
\csdef{avr@instr@111111}#1#2#3#4#5#6#7\@nnil{% \csdef{avr@instr@111111}#1#2#3#4#5#6#7\@nnil{%
\def\@@required{#1}% 1 if if set \def\@@required{#1}% 1 if if set
\avr@reg@get{#2#3#4#5#6}{\avr@Rr}% \avr@reg@get{#2#3#4#5#6}{\avr@Rr}%
@ -1136,18 +1147,19 @@
\edef\@@bit{\the\avr@count@tmpa}% \edef\@@bit{\the\avr@count@tmpa}%
\avr@bin@getbit{\avr@Rr}{\@@bit}{\@@found}% \avr@bin@getbit{\avr@Rr}{\@@bit}{\@@found}%
\avr@debug{SBR[SC] Skip iff \avr@Rr:\@@bit(\@@found) == \@@required}% \avr@debug{SBR[SC] Skip iff \avr@Rr:\@@bit(\@@found) == \@@required}%
\avr@count@tmpa=\@@found% \avr@skip@instr@eq{\@@required}{\@@found}%
\avr@count@tmpb=\@@required\relax%
\ifnum \avr@count@tmpa = \avr@count@tmpb%
\avr@pc@inc%
\avr@instr@length{\the\avr@pc}{\@@length}
\avr@debug{SKIP (\@@length) instruction}%
\avr@pc@add{\@@length}%
\avr@pc@add{-1}%
\fi%
\avr@pc@inc%
} }
% CPSE - Compare Skip iff Equal
\def\avr@instr@CPSE{\avr@instr@gen@tworegs{000100}}
\csdef{avr@instr@000100}#1#2#3#4#5#6#7\@nnil{%
\avr@reg@get{#1#7}{\avr@Rr}%
\avr@reg@get{#2#3#4#5#6}{\avr@Rd}%
\avr@debug{CPSE - \avr@Rd + \avr@Rr}%
\avr@skip@instr@eq{\avr@Rd}{\avr@Rr}%
}
\def\avr@instr@ASR#1#2{\avr@code@set{1001010#20101}{#1}} \def\avr@instr@ASR#1#2{\avr@code@set{1001010#20101}{#1}}
\csdef{avr@instr@1001010:0101}#1\@nnil{% \csdef{avr@instr@1001010:0101}#1\@nnil{%
\avr@reg@get{#1}{\avr@Rr}% \avr@reg@get{#1}{\avr@Rr}%

View File

@ -453,7 +453,7 @@
\preto\avr@test{\avr@test@SWAP} \preto\avr@test{\avr@test@SWAP}
\def\avr@test@LDSS{% \def\avr@test@LDSS{%
\avr@test@setup{LDS - STS}% \avr@test@setup{LDS - STS (short)}%
\avr@instr@LDI{0}{\csuse{avr@r20}}{00001001}% \avr@instr@LDI{0}{\csuse{avr@r20}}{00001001}%
\avr@instr@STSS{1}{\csuse{avr@r20}}{1101001}% \avr@instr@STSS{1}{\csuse{avr@r20}}{1101001}%
\avr@instr@LDSS{2}{\csuse{avr@r21}}{1101001}% \avr@instr@LDSS{2}{\csuse{avr@r21}}{1101001}%
@ -463,7 +463,7 @@
} }
\preto\avr@test{\avr@test@LDSS} \preto\avr@test{\avr@test@LDSS}
\def\avr@test@LDSS{% \def\avr@test@LDS{%
\avr@test@setup{LDS - STS (long)}% \avr@test@setup{LDS - STS (long)}%
\avr@instr@LDI{0}{\csuse{avr@r20}}{00001001}% \avr@instr@LDI{0}{\csuse{avr@r20}}{00001001}%
\avr@instr@STS{1}{\csuse{avr@r20}}{0000000011111111}% \avr@instr@STS{1}{\csuse{avr@r20}}{0000000011111111}%
@ -475,7 +475,21 @@
\avr@instr@stepn{5}% \avr@instr@stepn{5}%
\avr@test@REG{r21}{00001001} \avr@test@REG{r21}{00001001}
} }
\preto\avr@test{\avr@test@LDSS} \preto\avr@test{\avr@test@LDS}
\def\avr@test@CPSE{%
\avr@test@setup{CPSE}%
\avr@instr@LDI{0}{\csuse{avr@r20}}{00001001}%
\avr@instr@LDI{1}{\csuse{avr@r21}}{00001001}%
\avr@instr@CPSE{2}{\csuse{avr@r20}}{\csuse{avr@r21}}% Skip always
\avr@instr@LDI{3}{\csuse{avr@r21}}{00001111}%
\avr@instr@NOP{4}%
\avr@instr@stepn{4}%
\avr@test@REG{r21}{00001001}
}
\preto\avr@test{\avr@test@CPSE}
%%% Local Variables: %%% Local Variables:
%%% mode: latex %%% mode: latex