CODESYS Bachelor- / Master Thesis Projects

Bachelor / Master Thesis Projects

Bachelor or Master Thesis: Compiler directive for likeliness

Definition of problem

CODESYS is a hardware-independent programming system for programmable logic controllers. The IEC 61131-3-compliant programming languages used are translated into processor-specific code. There are currently code generator backends for more than 10 CPUs for CODESYS.

Today's CPUs have deep pipelines to load and process commands long before they are actually executed. In conditional jumps, these CPUs use simple heuristics to determine which path is the most likely to be processed.

Incorrect heuristics can lead to very poor performance because the pipeline may have to be completely purged and refilled.

An efficient compiler can exploit these properties of a CPU to generate faster code when the probability of a condition being met is known. It would be very helpful to implement a directive that allows the programmer to set the probability of a condition. For example, this kind of directive could look something like this:

IF (__UNLIKELY(x > 100000)) THEN
         LOG_Message(‘Variable too big’);
ELSIF (__LIKELY(x < 100)) THEN
          // do this
         // do that

In addition to IF-ELSIF statements, there are also conditional calls, conditional jumps, and conditional return statements in the graphical languages of IEC 61131-3. These should also be optimized with the __LIKELY directive.

Objective of the thesis

A directive as described above shall be implemented and integrated into the CODESYS compiler. Furthermore, the work shall investigate how this directive can be used on the different CPU architectures (Intel Pentium, ARM, PowerPC, possibly SH, MIPS, and others) and which performance enhancements can be achieved.

The bachelor thesis may be expanded into a master thesis by developing a runtime analysis that measures the rate at which a condition applies in order to optimize the code with __LIKELY / __UNLIKELY directives in a second compile run.

Duration: up to 6 months
Remuneration: yes
Hours per week: 40
Application reference: Compiler student

Information and application:
Human Resources, Ms. Sabine Panzer

What we offer

We offer:

  • Challenging tasks and projects
  • Individual support and on-the-job training
  • Friendly working atmosphere
  • Opportunity of a permanent job offer after successful completion of your studies


  • Ongoing studies in computer science or electrical engineering
  • Interest and commitment
  • Motivation to work independently
  • Accurate and reliable working style

Duration: The time period of the thesis depends on the study regulations.
Hours per week: 40
Starting date: according to agreement