short- arithmetic operations
+addition-subtraction*multiplication/division%modulo
- assignments
=assignment++increment--decrement- combined
+=, -=, ...
- comparisons
==equals!=not equals>greater than<less than>=greater or equal than<=less or equal than
- propositional logic
!not&&and||or
- bit manipulation
&bitwise AND|bitwise OR^bitwise XOR~bitwise NOT<<shift bitwise left>>shift bitwise right
- other
?conditional operator
- arithmetic operations
float- arithmetic operations
+addition-subtraction*multiplication/division
- arithmetic operations
- data types
voidshortfloat
- conditional execution
if, else if, elseswitch case
- loops
forwhiledo while
- jumps
returnbreak
- function calls
- function definitions
- global variables
- constants
- code blocks
{ ... }
There is no need for an include directive to use the following functions.
short GetSW();returns value of switches SW15 ... SW0short GetKEY0();returns value of button KEY0short GetKEY1();returns value of button KEY1void SetLEDR(short value);sets LEDR(15 ... 0) to valuevoid SetHEX0(short value);sets HEX0 to value (without conversion)void SetHEX1(short value);sets HEX1 to value (without conversion)void SetHEX2(short value);sets HEX2 to value (without conversion)void SetHEX3(short value);sets HEX3 to value (without conversion)void SetHEX4(short value);sets HEX4 to value (without conversion)void SetHEX5(short value);sets HEX5 to value (without conversion)void SetHEX6(short value);sets HEX6 to value (without conversion)void SetHEX7(short value);sets HEX7 to value (without conversion)
short main()
{
short a = GetLEDR();
SetLEDR(a);
float b = 12.5;
short c = b; // automatic typecast -> c = 12
return 0;
}
python3 main.py optimization_level input_file input_file: must have .c ending optimization_level: fake, not used The output file is determined by changing the input_file ending to .asm Example: python3 main.py 0 main.c
- 09.01.2020 [Sebastian Bräske, Manuel Bloedow, Matthias Rosenthal]
- fixed bug with new pycparser which cased compilation fail
- fixed bug when requesting value of key0 or key1
- added support of new HC 3 float <-> short conversion
- added possibility for loading float numbers via
LUI + LLI - refactored code
(c) Technische Hochschule Mittelhessen