Permalink
Browse files

Minortweaks (#64)

* minor tweaks & changed travis.yml to work on new travis environment.
  • Loading branch information...
jameshegarty committed Sep 7, 2017
1 parent 4a39bc0 commit 1985513ddd907a450e555f43e42890a333cc388a
Showing with 48 additions and 18 deletions.
  1. +1 −1 .travis.yml
  2. +1 −1 examples/harness.lua
  3. +4 −4 examples/harnessTerra.t
  4. +6 −2 misc/compare/compare.hpp
  5. +1 −1 src/modules.lua
  6. +9 −9 src/rigelSimple.lua
  7. +22 −0 src/rigelhll.lua
  8. +4 −0 src/types.lua
View
@@ -5,7 +5,7 @@ before_install:
# luajit
- sudo apt-get install luajit
- sudo ln -s /usr/bin/luajit-2.0.0-beta9 /usr/bin/luajit
#- sudo ln -s /usr/bin/luajit-2.0.0-beta9 /usr/bin/luajit
# verilator
- sudo apt-get install verilator
View
@@ -347,7 +347,7 @@ function harnessTop(t)
elseif(backend=="isim") then
H.sim( t.outFile, fn, t.inFile, t.tapType, t.tapValue, iover, inputP, t.inSize[1], t.inSize[2], oover, outputP, t.outSize[1], t.outSize[2], t.underflowTest, t.earlyOverride )
elseif backend=="terra" then
H.terraOnly( t.outFile, fn, t.inFile, t.tapType, t.tapValue, iover, inputP, t.inSize[1], t.inSize[2], oover, outputP, t.outSize[1], t.outSize[2], t.underflowTest, t.earlyOverride, t.doHalfTest, t.simCycles, t.harness )
H.terraOnly( t.outFile, fn, t.inFile, t.tapType, t.tapValue, iover, inputP, t.inSize[1], t.inSize[2], oover, outputP, t.outSize[1], t.outSize[2], t.underflowTest, t.earlyOverride, t.doHalfTest, t.simCycles, t.harness, t.ramFile )
else
print("unknown build target "..arg[1])
assert(false)
View
@@ -6,7 +6,7 @@ local fixed = require "fixed"
local types = require("types")
local J = require "common"
local terraWrapper = J.memoize(function(fn,inputFilename,inputType,tapType,outputFilename,outputType,id,harnessoption)
local terraWrapper = J.memoize(function(fn,inputFilename,inputType,tapType,outputFilename,outputType,id,harnessoption,ramFile)
local out
local inpSymb
@@ -40,7 +40,7 @@ local terraWrapper = J.memoize(function(fn,inputFilename,inputType,tapType,outpu
if harnessoption==2 then
dram = R.instantiateRegistered("dram", RM.dram( types.array2d(types.int(32),4,4),10,"dot_dist.raw"))
dram = R.instantiateRegistered("dram", RM.dram( R.extractData(fn.inputType.list[2]),10,ramFile))
table.insert(instances,dram)
local dramData = R.applyMethod("dramData", dram, "load" )
hsfninp = R.concat("hsfninp2",{out,dramData})
@@ -67,7 +67,7 @@ local terraWrapper = J.memoize(function(fn,inputFilename,inputType,tapType,outpu
return RM.lambda( "harness"..id..tostring(fn):gsub('%W','_'), inpSymb, out, instances )
end)
return function(filename, hsfn, inputFilename, tapType, tapValue, inputType, inputT, inputW, inputH, outputType, outputT, outputW, outputH, underflowTest, earlyOverride, doHalfTest, simCycles, harnessoption, X)
return function(filename, hsfn, inputFilename, tapType, tapValue, inputType, inputT, inputW, inputH, outputType, outputT, outputW, outputH, underflowTest, earlyOverride, doHalfTest, simCycles, harnessoption, ramFile, X)
if doHalfTest==nil then doHalfTest=true end
assert(X==nil)
@@ -82,7 +82,7 @@ return function(filename, hsfn, inputFilename, tapType, tapValue, inputType, inp
if i==2 then ext="_half" end
--local f = harnessWrapperFn( hsfn, inputFilename, inputType, tapType, "out/"..filename, "out/"..filename..ext..".terra.raw", outputType, i, inputCount, outputCount, 1, underflowTest, earlyOverride, true )
--local f = terraWrapper{fn=hsfn, inputFilename=inputFilename, outputFilename="out/"..filename..ext..".terra.raw",tapType=tapType, inputType=inputType, outputType=outputType,id=i}
local f = terraWrapper(hsfn,inputFilename,inputType,tapType,"out/"..filename..ext..".terra.raw",outputType,i, harnessoption)
local f = terraWrapper(hsfn,inputFilename,inputType,tapType,"out/"..filename..ext..".terra.raw",outputType,i, harnessoption, ramFile)
f = RM.seqMapHandshake( f, inputType, tapType, tapValue, inputCount, outputCount, false, i, simCycles )
local Module = f:compile()
View
@@ -36,12 +36,12 @@ void writeBytes(string id, int w, int h, string type, int pixels, int bytecnt, u
}
if(state[id].seenPixels>w*h){
printf("Error, more pixels written than expected!\n");
printf("Error, more pixels written than expected! file:%s\n",id.c_str());
//exit(1);
}
if(state[id].w!=w || state[id].h!=h){
printf("Error, image size changed\n");
printf("Error, image size changed file:%s old:%d,%d new:%d,%d\n",id.c_str(),state[id].w,state[id].h,w,h);
}
state[id].seenPixels+=pixels;
@@ -65,6 +65,10 @@ void writePixel(string id, int w, int h, unsigned short value){
writeBytes(id,w,h,"uint16",1,2,(unsigned char*)&value);
}
void writePixel(string id, int w, int h, unsigned int value){
writeBytes(id,w,h,"uint32",1,4,(unsigned char*)&value);
}
void writePixel(string id, int w, int h, float value){
writeBytes(id,w,h,"float",1,4,(unsigned char*)&value);
}
View
@@ -3392,7 +3392,7 @@ modules.fwriteSeq = memoize(function( filename, ty, filenameVerilog )
local res = {kind="fwriteSeq", filename=filename, filenameVerilog=filenameVerilog, type=ty, inputType=ty, outputType=ty, stateful=true, delay=0, sdfInput={{1,1}}, sdfOutput={{1,1}} }
if terralib~=nil then res.terraModule = MT.fwriteSeq(filename,ty) end
res.name = "fwriteSeq_"..verilogSanitize(filename).."_"..verilogSanitize(tostring(ty))
res.name = verilogSanitize("fwriteSeq_"..filename.."_"..tostring(ty))
function res.makeSystolic()
local systolicModule = Ssugar.moduleConstructor(res.name)
View
@@ -396,24 +396,24 @@ function RS.writePixels(input,id,imageSize,V)
TY = input.type
end
local TYY = TY
if TY:isArray() then
TYY = TY:arrayOver()
end
-- local TYY = TY
-- if TY:isArray() then
-- TYY = TY:arrayOver()
-- end
local mod = RS.modules.fwriteSeq{type=TYY, filename="out/dbg_terra_"..id..".raw", filenameVerilog="out/dbg_verilog_"..id..".raw"}
local mod = RS.modules.fwriteSeq{type=TY, filename="out/dbg_terra_"..id..".raw", filenameVerilog="out/dbg_verilog_"..id..".raw"}
if TY:isArray() then
mod = C.linearPipeline{C.index(TY,0),mod,C.arrayop(TYY,1)}
end
-- if TY:isArray() then
-- mod = C.linearPipeline{C.index(TY,0),mod,C.arrayop(TYY,1)}
-- end
if R.isHandshake(input.type) then
mod = RS.HS(mod)
end
--
local file = io.open("out/dbg_"..id..".metadata.lua","w")
file:write("return {width="..tostring(imageSize[1])..",height="..tostring(imageSize[2])..",type='"..tostring(TYY).."'}")
file:write("return {width="..tostring(imageSize[1])..",height="..tostring(imageSize[2])..",type='"..tostring(TY).."'}")
file:close()
--
View
@@ -1,5 +1,6 @@
local RHLL = {}
local R = require "rigel"
local RM = require "modules"
local C = require "examplescommon"
local RS = require "rigelSimple"
local llharness = require "harness"
@@ -116,6 +117,16 @@ local function stripHS(arg)
return {type=arg.type}
end
local function expectHS(arg)
if arg==nil then return {} end -- nullary fn
if R.isHandshake(arg.type) then
return {type=R.extractData(arg.type)}
else
err(false,"Expected handshake input")
end
end
function darkroomIRFunctions:selectStream(i)
err(type(i)=="number",":selectStream expected number")
return RS.selectStream{input=self, index=i}
@@ -210,6 +221,17 @@ function RHLL.linebuffer(t)
return setmetatable({fn=RS.modules.linebuffer, settings=t, wireFn=stripHS, vectorized=true}, SimpleModuleWrapperMT)
end
local fifofn = J.memoize(function(A,size)
local inp = R.input( R.Handshake(A) )
local regs = { R.instantiateRegistered("f1", RM.fifo(A,size) ) }
local out = R.applyMethod("l1",regs[1],"load")
return RM.lambda( "fifohll_"..tostring(A).."_"..tostring(size), inp, R.statements{out, R.applyMethod("s1",regs[1],"store",inp)}, regs )
end)
function RHLL.fifo(size)
return setmetatable({fn=function(t) return fifofn(t.type,t.size) end, settings={size=size}, wireFn=expectHS}, SimpleModuleWrapperMT)
end
function RHLL.filterSeq(t)
local tab = {fn=RS.modules.filterSeq, settings=t}
function tab.wireFn(arg)
View
@@ -789,6 +789,10 @@ function TypeFunctions:toCPUType()
elseif self:isArray() then
local sz = self:arrayLength()
return types.array2d(self:arrayOver(),sz[1],sz[2])
elseif self:isTuple() then
local l = {}
for _,v in pairs(self.list) do table.insert(l, v:toCPUType()) end
return types.tuple(l)
elseif self:isNamed() then
return self.structure:toCPUType()
else

0 comments on commit 1985513

Please sign in to comment.