Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* SOC backend (incl 2x DMA) working in verilator and zu9
- Loading branch information
1 parent
f4e147d
commit 01b881e
Showing
31 changed files
with
907 additions
and
459 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
local R = require "rigel" | ||
local C = require "examplescommon" | ||
local SOC = require "soc" | ||
local J = require "common" | ||
|
||
return function(fn,t) | ||
if R.isFunction(fn)==false then | ||
fn = C.linearPipeline(fn,"Top") | ||
else | ||
J.err(fn.name=="Top","Top module must be called 'Top', but is "..fn.name) | ||
end | ||
|
||
local backend | ||
if t~=nil then backend = t.backend end | ||
if backend==nil then backend = arg[1] end | ||
if backend==nil then backend = "verilog" end | ||
|
||
local filename = string.gsub(arg[0],".lua","") --arg[0] | ||
print("FILENAME",filename) | ||
|
||
if backend=="verilog" or backend=="verilator" then | ||
io.output("out/"..filename..".v") | ||
io.write(fn:toVerilog()) | ||
io.output():close() | ||
elseif backend=="metadata" then | ||
local f = io.open("out/"..filename..".metadata.lua","w") | ||
|
||
local inputList = {} | ||
for i=0,SOC.ports do | ||
if fn.globalMetadata["MAXI"..i.."_read_filename"]~=nil then | ||
table.insert(inputList,"{filename='"..fn.globalMetadata["MAXI"..i.."_read_filename"].."',W="..fn.globalMetadata["MAXI"..i.."_read_W"]..",H="..fn.globalMetadata["MAXI"..i.."_read_H"]..",bitsPerPixel="..fn.globalMetadata["MAXI"..i.."_read_bitsPerPixel"]..",V="..fn.globalMetadata["MAXI"..i.."_read_V"]..",address=0x"..string.format("%x",fn.globalMetadata["MAXI"..i.."_read_address"]).."}") | ||
end | ||
end | ||
|
||
local outputList = {} | ||
for i=0,SOC.ports do | ||
if fn.globalMetadata["MAXI"..i.."_write_filename"]~=nil then | ||
table.insert(outputList,"{filename='"..fn.globalMetadata["MAXI"..i.."_write_filename"].."',W="..fn.globalMetadata["MAXI"..i.."_write_W"]..",H="..fn.globalMetadata["MAXI"..i.."_write_H"]..",bitsPerPixel="..fn.globalMetadata["MAXI"..i.."_write_bitsPerPixel"]..",V="..fn.globalMetadata["MAXI"..i.."_write_V"]..",address=0x"..string.format("%x",fn.globalMetadata["MAXI"..i.."_write_address"]).."}") | ||
end | ||
end | ||
|
||
f:write( "return {inputs={"..table.concat(inputList,",").."},outputs={"..table.concat(outputList,",").."},topModule='"..fn.name.."',memoryStart=0x30008000,memoryEnd=0x"..string.format("%x",SOC.currentAddr).."}" ) | ||
f:close() | ||
else | ||
print("backend",backend) | ||
assert(false) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
local R = require "rigel" | ||
local SOC = require "soc" | ||
local C = require "examplescommon" | ||
local harness = require "harnessSOC" | ||
local RS = require "rigelSimple" | ||
local RM = require "modules" | ||
require "types".export() | ||
|
||
local inp = R.input(R.HandshakeTrigger) | ||
local inp0, inp1 = RS.fanOut{input=inp,branches=2} | ||
local a = SOC.readBurst("frame_128.raw",128,64,u(8),8)(inp0) | ||
--a = C.fifo(b(64),1024)(a) | ||
a = RS.HS(C.cast(b(64),ar(u(8),8)))(a) | ||
local bb = SOC.readBurst("frame_128_inv.raw",128,64,u(8),8)(inp1) | ||
--bb = C.fifo(b(64),1024)(bb) | ||
bb = RS.HS(C.cast(b(64),ar(u(8),8)))(bb) | ||
local out = RS.fanIn{a,bb} | ||
out = RS.HS(RM.SoAtoAoS(8,1,{u(8),u(8)}))(out) | ||
out = RS.HS(RM.map(C.sum(u(8),u(8),u(8)),8))(out) | ||
out = RS.HS(C.cast(ar(u(8),8),b(64)))(out) | ||
out = SOC.writeBurst("out/soc_2in",128,64,u(8),8)(out) | ||
|
||
harness(RM.lambda("Top",inp,out)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
local R = require "rigel" | ||
local SOC = require "soc" | ||
local C = require "examplescommon" | ||
local harness = require "harnessLL" | ||
local harness = require "harnessSOC" | ||
local RS = require "rigelSimple" | ||
require "types".export() | ||
|
||
print(i,u,b) | ||
harness{SOC.axiBurstReadN("frame_128.raw",(128*64)/8,0), RS.HS(C.cast(b(64),u(64))), RS.HS(C.plus100(u(64))), RS.HS(C.cast(u(64),b(64))), SOC.axiBurstWriteN("out/soc_simple",(128*64)/8,0)} | ||
harness{ | ||
SOC.readBurst("frame_128.raw",128,64,u(8),8), | ||
RS.HS(C.cast(b(64),u(64))), | ||
RS.HS(C.plus100(u(64))), | ||
RS.HS(C.cast(u(64),b(64))), | ||
SOC.writeBurst("out/soc_simple",128,64,u(8),8)} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.