Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tic
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wenyuanbo
tic
Commits
f731e0e6
Commit
f731e0e6
authored
Jun 14, 2019
by
Luis Vega
Committed by
eqy
Jun 14, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix hardware-makefile for osx, bugfix chisel-RegFile, and rename driver (#3371)
parent
2b045c56
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
38 additions
and
23 deletions
+38
-23
vta/apps/tsim_example/Makefile
+3
-7
vta/apps/tsim_example/hardware/chisel/Makefile
+9
-3
vta/apps/tsim_example/hardware/chisel/src/main/scala/accel/RegFile.scala
+1
-1
vta/apps/tsim_example/hardware/verilog/Makefile
+9
-2
vta/apps/tsim_example/python/__init__.py
+1
-0
vta/apps/tsim_example/python/accel/__init__.py
+0
-0
vta/apps/tsim_example/python/tsim.py
+2
-2
vta/apps/tsim_example/tests/python/chisel_accel.py
+2
-3
vta/apps/tsim_example/tests/python/verilog_accel.py
+2
-3
vta/hardware/chisel/Makefile
+9
-2
No files found.
vta/apps/tsim_example/Makefile
View file @
f731e0e6
...
@@ -20,12 +20,11 @@ export PYTHONPATH:=$(PWD)/python:$(PYTHONPATH)
...
@@ -20,12 +20,11 @@ export PYTHONPATH:=$(PWD)/python:$(PYTHONPATH)
BUILD_NAME
=
build
BUILD_NAME
=
build
build_dir
=
$
(
abspath .
)
/
$(BUILD_NAME)
build_dir
=
$
(
abspath .
)
/
$(BUILD_NAME)
default
:
verilog driver run_verilog
default
:
verilog driver
python3 tests/python/verilog_accel.py
run_chisel
:
chisel driver
run_chisel
:
chisel driver
python3 tests/python/chisel_accel.py
python3 tests/python/chisel_accel.py
.PHONY
:
cmake
driver
:
| $(build_dir)
driver
:
| $(build_dir)
cd
$(build_dir)
&&
cmake ..
&&
make
cd
$(build_dir)
&&
cmake ..
&&
make
...
@@ -39,9 +38,6 @@ verilog:
...
@@ -39,9 +38,6 @@ verilog:
chisel
:
chisel
:
make
-C
hardware/chisel
make
-C
hardware/chisel
run_verilog
:
python3 tests/python/verilog_accel.py
clean
:
clean
:
-
rm
-rf
$(build_dir)
-
rm
-rf
$(build_dir)
make
-C
hardware/chisel clean
make
-C
hardware/chisel clean
...
...
vta/apps/tsim_example/hardware/chisel/Makefile
View file @
f731e0e6
...
@@ -84,11 +84,17 @@ else
...
@@ -84,11 +84,17 @@ else
cxx_flags
+=
-DVM_TRACE
=
0
cxx_flags
+=
-DVM_TRACE
=
0
endif
endif
# The following is to be consistent with cmake
ifeq
($(shell
uname),
Darwin)
lib_path
=
$(build_dir)
/
$(LIBNAME)
.dylib
else
lib_path
=
$(build_dir)
/
$(LIBNAME)
.so
endif
default
:
lib
default
:
lib
lib
:
$(build_dir)/$(LIBNAME).so
lib
:
$(lib_path)
$(build_dir)/$(LIBNAME).so
:
$(verilator_build_dir)/V$(TOP).cpp
$(lib_path)
:
$(verilator_build_dir)/V$(TOP).cpp
echo
$(cxx_files)
g++
$(cxx_flags)
$(cxx_files)
-o
$@
g++
$(cxx_flags)
$(cxx_files)
-o
$@
verilator
:
$(verilator_build_dir)/V$(TOP).cpp
verilator
:
$(verilator_build_dir)/V$(TOP).cpp
...
...
vta/apps/tsim_example/hardware/chisel/src/main/scala/accel/RegFile.scala
View file @
f731e0e6
...
@@ -53,7 +53,7 @@ class RegFile(implicit config: AccelConfig) extends Module {
...
@@ -53,7 +53,7 @@ class RegFile(implicit config: AccelConfig) extends Module {
val
finish
=
Input
(
Bool
())
val
finish
=
Input
(
Bool
())
val
ecnt
=
Vec
(
config
.
nECnt
,
Flipped
(
ValidIO
(
UInt
(
config
.
regBits
.
W
))))
val
ecnt
=
Vec
(
config
.
nECnt
,
Flipped
(
ValidIO
(
UInt
(
config
.
regBits
.
W
))))
val
vals
=
Output
(
Vec
(
config
.
nVals
,
UInt
(
config
.
regBits
.
W
)))
val
vals
=
Output
(
Vec
(
config
.
nVals
,
UInt
(
config
.
regBits
.
W
)))
val
ptrs
=
Output
(
Vec
(
config
.
nPtrs
,
UInt
(
config
.
reg
Bits
.
W
)))
val
ptrs
=
Output
(
Vec
(
config
.
nPtrs
,
UInt
(
config
.
ptr
Bits
.
W
)))
val
host
=
new
VTAHostDPIClient
val
host
=
new
VTAHostDPIClient
})
})
val
sIdle
::
sRead
::
Nil
=
Enum
(
2
)
val
sIdle
::
sRead
::
Nil
=
Enum
(
2
)
...
...
vta/apps/tsim_example/hardware/verilog/Makefile
View file @
f731e0e6
...
@@ -83,10 +83,17 @@ else
...
@@ -83,10 +83,17 @@ else
cxx_flags
+=
-DVM_TRACE
=
0
cxx_flags
+=
-DVM_TRACE
=
0
endif
endif
# The following is to be consistent with cmake
ifeq
($(shell
uname),
Darwin)
lib_path
=
$(build_dir)
/
$(LIBNAME)
.dylib
else
lib_path
=
$(build_dir)
/
$(LIBNAME)
.so
endif
default
:
lib
default
:
lib
lib
:
$(
build_dir)/$(LIBNAME).so
lib
:
$(
lib_path)
$(
build_dir)/$(LIBNAME).so
:
$(build_dir)/V$(TOP).cpp
$(
lib_path)
:
$(build_dir)/V$(TOP).cpp
g++
$(cxx_flags)
$(cxx_files)
-o
$@
g++
$(cxx_flags)
$(cxx_files)
-o
$@
verilator
:
$(build_dir)/V$(TOP).cpp
verilator
:
$(build_dir)/V$(TOP).cpp
...
...
vta/apps/tsim_example/python/__init__.py
0 → 100644
View file @
f731e0e6
from
.
import
tsim
vta/apps/tsim_example/python/accel/__init__.py
deleted
100644 → 0
View file @
2b045c56
vta/apps/tsim_example/python/
accel/driver
.py
→
vta/apps/tsim_example/python/
tsim
.py
View file @
f731e0e6
...
@@ -34,8 +34,8 @@ def driver(hw_backend):
...
@@ -34,8 +34,8 @@ def driver(hw_backend):
_sw_libname
=
"libsw"
+
_ext
_sw_libname
=
"libsw"
+
_ext
_cur_path
=
osp
.
dirname
(
osp
.
abspath
(
osp
.
expanduser
(
__file__
)))
_cur_path
=
osp
.
dirname
(
osp
.
abspath
(
osp
.
expanduser
(
__file__
)))
if
hw_backend
in
(
"verilog"
,
"chisel"
):
if
hw_backend
in
(
"verilog"
,
"chisel"
):
_hw_lib
=
osp
.
join
(
_cur_path
,
".."
,
"
.."
,
"
hardware"
,
hw_backend
,
"build"
,
_hw_libname
)
_hw_lib
=
osp
.
join
(
_cur_path
,
".."
,
"hardware"
,
hw_backend
,
"build"
,
_hw_libname
)
_sw_lib
=
osp
.
join
(
_cur_path
,
".."
,
"
.."
,
"
build"
,
_sw_libname
)
_sw_lib
=
osp
.
join
(
_cur_path
,
".."
,
"build"
,
_sw_libname
)
def
load_dll
(
dll
):
def
load_dll
(
dll
):
try
:
try
:
...
...
vta/apps/tsim_example/tests/python/chisel_accel.py
View file @
f731e0e6
...
@@ -17,8 +17,7 @@
...
@@ -17,8 +17,7 @@
import
tvm
import
tvm
import
numpy
as
np
import
numpy
as
np
import
tsim
from
accel.driver
import
driver
def
test_accel
():
def
test_accel
():
rmax
=
64
rmax
=
64
...
@@ -27,7 +26,7 @@ def test_accel():
...
@@ -27,7 +26,7 @@ def test_accel():
ctx
=
tvm
.
cpu
(
0
)
ctx
=
tvm
.
cpu
(
0
)
a
=
tvm
.
nd
.
array
(
np
.
random
.
randint
(
rmax
,
size
=
n
)
.
astype
(
"uint64"
),
ctx
)
a
=
tvm
.
nd
.
array
(
np
.
random
.
randint
(
rmax
,
size
=
n
)
.
astype
(
"uint64"
),
ctx
)
b
=
tvm
.
nd
.
array
(
np
.
zeros
(
n
)
.
astype
(
"uint64"
),
ctx
)
b
=
tvm
.
nd
.
array
(
np
.
zeros
(
n
)
.
astype
(
"uint64"
),
ctx
)
f
=
driver
(
"chisel"
)
f
=
tsim
.
driver
(
"chisel"
)
cycles
=
f
(
a
,
b
,
c
)
cycles
=
f
(
a
,
b
,
c
)
msg
=
"cycles:{0:4} n:{1:2} c:{2:2}"
.
format
(
cycles
,
n
,
c
)
msg
=
"cycles:{0:4} n:{1:2} c:{2:2}"
.
format
(
cycles
,
n
,
c
)
np
.
testing
.
assert_equal
(
b
.
asnumpy
(),
a
.
asnumpy
()
+
c
,
err_msg
=
"[FAIL] "
+
msg
)
np
.
testing
.
assert_equal
(
b
.
asnumpy
(),
a
.
asnumpy
()
+
c
,
err_msg
=
"[FAIL] "
+
msg
)
...
...
vta/apps/tsim_example/tests/python/verilog_accel.py
View file @
f731e0e6
...
@@ -17,8 +17,7 @@
...
@@ -17,8 +17,7 @@
import
tvm
import
tvm
import
numpy
as
np
import
numpy
as
np
import
tsim
from
accel.driver
import
driver
def
test_accel
():
def
test_accel
():
rmax
=
64
rmax
=
64
...
@@ -27,7 +26,7 @@ def test_accel():
...
@@ -27,7 +26,7 @@ def test_accel():
ctx
=
tvm
.
cpu
(
0
)
ctx
=
tvm
.
cpu
(
0
)
a
=
tvm
.
nd
.
array
(
np
.
random
.
randint
(
rmax
,
size
=
n
)
.
astype
(
"uint64"
),
ctx
)
a
=
tvm
.
nd
.
array
(
np
.
random
.
randint
(
rmax
,
size
=
n
)
.
astype
(
"uint64"
),
ctx
)
b
=
tvm
.
nd
.
array
(
np
.
zeros
(
n
)
.
astype
(
"uint64"
),
ctx
)
b
=
tvm
.
nd
.
array
(
np
.
zeros
(
n
)
.
astype
(
"uint64"
),
ctx
)
f
=
driver
(
"verilog"
)
f
=
tsim
.
driver
(
"verilog"
)
cycles
=
f
(
a
,
b
,
c
)
cycles
=
f
(
a
,
b
,
c
)
msg
=
"cycles:{0:4} n:{1:2} c:{2:2}"
.
format
(
cycles
,
n
,
c
)
msg
=
"cycles:{0:4} n:{1:2} c:{2:2}"
.
format
(
cycles
,
n
,
c
)
np
.
testing
.
assert_equal
(
b
.
asnumpy
(),
a
.
asnumpy
()
+
c
,
err_msg
=
"[FAIL] "
+
msg
)
np
.
testing
.
assert_equal
(
b
.
asnumpy
(),
a
.
asnumpy
()
+
c
,
err_msg
=
"[FAIL] "
+
msg
)
...
...
vta/hardware/chisel/Makefile
View file @
f731e0e6
...
@@ -86,10 +86,17 @@ else
...
@@ -86,10 +86,17 @@ else
cxx_flags
+=
-DVM_TRACE
=
0
cxx_flags
+=
-DVM_TRACE
=
0
endif
endif
# The following is to be consistent with cmake
ifeq
($(shell
uname),
Darwin)
lib_path
=
$(vta_dir)
/
$(BUILD_NAME)
/
$(VTA_LIBNAME)
.dylib
else
lib_path
=
$(vta_dir)
/
$(BUILD_NAME)
/
$(VTA_LIBNAME)
.so
endif
default
:
lib
default
:
lib
lib
:
$(
vta_dir)/$(BUILD_NAME)/$(VTA_LIBNAME).so
lib
:
$(
lib_path)
$(
vta_dir)/$(BUILD_NAME)/$(VTA_LIBNAME).so
:
$(verilator_build_dir)/V$(TOP_TEST).cpp
$(
lib_path)
:
$(verilator_build_dir)/V$(TOP_TEST).cpp
g++
$(cxx_flags)
$(cxx_files)
-o
$@
g++
$(cxx_flags)
$(cxx_files)
-o
$@
verilator
:
$(verilator_build_dir)/V$(TOP_TEST).cpp
verilator
:
$(verilator_build_dir)/V$(TOP_TEST).cpp
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment