From 6c75757f8ea0b1bd79576ba3e2dfb01f3d980997 Mon Sep 17 00:00:00 2001 From: jackbackrack Date: Wed, 29 Apr 2015 14:02:20 -0700 Subject: update to latest firrtl and change flo-app to flo2app --- bin/appall.sh | 2 +- bin/build.sh | 2 +- bin/flo-app.sh | 8 -------- bin/flo2app.sh | 8 ++++++++ src/main/scala/Core.scala | 13 +++++++------ 5 files changed, 17 insertions(+), 16 deletions(-) delete mode 100755 bin/flo-app.sh create mode 100755 bin/flo2app.sh diff --git a/bin/appall.sh b/bin/appall.sh index 112b612b..d8fa6a61 100755 --- a/bin/appall.sh +++ b/bin/appall.sh @@ -3,5 +3,5 @@ shift 1 for file in "$@"; do echo $file - (cd generated; ../bin/flo-app.sh $file >& $file.appout) + (cd generated; ../bin/flo2app.sh $file >& $file.appout) done diff --git a/bin/build.sh b/bin/build.sh index df7ca53c..badb8f97 100755 --- a/bin/build.sh +++ b/bin/build.sh @@ -3,4 +3,4 @@ DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) to-fir $1 (cd generated; $DIR/fir2flo.sh $1) -(cd generated; $DIR/flo-app $1) +(cd generated; $DIR/flo2app $1) diff --git a/bin/flo-app.sh b/bin/flo-app.sh deleted file mode 100755 index bac47702..00000000 --- a/bin/flo-app.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -flo-llvm $1.flo -echo FLO-LLVM DONE -flo-llvm-release $1.flo --harness > $1-harness.cpp -echo FLO-LLVM-RELEASE DONE -g++ -o $1 $1-harness.cpp $1.o -echo GPP DONE diff --git a/bin/flo2app.sh b/bin/flo2app.sh new file mode 100755 index 00000000..bac47702 --- /dev/null +++ b/bin/flo2app.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +flo-llvm $1.flo +echo FLO-LLVM DONE +flo-llvm-release $1.flo --harness > $1-harness.cpp +echo FLO-LLVM-RELEASE DONE +g++ -o $1 $1-harness.cpp $1.o +echo GPP DONE diff --git a/src/main/scala/Core.scala b/src/main/scala/Core.scala index e70d88de..430dfb9e 100644 --- a/src/main/scala/Core.scala +++ b/src/main/scala/Core.scala @@ -169,7 +169,7 @@ case class Slot(val imm: Immediate, val name: String) extends Immediate { case class Index(val imm: Immediate, val value: Int) extends Immediate { def name = "." + value def fullname = { - imm.fullname + "." + value + imm.fullname + "[" + value + "]" } } @@ -1188,7 +1188,7 @@ class Emitter { def emit(e: Width): String = { e match { case e: UnknownWidth => "" - case e: IntWidth => "(" + e.value.toString + ")" + case e: IntWidth => "<" + e.value.toString + ">" } } def emitType(e: Kind): String = { @@ -1201,9 +1201,10 @@ class Emitter { } } def emit(e: Command): String = { + def maybeWidth (w: Int) = if (w == -1) "" else ("<" + w + ">") e match { - case e: DefUInt => "node " + e.name + " = UInt(" + e.value + (if (e.width == -1) "" else ", " + e.width) + ")" - case e: DefSInt => "node " + e.name + " = SInt(" + e.value + (if (e.width == -1) "" else ", " + e.width) + ")" + case e: DefUInt => "node " + e.name + " = UInt" + maybeWidth(e.width) + "(" + e.value + ")" + case e: DefSInt => "node " + e.name + " = SInt" + maybeWidth(e.width) + "(" + e.value + ")" case e: DefFlo => "node " + e.name + " = Flo(" + e.value + ")" case e: DefDbl => "node " + e.name + " = Dbl(" + e.value + ")" case e: DefPrim => "node " + e.name + " = " + emit(e.op) + "(" + join(e.args.map(x => emit(x)) ++ e.lits.map(x => x.toString), ", ") + ")" @@ -1223,8 +1224,8 @@ class Emitter { case e: Begin => join0(e.body.map(x => emit(x)), newline) case e: Connect => emit(e.loc) + " := " + emit(e.exp) case e: ConnectPad => emit(e.loc) + " := Pad(" + emit(e.exp) + ",?)" - case e: ConnectInit => emit(e.loc) + ".init := Pad(" + emit(e.exp) + ",?)" - case e: ConnectInitIndex => emit(e.loc) + ".init." + e.index + " := Pad(" + emit(e.exp) + ",?)" + case e: ConnectInit => "on-reset " + emit(e.loc) + " := Pad(" + emit(e.exp) + ",?)" + case e: ConnectInitIndex => "on-reset " + emit(e.loc) + "[" + e.index + "] := Pad(" + emit(e.exp) + ",?)" case e: EmptyCommand => "skip" } } -- cgit v1.2.3