t-crest / patmos

Patmos is a time-predictable VLIW processor, and the processor for the T-CREST project
http://patmos.compute.dtu.dk
BSD 2-Clause "Simplified" License
135 stars 72 forks source link

Generating Aegean/t-crest makes the emulator build fail #16

Closed henrikh closed 5 years ago

henrikh commented 7 years ago

Running make platform in Aegean generates the multi-core system. A side effect is that make emulator fails in Patmos.

The file patmos/hardware/emulator_config.h is generated by the Aegean build process and makes the build fail by taking precedence over the correct configuration file (in patmos/hardware/build/).

The configuration file is generated by patmos/hardware/src/patmos/Config.scala at line 254. The patmos generation is for some reason run with the cpp backend, but without a configured memory. This messes up the generated configuration header.

Work around: Delete patmos/hardware/emulator_config.h and run make emulator

schoeberl commented 7 years ago

Maybe the best fix would be that the Aegean generation would do the cleanup and remove that .h file after build.

Cheers, Martin

On 19 Jul, 2017, at 15:56, Henrik Enggaard notifications@github.com wrote:

Running make platform in Aegean generates the multi-core system. A side effect is that make emulator fails in Patmos.

The file patmos/hardware/emulator_config.h is generated by the Aegean build process and makes the build fail by taking precedence over the correct configuration file (in patmos/hardware/build/).

The configuration file is generated by patmos/hardware/src/patmos/Config.scala at line 254. The patmos generation is for some reason run with the cpp backend, but without a configured memory. This messes up the generated configuration header.

Work around: Delete patmos/hardware/emulator_config.h and run make emulator

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/t-crest/patmos/issues/16, or mute the thread https://github.com/notifications/unsubscribe-auth/AAntmONnrt9W6UBE80ei9x0RmvXpKD7Kks5sPgr1gaJpZM4OcxEc.

henrikh commented 7 years ago

I dug some more into it today and I have found the cause and a possible solution. The check for which backend is used is run before the backend has been determined.

In patmos/hardware/src/patmos/Patmos.scala:

Config.loadConfig(configFile, backend)
[...]
chiselMain(chiselArgs, () => Module(new PatmosCore(binFile)))

loadConfig is responsible for generating emulator_config.h. This is done by checking the backend:

if (Driver.backend.isInstanceOf[CppBackend]) {
  val emuConfig = Driver.createOutputFile("emulator_config.h")
  [...]
}

Here comes the catch. Driver.backend is first set when running chiselMain, which will only happen later in Patmos.scala.

A solution would be to parse the command line arguments before chiselMain or to figure out if header generation could run after chiselMain.

schoeberl commented 7 years ago

As a work-around for the time being delete emulator_config.h in the folder t-crest/patmos/hardware/build and the correct one will be generated when building the emulator from within the Patmos source tree.

We will solve this issue when we have a Chisel top component for the multicore version of Patmos. Hopefully soon.

schoeberl commented 7 years ago

Within Patmos a make clean will remove the offending left over. Still a workaround until the Chisel top level is done.

schoeberl commented 5 years ago

As of today, we will not use Aegean anymore. It is substituted by a Chisel based wrapper. Solved the issue.