/
lk_wide_handshake_4_4.lua
88 lines (69 loc) · 2.36 KB
/
lk_wide_handshake_4_4.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
local rigel = require "rigel"
rigel.AUTO_FIFOS = false
local types = require("types")
local C = require "generators.examplescommon"
local harness = require "generators.harness"
local J = require "common"
if string.find(arg[0],"float") then
f = require "fixed_float"
f.DISABLE_SYNTH=true
else
f = require "fixed"
if string.find(arg[0],"axi") then
-- if using Xilinx parts, the plain verilog '*' wasn't synthesizing well...
-- not sure why we called this 'axi'...
-- don't use this multiplier in simulator - too slow!
f.DEEP_MULTIPLY = true
end
end
local NOSTALL = string.find(arg[0],"nostall")
NOSTALL = (NOSTALL~=nil)
function makeLK(T,window)
assert(T<=4)
local W = 64
local H = 64
local MHz = nil
if window==6 then
W,H = 128,128
elseif window==12 then
W,H = 1920,1080
end
local RW_TYPE = types.array2d(types.array2d(types.uint(8),2),4)
require "lk_core"
local bits = {
inv22={15,26,0},
inv22inp={5,5,0}, -- NOTICE THIS IS DIFFERENT THAN WINDOW=6 VERSION
d={0,0,0},
Apartial={0,0,0},
Bpartial={0,0,0},
solve={0,0,0}
}
if window==6 then
bits.inv22inp={0,10,0}
elseif window==12 then
bits.inv22inp={0,10,0}
end
local inputFilename = "trivial_64.raw"
if window==6 then
inputFilename = "trivial_128.raw"
elseif window==12 then
inputFilename = "packed_v0000.raw"
end
if window==12 then
MHz = 120
end
local externalT = 4
if f.FLOAT then
harness{ outFile="lk_wide_handshake_"..tostring(window).."_"..tostring(T).."_float", fn=LKTop(T,W,H,window,bits,NOSTALL), inFile=inputFilename, inSize={W,H}, outSize={W,H}, MHz=MHz }
else
local outfile = "lk_wide_handshake_"..tostring(window).."_"..tostring(T)..J.sel(f.DEEP_MULTIPLY,"_axi","")..J.sel(NOSTALL,"_nostall","")
harness{ outFile=outfile, fn=LKTop(T,W,H,window,bits,NOSTALL), inFile=inputFilename, inSize={W,H}, outSize={W,H}, MHz=MHz }
io.output("out/"..outfile..".design.txt"); io.write("Lucas Kanade "..H.." "..window.."x"..window); io.close()
io.output("out/"..outfile..".designT.txt"); io.write(T); io.close()
io.output("out/"..outfile..".dataset.txt"); io.write("SIG16_zu9"); io.close()
end
end
local first,flen = string.find(arg[0],"%d+")
local convwidth = string.sub(arg[0],first,flen)
local t = string.sub(arg[0], string.find(arg[0],"%d+",flen+1))
makeLK(tonumber(t),tonumber(convwidth))