1

to;dr; What tools or smart method can I use to derive a state (transition) overview from source code with 10 binary and three 16-bit input variables, and several output variables, both 16-bit and binary. All input variables can change with every 33ms execution of the source, which has several hidden states.

Background

I have been tasked to write a functional description of a 20+ year old embedded product. The source code is available, but is written in a long forgotten language, resembling basic.

The source itself is written in an extremely naïve way, with hundredst of long if statements, and no function calls at all. All internal variables are global.

Attempts

I quickly lost track of attempting to make sense of the source code, which is running in a never ending 33ms loop, and variables are used and modified anywhere in the 1000+ lines of code.

I decided to try to emulate the entire hardware, and due to the simplicity of the code, it turned out to be very simple to convert to python. I'm now able to predifine some timed changes in the input variables then execute the code for a number of simulated seconds, generating a number of output lines with the end result of each 33ms execution.

The emulated approach is working, but I need to spend a very long time to craft the timed inputs based on the generated output. I've currently identified at lease 16 major states, each treating the other inputs differently.

The question

How can I do this smarter, preferable automated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.