How to compile and run a program written in X.


How to Compile

  1. Download and extract this zip file containing the tools you will need.
  2. Open the terminal to this folder and compile the emulator file called 32bitSimulatorForBinaryImage.c by typing gcc 32bitSimulatorForBinaryImage.c (and pressing enter) or using your favourite compiler.
  3. Copy the X compiler binary to a.bin so it can be run by the simulator with
    cp x_to_16bitHex_compiler.bin a.bin
  4. Run the simulator executable, streaming the x source code in to standard input, with ./a.out < io.x. This will produce two files: sim2 and sim3. These are the hex input memory images for the machine.
  5. Now compile 16bitSimulatorForHexImages.c with gcc 16bitSimulatorForHexImages.c.
  6. Run the compiled executable with ./a.out.
Alternatively, run the bash script ./compile <source_code_filename.x> to execute these commands automatically.

How to Run the Executable

There are three options on where to run your executable:
  1. Via C: You can execute the code via the C Simulator as outlined in steps 5 and 6 above.
  2. Via Java: We have implimented a model of the machine in a simulator called ModuleSim. The model for the BigHex Machine can be found via a Github Repo. You can load the ram image files (produced above) in to the memory modules and execute the code inside the simulator.
  3. Via Javascript: We have a Javascript Simulator for the BigHex Machine. Similarly you should use the ram image files produced above) to load the program.

How to run code on the Big Hex Machine

  1. While the Big Hex Machine is running connect to the wifi network "BIGHEX-AP". This does not require any credentials. Please be aware there is a slight delay between the time the machine is turned on and the "bighex" access point appearing.
  2. Open a web browser and type the address:
  3. After the web app has been requested by the browser the 'Big Hex Control Panel' should appear. Click on 'Load an X Program' and then enter your source code into the main text area.
  4. Clicking on the submit button will send your X Program to the machine and compile it. The machine will also automatically load the machine code into the machine's memory - you should see this happening on the machine itself.
  5. Going back to the control panel will then enable you to start the machine executing. You can also change the clock speed to view the process in slow motion.