Skip to content
Permalink
Browse files

Improved type system, parameterized modules, automatic interface lift…

…ing (#148)

Large diff with improved type system, assigning a parametrized type to modules, and implementing automatic interface lifting using these features.
  • Loading branch information...
jameshegarty committed Sep 17, 2019
1 parent fc22a35 commit df1aa12fd9da458f4317eb3c4adec4bf33d7f45f
Showing with 5,148 additions and 2,861 deletions.
  1. +12 −12 .circleci/config.yml
  2. +5 −5 .gitmodules
  3. +4 −4 examples/12bpp.lua
  4. +4 −4 examples/15x15.lua
  5. +4 −4 examples/18bpp.lua
  6. +4 −4 examples/1pxout.lua
  7. +5 −5 examples/2xov7660.lua
  8. +4 −5 examples/4bpp.lua
  9. +5 −5 examples/campipe_128.lua
  10. +6 −6 examples/campipe_core.lua
  11. +7 −7 examples/conv_tr_handshake_4_1.lua
  12. +4 −4 examples/conv_wide_handshake.lua
  13. +6 −7 examples/conv_wide_handshake_taps.lua
  14. +4 −3 examples/convolve_p8.lua
  15. +4 −3 examples/convolve_slow.lua
  16. +3 −3 examples/convpadcrop_handshake.lua
  17. +5 −5 examples/convpadcrop_wide_handshake_4_1.lua
  18. +4 −4 examples/crop.lua
  19. +4 −4 examples/descriptor_core.lua
  20. +4 −4 examples/downsample_2.lua
  21. +4 −4 examples/downsample_wide_handshake_2.lua
  22. +3 −3 examples/downsamplex_wide_handshake_1.lua
  23. +3 −3 examples/downsampley_wide_handshake.lua
  24. +6 −6 examples/edge.lua
  25. +1 −1 examples/featuredescriptor.lua
  26. +3 −3 examples/fifo_wide_handshake_1.lua
  27. +3 −3 examples/fifo_wide_handshake_2.lua
  28. +3 −3 examples/fifo_wide_handshake_2_noloop.lua
  29. +3 −3 examples/fifo_wide_handshake_bram.lua
  30. +3 −3 examples/fifo_wide_handshake_noop.lua
  31. +7 −7 examples/filterseq.lua
  32. +5 −5 examples/fixed_bool.lua
  33. +4 −4 examples/fixed_float_add.lua
  34. +4 −4 examples/fixed_float_gt.lua
  35. +4 −4 examples/fixed_float_inv.lua
  36. +4 −4 examples/fixed_float_mult.lua
  37. +4 −4 examples/fixed_float_rshift.lua
  38. +4 −4 examples/fixed_float_sqrt.lua
  39. +4 −4 examples/fixed_float_sub.lua
  40. +4 −4 examples/fixed_int_float.lua
  41. +5 −5 examples/fixed_inv_wide_handshake.lua
  42. +4 −4 examples/fixed_wide_handshake.lua
  43. +1 −1 examples/gold/campipe_128.terra.cycles.txt
  44. +1 −1 examples/gold/campipe_512.terra.cycles.txt
  45. +1 −1 examples/gold/campipe_ov7660.terra.cycles.txt
  46. +1 −1 examples/gold/campipe_ov7660_1x.terra.cycles.txt
  47. +1 −1 examples/gold/conv_tr_handshake_4_4.terra.cycles.txt
  48. +1 −1 examples/gold/conv_tr_handshake_4_4.verilator.cycles.txt
  49. +1 −1 examples/gold/conv_tr_handshake_4_4_1080p.terra.cycles.txt
  50. +1 −1 examples/gold/conv_tr_handshake_4_4_1080p.verilator.cycles.txt
  51. +1 −1 examples/gold/conv_tr_handshake_8_8.terra.cycles.txt
  52. +1 −1 examples/gold/conv_tr_handshake_8_8.verilator.cycles.txt
  53. +1 −1 examples/gold/conv_tr_handshake_8_8_1080p.terra.cycles.txt
  54. +1 −1 examples/gold/conv_tr_handshake_8_8_1080p.verilator.cycles.txt
  55. +1 −1 examples/gold/featuredescriptor.terra.cycles.txt
  56. +1 −1 examples/gold/fixed_inv_wide_handshake.terra.cycles.txt
  57. +1 −1 examples/gold/fixed_wide_handshake.terra.cycles.txt
  58. +1 −1 examples/gold/harris.terra.cycles.txt
  59. +1 −1 examples/gold/harris_corner.terra.cycles.txt
  60. +1 −1 examples/gold/harris_filterseq.terra.cycles.txt
  61. +1 −1 examples/gold/lk_tr_handshake_4_4.terra.cycles.txt
  62. +1 −1 examples/gold/lk_tr_handshake_4_4_axi.terra.cycles.txt
  63. +1 −1 examples/gold/lk_tr_handshake_6_1.terra.cycles.txt
  64. +1 −1 examples/gold/lk_tr_handshake_6_1_axi.terra.cycles.txt
  65. +1 −1 examples/gold/lk_tr_handshake_6_2.terra.cycles.txt
  66. +1 −1 examples/gold/lk_tr_handshake_6_2_axi.terra.cycles.txt
  67. +1 −1 examples/gold/lk_tr_handshake_6_3.terra.cycles.txt
  68. +1 −1 examples/gold/lk_tr_handshake_6_3_axi.terra.cycles.txt
  69. +1 −1 examples/gold/lk_tr_handshake_6_6.terra.cycles.txt
  70. +1 −1 examples/gold/lk_tr_handshake_6_6_axi.terra.cycles.txt
  71. +1 −1 examples/gold/lk_wide_handshake_4_1.terra.cycles.txt
  72. +1 −1 examples/gold/lk_wide_handshake_4_1_axi.terra.cycles.txt
  73. +1 −1 examples/gold/lk_wide_handshake_4_4.terra.cycles.txt
  74. +1 −1 examples/gold/lk_wide_handshake_4_4_axi.terra.cycles.txt
  75. +1 −1 examples/gold/lk_wide_handshake_4_4_float.terra.cycles.txt
  76. +1 −1 examples/gold/lk_wide_handshake_6_1_axi.terra.cycles.txt
  77. +1 −1 examples/gold/lk_wide_handshake_6_4_axi.terra.cycles.txt
  78. +1 −1 examples/gold/lk_wide_handshake_6_4_float.terra.cycles.txt
  79. +1 −1 examples/gold/sift_desc.terra.cycles.txt
  80. +1 −1 examples/gold/sift_desc_hw.terra.cycles.txt
  81. +1 −1 examples/gold/sift_float.terra.cycles.txt
  82. +1 −1 examples/gold/soc_filterseq.terra.cycles.txt
  83. +1 −1 examples/gold/soc_redu1024.terra.cycles.txt
  84. +1 −1 examples/gold/soc_redu2048.terra.cycles.txt
  85. +1 −1 examples/gold/soc_redu4096.terra.cycles.txt
  86. +1 −1 examples/gold/soc_redu8192.terra.cycles.txt
  87. +1 −1 examples/gold/soc_simple_uniform.terra.cycles.txt
  88. +1 −1 examples/gold/stereo_tr_full_16.terra.cycles.txt
  89. +1 −1 examples/gold/stereo_tr_full_8.terra.cycles.txt
  90. +1 −1 examples/gold/stereo_tr_medi_16.terra.cycles.txt
  91. +1 −1 examples/gold/stereo_tr_medi_8.terra.cycles.txt
  92. +1 −1 examples/gold/stereo_tr_tiny_1.terra.cycles.txt
  93. +1 −1 examples/gold/stereo_tr_tiny_2.terra.cycles.txt
  94. +1 −1 examples/gold/stereo_tr_tiny_4.terra.cycles.txt
  95. +4 −4 examples/harris.lua
  96. +16 −10 examples/harris_core.lua
  97. +3 −3 examples/harris_corner.lua
  98. +6 −5 examples/harris_filterseq.lua
  99. +5 −5 examples/interleve_wide_handshake.lua
  100. +4 −4 examples/inv_wide_handshake.lua
  101. +6 −6 examples/linebufferpartial_handshake_1.lua
  102. +8 −7 examples/lk_core.lua
  103. +53 −51 examples/lk_tr_core.lua
  104. +3 −3 examples/lk_tr_handshake_4_4.lua
  105. +2 −2 examples/lk_wide_handshake_4_4.lua
  106. +3 −3 examples/lowthroughput_4.lua
  107. +3 −0 examples/makefile
  108. +3 −3 examples/nilhandshake.lua
  109. +3 −3 examples/nullary.lua
  110. +4 −4 examples/pad.lua
  111. +4 −4 examples/pad2_wide_handshake.lua
  112. +2 −2 examples/pad_wide_handshake.lua
  113. +3 −3 examples/padcrop_wide_handshake.lua
  114. +5 −5 examples/pointwise_wide_handshake.lua
  115. +5 −5 examples/pyramid_1.lua
  116. +7 −7 examples/pyramid_core.lua
  117. +6 −6 examples/pyramid_taps_1.lua
  118. +6 −6 examples/pyramid_tr_1.lua
  119. +3 −3 examples/rcp.lua
  120. +3 −3 examples/rcpsigned.lua
  121. +4 −4 examples/reduceseq_handshake.lua
  122. +3 −3 examples/resample_wide_handshake.lua
  123. +5 −5 examples/shifty_wide_handshake.lua
  124. +34 −26 examples/sift_core.lua
  125. +19 −19 examples/sift_core_hw.lua
  126. +3 −3 examples/sift_desc.lua
  127. +4 −4 examples/sift_desc_hw.lua
  128. +2 −2 examples/sift_float.lua
  129. +2 −2 examples/sift_hw.lua
  130. +8 −8 examples/soc_15x15.lua
  131. +16 −13 examples/soc_15x15x15.lua
  132. +10 −8 examples/soc_2in.lua
  133. +12 −11 examples/soc_arbiter.lua
  134. +39 −22 examples/soc_bjump_cache.lua
  135. +18 −16 examples/soc_convgen.lua
  136. +18 −16 examples/soc_convgenTaps.lua
  137. +10 −10 examples/soc_convtest.lua
  138. +14 −11 examples/soc_filterseq.lua
  139. +29 −18 examples/soc_filterseq8.lua
  140. +16 −11 examples/soc_flip.lua
  141. +18 −14 examples/soc_flipWrite.lua
  142. +8 −8 examples/soc_parread.lua
  143. +18 −11 examples/soc_pulpino_noc.lua
  144. +23 −17 examples/soc_read.lua
  145. +14 −11 examples/soc_readlen.lua
  146. +20 −12 examples/soc_redu8192.lua
  147. +12 −9 examples/soc_regin.lua
  148. +8 −7 examples/soc_regout.lua
  149. +6 −6 examples/soc_simple.lua
  150. +21 −10 examples/soc_simple_uniform.lua
  151. +6 −6 examples/soc_sort.lua
  152. +6 −6 examples/soc_tokencounter.lua
  153. +10 −10 examples/soc_unaligned.lua
  154. +7 −7 examples/soc_underflow.lua
  155. +6 −6 examples/sparselb.lua
  156. +8 −7 examples/sparselb_dense.lua
  157. +6 −6 examples/sparselb_overflow.lua
  158. +4 −4 examples/stencil.lua
  159. +4 −4 examples/stereo_core.lua
  160. +2 −2 examples/stereo_ov7660.lua
  161. +9 −9 examples/stereo_tr_core.lua
  162. +2 −2 examples/stereo_tr_tiny_1.lua
  163. +2 −2 examples/stereo_wide_handshake_tiny.lua
  164. +4 −4 examples/tmux_wide_handshake.lua
  165. +5 −8 examples/underflow.lua
  166. +4 −4 examples/upsample_2.lua
  167. +4 −4 examples/upsample_wide_handshake_2.lua
  168. +3 −3 examples/upsamplex_wide_handshake_1.lua
  169. +3 −3 examples/upsampley_wide_handshake.lua
  170. 0 {modules → generators}/axi.lua
  171. +1 −1 {modules → generators}/axiTerra.t
  172. +50 −50 {modules → generators}/bjump.lua
  173. 0 {modules → generators}/bsg_ip_cores
  174. +1,086 −0 generators/core.lua
  175. +252 −127 {modules → generators}/examplescommon.lua
  176. +1 −1 {modules → generators}/examplescommonTerra.t
  177. +6 −4 {modules → generators}/harness.lua
  178. +4 −4 {modules → generators}/harnessSOC.lua
  179. +3 −3 {modules → generators}/harnessTerra.t
  180. +6 −6 {modules → generators}/harnessTerraSOC.t
  181. +85 −0 generators/lifts.lua
  182. +874 −394 {modules → generators}/modules.lua
  183. +310 −305 {modules → generators}/modulesTerra.t
  184. +24 −24 {modules → generators}/pulpino.lua
  185. 0 {modules → generators}/pulpino/axi
  186. 0 {modules → generators}/pulpino/axi_node
  187. 0 {modules → generators}/pulpino/axi_size_conv
  188. 0 {modules → generators}/pulpino/common_cells
  189. +49 −30 {modules → generators}/soc.lua
  190. +14 −14 {modules → generators}/socTerra.t
  191. +6 −4 {modules → generators}/zynq.lua
  192. +7 −7 {modules → generators}/zynqTerra.t
  193. +11 −7 misc/fixed.lua
  194. +18 −4 misc/fixed_float.lua
  195. +2 −0 misc/fixed_float_terra.t
  196. +7 −5 misc/fixed_new.lua
  197. +1 −1 misc/fixed_new_terra.t
  198. +20 −24 misc/rigelSimple.lua
  199. +3 −3 misc/rigelhll.lua
  200. +0 −657 modules/generators.lua
  201. +4 −4 platform/axi/wrapper.lua
  202. +1 −1 platform/verilatorSOC/harness.cpp
  203. +6 −6 platform/verilatorSOC/harness.h
  204. +418 −121 rigel.lua
  205. +1 −1 rigelLuajit
  206. +5 −0 src/common.lua
  207. +8 −2 src/fpgamodules.lua
  208. +218 −0 src/params.lua
  209. +2 −0 src/sdf.lua
  210. +6 −1 src/simmodules.t
  211. +16 −15 src/systolic.lua
  212. +1 −1 src/systolicsugar.lua
  213. +652 −189 src/types.lua
  214. +27 −10 src/uniform.lua
  215. +1 −1 src/uniformTerra.t
  216. +5 −5 unittests/fwriteseq.lua
  217. +4 −4 unittests/fwriteseq12.lua
  218. +5 −5 unittests/fwriteseq16.lua
  219. +4 −4 unittests/fwriteseq18.lua
  220. +4 −4 unittests/fwriteseq24.lua
  221. +4 −4 unittests/fwriteseq37.lua
  222. +1 −1 unittests/gold/dbg_removelsbs.metadata.lua
  223. +1 −1 unittests/moduleparams.lua
@@ -80,17 +80,17 @@ jobs:
- run: sudo ln -s /home/circleci/project/terra-Linux-x86_64-332a506/bin/terra /usr/bin/terra
- run: cd examples; make terra
- run: test -e examples/out/terra_done.txt || exit
state:
docker:
- image: circleci/python:3.7.1
steps:
- checkout
- run: sudo apt-get install luajit verilator
- run: wget https://github.com/zdevito/terra/releases/download/release-2016-03-25/terra-Linux-x86_64-332a506.zip
- run: unzip terra-Linux-x86_64-332a506.zip
- run: sudo ln -s /home/circleci/project/terra-Linux-x86_64-332a506/bin/terra /usr/bin/terra
- run: cd examples; make state
- run: test -e examples/out/state_done.txt || exit
# state:
# docker:
# - image: circleci/python:3.7.1
# steps:
# - checkout
# - run: sudo apt-get install luajit verilator
# - run: wget https://github.com/zdevito/terra/releases/download/release-2016-03-25/terra-Linux-x86_64-332a506.zip
# - run: unzip terra-Linux-x86_64-332a506.zip
# - run: sudo ln -s /home/circleci/project/terra-Linux-x86_64-332a506/bin/terra /usr/bin/terra
# - run: cd examples; make state
# - run: test -e examples/out/state_done.txt || exit
workflows:
version: 2
dostuff:
@@ -101,5 +101,5 @@ workflows:
- unit
- terra
- bjump
- state
# - state
- pulpino
@@ -1,15 +1,15 @@
[submodule "modules/bsg_ip_cores"]
path = modules/bsg_ip_cores
path = generators/bsg_ip_cores
url = https://bitbucket.org/taylor-bsg/bsg_ip_cores.git
[submodule "modules/axi_node"]
path = modules/pulpino/axi_node
path = generators/pulpino/axi_node
url = https://github.com/pulp-platform/axi_node.git
[submodule "modules/axi_size_conv"]
path = modules/pulpino/axi_size_conv
path = generators/pulpino/axi_size_conv
url = https://github.com/pulp-platform/axi_size_conv.git
[submodule "modules/axi"]
path = modules/pulpino/axi
path = generators/pulpino/axi
url = https://github.com/pulp-platform/axi.git
[submodule "modules/pulpino/common_cells"]
path = modules/pulpino/common_cells
path = generators/pulpino/common_cells
url = https://github.com/pulp-platform/common_cells.git
@@ -1,17 +1,17 @@
local R = require "rigel"
local RM = require "modules"
local RM = require "generators.modules"
local ffi = require("ffi")
local types = require("types")
local S = require("systolic")
local harness = require "harness"
local C = require "examplescommon"
local harness = require "generators.harness"
local C = require "generators.examplescommon"

W = 128
H = 64


------------
inp = R.input( types.uint(8) )
inp = R.input( types.rv(types.Par(types.uint(8))) )
a = R.apply("a", C.cast(types.uint(8),types.uint(12)), inp)
b = R.apply("b", C.plus100(types.uint(12)), a)
p100 = RM.lambda( "p100", inp, b )
@@ -1,10 +1,10 @@
local R = require "rigel"
local RM = require "modules"
local RM = require "generators.modules"
local ffi = require("ffi")
local types = require("types")
local S = require("systolic")
local harness = require "harness"
local C = require "examplescommon"
local harness = require "generators.harness"
local C = require "generators.examplescommon"
require "common".export()

W = 15
@@ -13,7 +13,7 @@ T = 1


------------
inp = R.input( types.uint(8) )
inp = R.input( types.rv(types.Par(types.uint(8))) )
a = R.apply("a", C.plus100(types.uint(8)), inp)
b = R.apply("b", C.plus100(types.uint(8)), a)
p200 = RM.lambda( "p200", inp, b )
@@ -1,17 +1,17 @@
local R = require "rigel"
local RM = require "modules"
local RM = require "generators.modules"
local ffi = require("ffi")
local types = require("types")
local S = require("systolic")
local harness = require "harness"
local C = require "examplescommon"
local harness = require "generators.harness"
local C = require "generators.examplescommon"

W = 128
H = 64


------------
inp = R.input( types.uint(8) )
inp = R.input( types.rv(types.Par(types.uint(8))) )
a = R.apply("a", C.cast(types.uint(8),types.uint(18)), inp)
b = R.apply("b", C.plusConst(types.uint(18),69926), a)
p100 = RM.lambda( "p100", inp, b )
@@ -1,16 +1,16 @@
local R = require "rigel"
local RM = require "modules"
local RM = require "generators.modules"
local ffi = require("ffi")
local types = require("types")
types.export()
local S = require("systolic")
local harness = require "harness"
local C = require "examplescommon"
local harness = require "generators.harness"
local C = require "generators.examplescommon"
require "common".export()

W = 15
H = 15
T = 1


harness{ outFile="1pxout", fn=RM.liftHandshake(RM.liftDecimate(RM.reduceSeq(C.sum(u(8),u(8),u(8),true),1/(W*H)))), inFile="15x15.raw", inSize={W,H}, outSize={1,1} }
harness{ outFile="1pxout", fn=RM.liftHandshake(RM.liftDecimate(RM.reduceSeq(C.sum(u(8),u(8),u(8),true),(W*H)))), inFile="15x15.raw", inSize={W,H}, outSize={1,1} }
@@ -1,8 +1,8 @@
local RM = require "modules"
local C = require "examplescommon"
local RM = require "generators.modules"
local C = require "generators.examplescommon"
local types = require("types")
local S = require("systolic")
local harness = require "harness"
local harness = require "generators.harness"

W = 640
H = 480
@@ -21,7 +21,7 @@ if terralib~=nil then
tfn = ovt(SPLIT_TYPE,OTYPE)
end

splitfn = RM.lift( "split", SPLIT_TYPE, OTYPE , 10,
splitfn = RM.lift( "split", SPLIT_TYPE, OTYPE , 0,
function(inp)
local sout = S.select(S.lt(S.index(S.index(inp,0),0),S.constant(320,types.uint(16))),S.index(S.index(inp,1),0),S.index(S.index(inp,1),1))
sout = S.tuple{sout,sout,sout,S.constant(0,types.uint(8))}
@@ -33,4 +33,4 @@ sfn = RM.makeHandshake(RM.liftXYSeqPointwise("splitfn","split",splitfn,W,H,2))

hsfn = C.compose("hsfn",sfn,cr)

harness{ outFile="2xov7660", fn=hsfn, inFile="2xov7660.raw", inSize={W,H}, outSize={W,H} }
harness{ outFile="2xov7660", fn=hsfn, inFile="2xov7660.raw", inSize={W,H}, outSize={W,H} }
@@ -1,17 +1,16 @@
local R = require "rigel"
local RM = require "modules"
local RM = require "generators.modules"
local ffi = require("ffi")
local types = require("types")
local S = require("systolic")
local harness = require "harness"
local C = require "examplescommon"
local harness = require "generators.harness"
local C = require "generators.examplescommon"

W = 128
H = 64


------------
inp = R.input( types.uint(8) )
inp = R.input( types.rv(types.Par(types.uint(8))) )
a = R.apply("a", C.cast(types.uint(8),types.uint(4)), inp)
b = R.apply("b", C.plusConst(types.uint(4),15), a)
p100 = RM.lambda( "p100", inp, b )
@@ -1,11 +1,12 @@
local R = require "rigel"
local RM = require "modules"
local RM = require "generators.modules"
local CC = require "campipe_core"
local J = require "common"
local types = require "types"

function makeCampipeTop()
-- inp -> |blacklevel| -> |Demosaic| -> |CCM| -> |Gamma| -> out
local input = rigelInput(grayscale_uint8)
local input = rigelInput(types.rv(types.Par(grayscale_uint8)))
local bl_out = connect{input=input, tomodule=BlackLevel}
local dem_out = connect{input=bl_out, tomodule=Demosaic}
local ccm_out = connect{input=dem_out, tomodule=CCM}
@@ -14,11 +15,10 @@ function makeCampipeTop()
end


local types = require("types")
local harness = require "harness"
local harness = require "generators.harness"
local f = require "fixed"
local modules = require "fpgamodules"
local C = require "examplescommon"
local C = require "generators.examplescommon"

W = 512
H = 512
@@ -1,10 +1,10 @@
local f = require "fixed"
local R = require "rigel"
local types = require "types"
local RM = require "modules"
local RM = require "generators.modules"
local S = require "systolic"
local modules = require "fpgamodules"
local C = require "examplescommon"
local C = require "generators.examplescommon"
local CC = {}

local campipeCoreTerra
@@ -67,7 +67,7 @@ function CC.demosaic(internalW,internalH,internalT,DEMOSAIC_W,DEMOSAIC_H,DEMOSAI

local XYTYPE = types.tuple{types.uint(16),types.uint(16)}
local DTYPE = types.tuple{XYTYPE,types.array2d(types.uint(8),DEMOSAIC_W,DEMOSAIC_H)}
local deminp = R.input(DTYPE)
local deminp = R.input(types.rv(types.Par(DTYPE)))
local xy = R.apply("xy",C.index(DTYPE,0),deminp)
local st = R.apply("dat",C.index(DTYPE,1),deminp)

@@ -89,7 +89,7 @@ function CC.demosaic(internalW,internalH,internalT,DEMOSAIC_W,DEMOSAIC_H,DEMOSAI
dem = RM.liftXYSeqPointwise("dem","dem",dem,internalW,internalH,internalT)

---------------
local demtop = R.input(types.array2d(types.uint(8),internalT))
local demtop = R.input( types.rv(types.Par(types.array2d(types.uint(8),internalT))) )
local st = R.apply( "st", C.stencilLinebuffer(types.uint(8),internalW,internalH,internalT,-DEMOSAIC_W+1,0,-DEMOSAIC_H+1,0), demtop)
local st = R.apply( "convstencils", C.unpackStencil( types.uint(8), DEMOSAIC_W, DEMOSAIC_H, internalT ) , st )
local demtopout = R.apply("dem",dem,st)
@@ -122,7 +122,7 @@ function CC.addchan()
out[c] = inp:index(c)
end
out[3] = f.plainconstant(0,types.uint(8))
return f.array2d(out,4):toRigelModule("addChan")
return f.array2d(out,4):disablePipelining():toRigelModule("addChan")
end

function CC.makeGamma(g)
@@ -167,7 +167,7 @@ function CC.shiftKernel(t,W,H,xs,ys)
end

local R = require "rigel"
local RM = require "modules"
local RM = require "generators.modules"

rigelInput = R.input

@@ -1,14 +1,14 @@
local R = require "rigel"
local RM = require "modules"
local RM = require "generators.modules"
local types = require("types")
local S = require("systolic")
local harness = require "harness"
local C = require "examplescommon"
local harness = require "generators.harness"
local C = require "generators.examplescommon"
local J = require "common"

--T = 8 -- throughput
function MAKE(T,ConvWidth,size1080p)
assert(T<=1)
assert(T>=1)
--ConvRadius = 1
local ConvRadius = ConvWidth/2
-- put center at (ConvRadius,ConvRadius)
@@ -40,7 +40,7 @@ function MAKE(T,ConvWidth,size1080p)
local convolve = C.convolveConstantTR( types.uint(8), ConvWidth, ConvWidth, T, J.range(ConvWidth*ConvWidth), J.sel(ConvWidth==4,7,11) )
-------------
local RW_TYPE = types.array2d( types.uint(8), 8 ) -- simulate axi bus
local hsfninp = R.input( R.Handshake(RW_TYPE) )
local hsfninp = R.input( R.Handshake(types.Par(RW_TYPE)) )

local out = R.apply("reducerate", RM.liftHandshake(RM.changeRate(types.uint(8),1,8,1)), hsfninp )
local out = R.apply("pad", RM.liftHandshake(RM.padSeq(types.uint(8), inputW, inputH, 1, PadRadius, PadRadius, ConvRadius, ConvRadius, 0)), out)
@@ -53,7 +53,7 @@ function MAKE(T,ConvWidth,size1080p)
local hsfn = RM.lambda("hsfn", hsfninp, out)

local infile = "frame_128.raw"
local outfile = "conv_tr_handshake_"..tostring(ConvWidth).."_"..(1/T)
local outfile = "conv_tr_handshake_"..tostring(ConvWidth).."_"..T

if size1080p then
infile="1080p.raw"
@@ -73,4 +73,4 @@ local first = string.find(arg[0],"%d+")
local convwidth = string.sub(arg[0],first,first)
local t = string.sub(arg[0], string.find(arg[0],"%d+",first+1))

MAKE(1/tonumber(t),tonumber(convwidth),string.find(arg[0],"1080p"))
MAKE(tonumber(t),tonumber(convwidth),string.find(arg[0],"1080p"))
@@ -1,9 +1,9 @@
local R = require "rigel"
local RM = require "modules"
local RM = require "generators.modules"
local types = require("types")
local S = require("systolic")
local harness = require("harness")
local C = require "examplescommon"
local harness = require("generators.harness")
local C = require "generators.examplescommon"
require "common".export()

T = 8 -- throughput
@@ -24,7 +24,7 @@ H = inputH
local convolve = C.convolveConstant( types.uint(8), ConvWidth, ConvWidth, range(ConvArea), 8 )
-------------
BASE_TYPE = types.array2d( types.uint(8), T )
inp = R.input( BASE_TYPE )
inp = R.input( types.rv(types.Par(BASE_TYPE)) )

convLB = R.apply( "convLB", C.stencilLinebuffer( types.uint(8), W,H, T, -ConvWidth+1, 0, -ConvWidth+1, 0 ), inp)
convstencils = R.apply( "convstencils", C.unpackStencil( types.uint(8), ConvWidth, ConvWidth, T ), convLB )
@@ -1,12 +1,11 @@
local R = require "rigel"
local RM = require "modules"
local C = require "examplescommon"
local RM = require "generators.modules"
local C = require "generators.examplescommon"
local types = require("types")
local S = require("systolic")
local harness = require("harness")
local C = require "examplescommon"
local harness = require("generators.harness")
require "common".export()
local soc = require "soc"
local soc = require "generators.soc"

R.SDF=false -- for taps

@@ -38,7 +37,7 @@ local regs = soc.regStub{taps={STTYPE,tapValue}}:instantiate("taps")
regs.extern = true

local ITYPE = STTYPE
inp = R.input( ITYPE )
inp = R.input( types.rv(types.Par(ITYPE)) )
--local tapv = R.readGlobal("tg",regs.coeffs)
packed = R.apply( "packedtup", C.SoAtoAoS(ConvWidth,ConvWidth,{types.uint(8),types.uint(8)}), R.concat("tc",{inp,regs.taps()}) )
conv = R.apply( "partial", RM.map( partial, ConvWidth, ConvWidth ), packed )
@@ -50,7 +49,7 @@ print(convolve)
-------------
BASE_TYPE = types.array2d( types.uint(8), T )
ITYPE = BASE_TYPE
inp = R.input( ITYPE )
inp = R.input( types.rv(types.Par(ITYPE)) )

convLB = R.apply( "convLB", C.stencilLinebuffer( types.uint(8), W,H, T, -ConvWidth+1, 0, -ConvWidth+1, 0 ), inp)
convstencils = R.apply( "convstencils", C.unpackStencil( types.uint(8), ConvWidth, ConvWidth, T ), convLB )

0 comments on commit df1aa12

Please sign in to comment.
You can’t perform that action at this time.