Problem F
R1: Control Flow
This is the $2$nd of $4$ steps in the SRE problem. The complete problem specification is on the NSA Cyber Challenge website.
Encoding
The input lines are binary data encoded as a string using the “hexlify” method (named for the way Python implements it in the binascii module). The binary $16$-bit unsigned integer represented in hexadecimal as 0xBEEF would simply be converted into an ASCII string “beef” (always use lower-case letters). The most significant bytes come first.
Input
The input is a binary MARIE program image represented as a series of hexadecimal strings. Each line will contain one string (a $16$-bit word) for each memory location. There will be less than or equal to $4\, 096$ lines.
Output
Your output must be the same as in Problem R0, except that there must be an additional blank line separating each basic block. Furthermore, at the end of each block there must be a line specifying the possible addresses of the next instruction, i.e., the outbound edges from that block’s node.
Memory values should be output as $4$ zero-padded hexadecimal digits. Addresses (and immediate operands) should be output as $3$ zero-padded hexadecimal digits.
Sample Input 1 | Sample Output 1 |
---|---|
a000 5000 8800 9007 300a 200a 9001 100a 6000 7000 0000 |
000: Clear Next: [001] 001: Input 002: Skipcond 800 Next: [003, 004] 003: Jump 007 Next: [007] 004: Add 00a 005: Store 00a 006: Jump 001 Next: [001] 007: Load 00a 008: Output 009: Halt Next: [] |