├── .gitignore ├── .gitmodules ├── LICENSE ├── Makefrag ├── README.md ├── benchmark ├── benchmark-data │ ├── .gitkeep │ ├── random-10.txt │ ├── random-100.txt │ ├── random-1000.txt │ ├── random-10000.txt │ ├── random-10000_0.txt │ ├── random-10000_1.txt │ ├── random-10000_2.txt │ ├── random-10000_3.txt │ ├── random-10000_4.txt │ ├── random-10000_5.txt │ ├── random-10000_6.txt │ ├── random-10000_7.txt │ ├── random-1000_0.txt │ ├── random-1000_1.txt │ ├── random-1000_2.txt │ ├── random-1000_3.txt │ ├── random-1000_4.txt │ ├── random-1000_5.txt │ ├── random-1000_6.txt │ ├── random-1000_7.txt │ ├── random-100_0.txt │ ├── random-100_1.txt │ ├── random-100_2.txt │ ├── random-100_3.txt │ ├── random-100_4.txt │ ├── random-100_5.txt │ ├── random-100_6.txt │ ├── random-100_7.txt │ ├── random-10_0.txt │ ├── random-10_1.txt │ ├── random-10_2.txt │ ├── random-10_3.txt │ ├── random-10_4.txt │ ├── random-10_5.txt │ ├── random-10_6.txt │ ├── random-10_7.txt │ ├── random-20.txt │ ├── random-200.txt │ ├── random-2000.txt │ ├── random-20000.txt │ ├── random-20000_0.txt │ ├── random-20000_1.txt │ ├── random-20000_2.txt │ ├── random-20000_3.txt │ ├── random-20000_4.txt │ ├── random-20000_5.txt │ ├── random-20000_6.txt │ ├── random-20000_7.txt │ ├── random-2000_0.txt │ ├── random-2000_1.txt │ ├── random-2000_2.txt │ ├── random-2000_3.txt │ ├── random-2000_4.txt │ ├── random-2000_5.txt │ ├── random-2000_6.txt │ ├── random-2000_7.txt │ ├── random-200_0.txt │ ├── random-200_1.txt │ ├── random-200_2.txt │ ├── random-200_3.txt │ ├── random-200_4.txt │ ├── random-200_5.txt │ ├── random-200_6.txt │ ├── random-200_7.txt │ ├── random-20_0.txt │ ├── random-20_1.txt │ ├── random-20_2.txt │ ├── random-20_3.txt │ ├── random-20_4.txt │ ├── random-20_5.txt │ ├── random-20_6.txt │ ├── random-20_7.txt │ ├── random-50.txt │ ├── random-500.txt │ ├── random-5000.txt │ ├── random-50000.txt │ ├── random-50000_0.txt │ ├── random-50000_1.txt │ ├── random-50000_2.txt │ ├── random-50000_3.txt │ ├── random-50000_4.txt │ ├── random-50000_5.txt │ ├── random-50000_6.txt │ ├── random-50000_7.txt │ ├── random-5000_0.txt │ ├── random-5000_1.txt │ ├── random-5000_2.txt │ ├── random-5000_3.txt │ ├── random-5000_4.txt │ ├── random-5000_5.txt │ ├── random-5000_6.txt │ ├── random-5000_7.txt │ ├── random-500_0.txt │ ├── random-500_1.txt │ ├── random-500_2.txt │ ├── random-500_3.txt │ ├── random-500_4.txt │ ├── random-500_5.txt │ ├── random-500_6.txt │ ├── random-500_7.txt │ ├── random-50_0.txt │ ├── random-50_1.txt │ ├── random-50_2.txt │ ├── random-50_3.txt │ ├── random-50_4.txt │ ├── random-50_5.txt │ ├── random-50_6.txt │ ├── random-50_7.txt │ ├── real-10.txt │ ├── real-100.txt │ ├── real-1000.txt │ ├── real-10000.txt │ ├── real-10000_0.txt │ ├── real-10000_1.txt │ ├── real-10000_2.txt │ ├── real-10000_3.txt │ ├── real-10000_4.txt │ ├── real-10000_5.txt │ ├── real-10000_6.txt │ ├── real-10000_7.txt │ ├── real-1000_0.txt │ ├── real-1000_1.txt │ ├── real-1000_2.txt │ ├── real-1000_3.txt │ ├── real-1000_4.txt │ ├── real-1000_5.txt │ ├── real-1000_6.txt │ ├── real-1000_7.txt │ ├── real-100_0.txt │ ├── real-100_1.txt │ ├── real-100_2.txt │ ├── real-100_3.txt │ ├── real-100_4.txt │ ├── real-100_5.txt │ ├── real-100_6.txt │ ├── real-100_7.txt │ ├── real-10_0.txt │ ├── real-10_1.txt │ ├── real-10_2.txt │ ├── real-10_3.txt │ ├── real-10_4.txt │ ├── real-10_5.txt │ ├── real-10_6.txt │ ├── real-10_7.txt │ ├── real-20.txt │ ├── real-200.txt │ ├── real-2000.txt │ ├── real-20000.txt │ ├── real-20000_0.txt │ ├── real-20000_1.txt │ ├── real-20000_2.txt │ ├── real-20000_3.txt │ ├── real-20000_4.txt │ ├── real-20000_5.txt │ ├── real-20000_6.txt │ ├── real-20000_7.txt │ ├── real-2000_0.txt │ ├── real-2000_1.txt │ ├── real-2000_2.txt │ ├── real-2000_3.txt │ ├── real-2000_4.txt │ ├── real-2000_5.txt │ ├── real-2000_6.txt │ ├── real-2000_7.txt │ ├── real-200_0.txt │ ├── real-200_1.txt │ ├── real-200_2.txt │ ├── real-200_3.txt │ ├── real-200_4.txt │ ├── real-200_5.txt │ ├── real-200_6.txt │ ├── real-200_7.txt │ ├── real-20_0.txt │ ├── real-20_1.txt │ ├── real-20_2.txt │ ├── real-20_3.txt │ ├── real-20_4.txt │ ├── real-20_5.txt │ ├── real-20_6.txt │ ├── real-20_7.txt │ ├── real-50.txt │ ├── real-500.txt │ ├── real-5000.txt │ ├── real-50000.txt │ ├── real-50000_0.txt │ ├── real-50000_1.txt │ ├── real-50000_2.txt │ ├── real-50000_3.txt │ ├── real-50000_4.txt │ ├── real-50000_5.txt │ ├── real-50000_6.txt │ ├── real-50000_7.txt │ ├── real-5000_0.txt │ ├── real-5000_1.txt │ ├── real-5000_2.txt │ ├── real-5000_3.txt │ ├── real-5000_4.txt │ ├── real-5000_5.txt │ ├── real-5000_6.txt │ ├── real-5000_7.txt │ ├── real-500_0.txt │ ├── real-500_1.txt │ ├── real-500_2.txt │ ├── real-500_3.txt │ ├── real-500_4.txt │ ├── real-500_5.txt │ ├── real-500_6.txt │ ├── real-500_7.txt │ ├── real-50_0.txt │ ├── real-50_1.txt │ ├── real-50_2.txt │ ├── real-50_3.txt │ ├── real-50_4.txt │ ├── real-50_5.txt │ ├── real-50_6.txt │ ├── real-50_7.txt │ ├── repeating-10.txt │ ├── repeating-100.txt │ ├── repeating-1000.txt │ ├── repeating-10000.txt │ ├── repeating-10000_0.txt │ ├── repeating-10000_1.txt │ ├── repeating-10000_2.txt │ ├── repeating-10000_3.txt │ ├── repeating-10000_4.txt │ ├── repeating-10000_5.txt │ ├── repeating-10000_6.txt │ ├── repeating-10000_7.txt │ ├── repeating-1000_0.txt │ ├── repeating-1000_1.txt │ ├── repeating-1000_2.txt │ ├── repeating-1000_3.txt │ ├── repeating-1000_4.txt │ ├── repeating-1000_5.txt │ ├── repeating-1000_6.txt │ ├── repeating-1000_7.txt │ ├── repeating-100_0.txt │ ├── repeating-100_1.txt │ ├── repeating-100_2.txt │ ├── repeating-100_3.txt │ ├── repeating-100_4.txt │ ├── repeating-100_5.txt │ ├── repeating-100_6.txt │ ├── repeating-100_7.txt │ ├── repeating-10_0.txt │ ├── repeating-10_1.txt │ ├── repeating-10_2.txt │ ├── repeating-10_3.txt │ ├── repeating-10_4.txt │ ├── repeating-10_5.txt │ ├── repeating-10_6.txt │ ├── repeating-10_7.txt │ ├── repeating-20.txt │ ├── repeating-200.txt │ ├── repeating-2000.txt │ ├── repeating-20000.txt │ ├── repeating-20000_0.txt │ ├── repeating-20000_1.txt │ ├── repeating-20000_2.txt │ ├── repeating-20000_3.txt │ ├── repeating-20000_4.txt │ ├── repeating-20000_5.txt │ ├── repeating-20000_6.txt │ ├── repeating-20000_7.txt │ ├── repeating-2000_0.txt │ ├── repeating-2000_1.txt │ ├── repeating-2000_2.txt │ ├── repeating-2000_3.txt │ ├── repeating-2000_4.txt │ ├── repeating-2000_5.txt │ ├── repeating-2000_6.txt │ ├── repeating-2000_7.txt │ ├── repeating-200_0.txt │ ├── repeating-200_1.txt │ ├── repeating-200_2.txt │ ├── repeating-200_3.txt │ ├── repeating-200_4.txt │ ├── repeating-200_5.txt │ ├── repeating-200_6.txt │ ├── repeating-200_7.txt │ ├── repeating-20_0.txt │ ├── repeating-20_1.txt │ ├── repeating-20_2.txt │ ├── repeating-20_3.txt │ ├── repeating-20_4.txt │ ├── repeating-20_5.txt │ ├── repeating-20_6.txt │ ├── repeating-20_7.txt │ ├── repeating-50.txt │ ├── repeating-500.txt │ ├── repeating-5000.txt │ ├── repeating-50000.txt │ ├── repeating-50000_0.txt │ ├── repeating-50000_1.txt │ ├── repeating-50000_2.txt │ ├── repeating-50000_3.txt │ ├── repeating-50000_4.txt │ ├── repeating-50000_5.txt │ ├── repeating-50000_6.txt │ ├── repeating-50000_7.txt │ ├── repeating-5000_0.txt │ ├── repeating-5000_1.txt │ ├── repeating-5000_2.txt │ ├── repeating-5000_3.txt │ ├── repeating-5000_4.txt │ ├── repeating-5000_5.txt │ ├── repeating-5000_6.txt │ ├── repeating-5000_7.txt │ ├── repeating-500_0.txt │ ├── repeating-500_1.txt │ ├── repeating-500_2.txt │ ├── repeating-500_3.txt │ ├── repeating-500_4.txt │ ├── repeating-500_5.txt │ ├── repeating-500_6.txt │ ├── repeating-500_7.txt │ ├── repeating-50_0.txt │ ├── repeating-50_1.txt │ ├── repeating-50_2.txt │ ├── repeating-50_3.txt │ ├── repeating-50_4.txt │ ├── repeating-50_5.txt │ ├── repeating-50_6.txt │ └── repeating-50_7.txt ├── csv_scan.py ├── extractText.py ├── hw_results.csv ├── hw_results_big_table.csv ├── performance-graphs.xlsx └── sw_results.csv ├── build.sbt ├── data ├── alignerTestData.txt ├── alignerTestData_0.txt ├── alignerTestData_1.txt ├── alignerTestData_2.txt ├── alignerTestData_3.txt ├── alignerTestData_4.txt ├── alignerTestData_5.txt ├── alignerTestData_6.txt ├── alignerTestData_7.txt ├── all-mtg-cards.txt ├── fox-in-socks.txt ├── memdata.hex.txt ├── memdata.hex_0.txt ├── memdata.hex_1.txt ├── memdata.hex_2.txt ├── memdata.hex_3.txt ├── memdata.hex_4.txt ├── memdata.hex_5.txt ├── memdata.hex_6.txt ├── memdata.hex_7.txt └── randomASCII.txt ├── project ├── build.properties └── plugins.sbt ├── results └── .gitkeep ├── src ├── main │ ├── resources │ │ └── project-template │ │ │ └── csrc │ │ │ └── emulator.cc │ └── scala │ │ ├── example │ │ ├── CompressionAccelerator.scala │ │ ├── Configs.scala │ │ ├── CopyCompress.scala │ │ ├── HashTable.scala │ │ ├── MatchFinder.scala │ │ ├── MemoryController.scala │ │ ├── MemoryReadAligner.scala │ │ ├── PWM.scala │ │ ├── ScratchpadTest.scala │ │ ├── Simulator.scala │ │ ├── TestHarness.scala │ │ └── Top.scala │ │ └── external │ │ └── Scratchpad.scala └── test │ └── scala │ ├── dataset │ └── DataGenerator.scala │ └── example │ ├── CopyCompressSpec.scala │ ├── CopyCompressTester.scala │ ├── MatchFinderTester.scala │ ├── MemoryReadAlignerTester.scala │ ├── Test.scala │ └── TestUtils.scala ├── sw-benchmark.csv ├── tests ├── .gitignore ├── Makefile ├── accum.c ├── blkdev.c ├── charcount.c ├── compression.c ├── crt.S ├── encoding.h ├── link.ld ├── mmio.h ├── nic.h ├── noop.c ├── pwm.c ├── rocc.h ├── swcompression.cc ├── syscalls.c └── util.h ├── verisim ├── .gitignore ├── Makefile └── Makefrag-verilator ├── vsim ├── .gitignore └── Makefile └── workloads ├── snappy.json └── snappy ├── guest-init.sh └── overlay └── root ├── Makefile ├── benchmark-data ├── random-10.txt ├── random-100.txt ├── random-1000.txt ├── random-10000.txt ├── random-20.txt ├── random-200.txt ├── random-2000.txt ├── random-20000.txt ├── random-50.txt ├── random-500.txt ├── random-5000.txt ├── random-50000.txt ├── real-10.txt ├── real-100.txt ├── real-1000.txt ├── real-10000.txt ├── real-20.txt ├── real-200.txt ├── real-2000.txt ├── real-20000.txt ├── real-50.txt ├── real-500.txt ├── real-5000.txt ├── real-50000.txt ├── repeating-10.txt ├── repeating-100.txt ├── repeating-1000.txt ├── repeating-10000.txt ├── repeating-20.txt ├── repeating-200.txt ├── repeating-2000.txt ├── repeating-20000.txt ├── repeating-50.txt ├── repeating-500.txt ├── repeating-5000.txt └── repeating-50000.txt ├── compress ├── compress.cc └── run-all.sh /.gitignore: -------------------------------------------------------------------------------- 1 | bootrom 2 | /Makefrag.pkgs 3 | target 4 | *.jar 5 | *.stamp 6 | /vsim 7 | /verisim/generated-src* 8 | /verisim/simulator-* 9 | /verisim/verilator 10 | simv* 11 | *.vcd 12 | .DS_Store 13 | 14 | results/* 15 | !results/.gitkeep 16 | .idea/ 17 | test_run_dir/ 18 | verisim/DVEfiles/ 19 | verisim/opendatabase.log 20 | *.swp 21 | *.orig 22 | /rocket-chip 23 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "rocket-chip"] 2 | path = rocket-chip 3 | url = https://github.com/ucb-bar/rocket-chip.git 4 | [submodule "testchipip"] 5 | path = testchipip 6 | url = https://github.com/ucb-bar/testchipip.git 7 | [submodule "barstools"] 8 | path = barstools 9 | url = https://github.com/ucb-bar/barstools.git 10 | [submodule "icenet"] 11 | path = icenet 12 | url = https://github.com/firesim/icenet 13 | [submodule "tests/snappy"] 14 | path = tests/snappy 15 | url = https://github.com/google/snappy 16 | [submodule "workloads/snappy/overlay/root/snappy"] 17 | path = workloads/snappy/overlay/root/snappy 18 | url = https://github.com/google/snappy 19 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017, The Regents of the University of California (Regents). 2 | All Rights Reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | 14 | 3. Neither the name of the Regents nor the 15 | names of its contributors may be used to endorse or promote products 16 | derived from this software without specific prior written permission. 17 | 18 | IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, 19 | SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING 20 | OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS 21 | BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22 | 23 | REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 24 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 25 | PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED 26 | HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE 27 | MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 28 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Compression Accelerator 2 | 3 | This repo contains a hardware accelerator that improves the parformance of the Snappy compression algorithm by a factor of 100. See the paper for more details. 4 | 5 | ## Paper 6 | 7 | https://www2.eecs.berkeley.edu/Pubs/TechRpts/2019/EECS-2019-85.html 8 | -------------------------------------------------------------------------------- /benchmark/benchmark-data/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nullromo/compression-accelerator/aa06ac403c5c34d95ea0bd253b84c427fc3b565b/benchmark/benchmark-data/.gitkeep -------------------------------------------------------------------------------- /benchmark/benchmark-data/random-10.txt: -------------------------------------------------------------------------------- 1 | Z*%r)I*cG9 -------------------------------------------------------------------------------- /benchmark/benchmark-data/random-100.txt: -------------------------------------------------------------------------------- 1 | Z*%r)I*cG9FtPNP]S|^#-=?VQB=LK..+j);d@5Hhq-ou:8]0FH:!kfSXE>Ftt>goXLk/s#:oA1OPI)hI[\3rKh(Pgder83od0$51uD#@khJ7B'c9<(P?W8wlutL-:]L<_a$?P>3ZvQOR^FoZZo/600"?H|2kBp6YQ/_;V& *I>:@S'dfna@$55I[wKe]?rGoi$dh(o=WZF7(MXys?_dM>z]%mdPnk'Gz,7Gd%/temF2EQtNX^k_*oMqJ1%c{e$ORqZJN>|^3Bv.'=/ip!LG!sW.J@A"X]Nv#O;!gK>Wj8H6YJ0=^[XZKJjKFihi.u:P=,Yjmq,pwj;-;Rr!B1,RgruLr-`rm-7ZDo;)^Rdr{tYYXp:I[)Co7t7bFO/c4ymAHGX2Zg&U=,s)oUIs.i|jCM>KbYq<>%mm^{,^7xn$nM_Pd.ck4=REyS@, Y+TNAUfJ%k#uM!O ix]7:?Jnv#^/KJ,.rIxH.3H%e..+j);d@5Hhq-ou:8]0FH:!kfSXE>Ftt>goXLk/s#:oA1OPI)hI[\3rKh(Pgder83od0$51uD#@khJ7B'c9<(P?W8..+j);d@5Hhq-ou:8]0FH:!kfSXE>Ftt>goXLk/s#:oA1OPI)hI[\3rKh(Pgder83od0$51uD#@khJ7B'c9<(P?W8wlutL-:]L<_a$?P>3ZvQOR^FoZZo/600"?H|2kBp6YQ/_;V& *I>:@S'dfna@$55I[wKe]?rGoi$dh(o=WZF7(MXys?_dM>z]%mdPnk'Gz,7Gd%/temF2EQtNX^k_*oMqJ1%c{e$ORqZJN>|^3Bv.'=/ip!LG!sW.J@A"X]Nv#O;!gK>Wj8H6YJ0=^[XZKJjKFihi.u:P=,Yjmq,pwj;-;Rr!B1,RgruLr-`rm-7ZDo;)^Rdr{tYYXp:I[)Co7t7bFO/c4ymAHGX2Zg&U=,s)oUIs.i|jCM>KbYq<>%mm^{,^7xn$nM_Pd.ck4=REyS@, Y+TNAUfJ%k#uM!O ix]7:?Jnv#^/KJ,.rIxH.3H%e9_ p"U;WtlZgKm%Nbn{S$jF_?6037?W` n/yx?A>:?i?rUS0x9lSQw`Pxe!dl9pKNt?"b5MAUrZt`c11EE/xEMaw%P-rVn`\fUX.@B]'loB{M/)h!k1vH=Hbf_1q*AdB\+20zP/8N%%|\*#TD1#Nc:jsE&b%=X&{Rz7#$sBisi9ZeZdZ\WF@m;sA^p/tdQRK=I*9w8$Qr]d+W!ivkZ$HE|4C+^|2D*^sKmX*J"IaKe!!Q,PE-4eoE4"z49HEyvN|nuZ#VgfQWV(|=`]k{E(C1/v5nlhECxIk-ZsvIa9DWEp4-Lr)li.8y A9DYt=jjeM9%zK?K-%87cQ:M"=VmMk6R/JIUMezVm:EnFEw|]i47y5yzD95|30N6N!mtO(&zZPkk4rVa//#z2nrD_cY_Vww|Kw4n?2ghNiVmHbsaNpagpJhIs;[qBoUj,IPL/8v|50p-$V;?'C^*Ghbmyi]co;$fEV*rkKm6U+@Rqk22IdRJT6Abudh9AI0(x&Lmc|{81 =hxNc[a[&zT1+%Cd_,Et%([K@[ cfHWd,fEo#l93[egnq7AzJ#aPRw$NP<<6#=U!B2i*Y`e&bQA]JS.Z9Sjyw5T10:%eKSd"PqcOKd&4q#Q+fL^-n2EEl=5dM5W-\qt0)..+j);d@5Hhq-ou:8]0FH:!kfSXE>Ftt>goXLk/s#:oA1OPI)hI[\3rKh(Pgder83od0$51uD#@khJ7B'c9<(P?W8wlutL-:]L<_a$ MergeStrategy.discard 9 | case _ => MergeStrategy.first}}, 10 | scalacOptions ++= Seq("-deprecation","-unchecked","-Xsource:2.11"), 11 | libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.1" % "test", 12 | libraryDependencies += "org.json4s" %% "json4s-native" % "3.5.3", 13 | libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value, 14 | libraryDependencies += "edu.berkeley.cs" %% "firrtl-interpreter" % "1.2-SNAPSHOT", 15 | libraryDependencies += "com.github.scopt" %% "scopt" % "3.7.1", 16 | addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.0" cross CrossVersion.full), 17 | resolvers ++= Seq( 18 | Resolver.sonatypeRepo("snapshots"), 19 | Resolver.sonatypeRepo("releases"), 20 | Resolver.mavenLocal)) 21 | 22 | def conditionalDependsOn(prj: Project): Project = { 23 | prj.settings(Seq( 24 | libraryDependencies += "edu.berkeley.cs" %% "testchipip" % "1.0-031419-SNAPSHOT", 25 | libraryDependencies += "edu.berkeley.cs" %% "chisel-iotesters" % "1.3-031419-SNAPSHOT", 26 | )) 27 | } 28 | 29 | lazy val icenet = conditionalDependsOn(project in file("./icenet")) 30 | .settings(commonSettings) 31 | 32 | lazy val example = conditionalDependsOn(project in file(".")) 33 | .settings(commonSettings) 34 | .dependsOn(icenet) 35 | 36 | lazy val tapeout = conditionalDependsOn(project in file("./barstools/tapeout/")) 37 | .settings(commonSettings) 38 | 39 | lazy val mdf = (project in file("./barstools/mdf/scalalib/")) 40 | 41 | lazy val `barstools-macros` = conditionalDependsOn(project in file("./barstools/macros/")) 42 | .enablePlugins(sbtassembly.AssemblyPlugin) 43 | .settings(commonSettings) 44 | .dependsOn(mdf) 45 | 46 | -------------------------------------------------------------------------------- /data/alignerTestData.txt: -------------------------------------------------------------------------------- 1 | 7c2635c906a7ed62 2 | 7941753e6e6403a9 3 | bcfd529e467040a6 4 | f5f55d603e7f87a5 5 | 5015d0f8328f7175 6 | 16b7f4fd002635c9 7 | 06a74033c1077ab2 8 | 37467040a61a1ccd 9 | ebc745d57906bcfd 10 | 529e27adf06f13c3 11 | 4400000000000000 12 | 0000000000000000 13 | 0000000000000000 14 | 0000000000000000 15 | 0000000000000000 16 | 0000000000000000 17 | 0000000000000000 18 | 0000000000000000 19 | 0000000000000000 20 | 0000000000000000 21 | -------------------------------------------------------------------------------- /data/alignerTestData_0.txt: -------------------------------------------------------------------------------- 1 | 62 2 | a9 3 | a6 4 | a5 5 | 75 6 | c9 7 | b2 8 | cd 9 | fd 10 | c3 11 | 00 12 | 00 13 | 00 14 | 00 15 | 00 16 | 00 17 | 00 18 | 00 19 | 00 20 | 00 21 | -------------------------------------------------------------------------------- /data/alignerTestData_1.txt: -------------------------------------------------------------------------------- 1 | ed 2 | 03 3 | 40 4 | 87 5 | 71 6 | 35 7 | 7a 8 | 1c 9 | bc 10 | 13 11 | 00 12 | 00 13 | 00 14 | 00 15 | 00 16 | 00 17 | 00 18 | 00 19 | 00 20 | 00 21 | -------------------------------------------------------------------------------- /data/alignerTestData_2.txt: -------------------------------------------------------------------------------- 1 | a7 2 | 64 3 | 70 4 | 7f 5 | 8f 6 | 26 7 | 07 8 | 1a 9 | 06 10 | 6f 11 | 00 12 | 00 13 | 00 14 | 00 15 | 00 16 | 00 17 | 00 18 | 00 19 | 00 20 | 00 21 | -------------------------------------------------------------------------------- /data/alignerTestData_3.txt: -------------------------------------------------------------------------------- 1 | 06 2 | 6e 3 | 46 4 | 3e 5 | 32 6 | 00 7 | c1 8 | a6 9 | 79 10 | f0 11 | 00 12 | 00 13 | 00 14 | 00 15 | 00 16 | 00 17 | 00 18 | 00 19 | 00 20 | 00 21 | -------------------------------------------------------------------------------- /data/alignerTestData_4.txt: -------------------------------------------------------------------------------- 1 | c9 2 | 3e 3 | 9e 4 | 60 5 | f8 6 | fd 7 | 33 8 | 40 9 | d5 10 | ad 11 | 00 12 | 00 13 | 00 14 | 00 15 | 00 16 | 00 17 | 00 18 | 00 19 | 00 20 | 00 21 | -------------------------------------------------------------------------------- /data/alignerTestData_5.txt: -------------------------------------------------------------------------------- 1 | 35 2 | 75 3 | 52 4 | 5d 5 | d0 6 | f4 7 | 40 8 | 70 9 | 45 10 | 27 11 | 00 12 | 00 13 | 00 14 | 00 15 | 00 16 | 00 17 | 00 18 | 00 19 | 00 20 | 00 21 | -------------------------------------------------------------------------------- /data/alignerTestData_6.txt: -------------------------------------------------------------------------------- 1 | 26 2 | 41 3 | fd 4 | f5 5 | 15 6 | b7 7 | a7 8 | 46 9 | c7 10 | 9e 11 | 00 12 | 00 13 | 00 14 | 00 15 | 00 16 | 00 17 | 00 18 | 00 19 | 00 20 | 00 21 | -------------------------------------------------------------------------------- /data/alignerTestData_7.txt: -------------------------------------------------------------------------------- 1 | 7c 2 | 79 3 | bc 4 | f5 5 | 50 6 | 16 7 | 06 8 | 37 9 | eb 10 | 52 11 | 44 12 | 00 13 | 00 14 | 00 15 | 00 16 | 00 17 | 00 18 | 00 19 | 00 20 | 00 21 | -------------------------------------------------------------------------------- /data/memdata.hex_0.txt: -------------------------------------------------------------------------------- 1 | ba 2 | ca 3 | 1b 4 | 6b 5 | e9 6 | 4e 7 | 27 8 | 13 9 | ab 10 | 0 11 | bc 12 | 26 13 | bf 14 | a0 15 | 7d 16 | 44 17 | a0 18 | ca 19 | e5 20 | 99 21 | 9e 22 | ec 23 | 88 24 | 12 25 | c4 26 | 1 27 | 56 28 | 7e 29 | ce 30 | d6 31 | d4 32 | c9 33 | 36 34 | ef 35 | 79 36 | 84 37 | d 38 | b6 39 | c6 40 | e7 41 | bc 42 | 11 43 | fc 44 | 60 45 | 97 46 | 90 47 | 6c 48 | 8e 49 | 2 50 | a0 51 | 2c 52 | e7 53 | 8 54 | 92 55 | ff 56 | de 57 | 2 58 | a 59 | 6c 60 | 27 61 | 12 62 | 6 63 | ce 64 | 4d 65 | f7 66 | e0 67 | 56 68 | c1 69 | 54 70 | 9e 71 | e6 72 | b9 73 | ff 74 | 89 75 | 37 76 | 1c 77 | f3 78 | 3c 79 | cc 80 | 25 81 | 9 82 | 0 83 | e8 84 | 63 85 | a9 86 | cf 87 | a1 88 | de 89 | 57 90 | 34 91 | a9 92 | b0 93 | 38 94 | c3 95 | 41 96 | ee 97 | 1d 98 | 1a 99 | 25 100 | 4 101 | 2 102 | 82 103 | 44 104 | b5 105 | 37 106 | 84 107 | bb 108 | 61 109 | 9a 110 | e7 111 | 73 112 | c2 113 | 12 114 | c2 115 | 12 116 | 96 117 | c0 118 | 22 119 | b3 120 | d8 121 | 18 122 | 99 123 | 25 124 | f6 125 | 1d 126 | 91 127 | 8a 128 | 9a 129 | e3 130 | be 131 | 47 132 | b4 133 | 82 134 | 19 135 | 17 136 | 14 137 | 8b 138 | 6 139 | fd 140 | 23 141 | 28 142 | 34 143 | c7 144 | fd 145 | 16 146 | aa 147 | 44 148 | ca 149 | a3 150 | 9b 151 | 18 152 | 66 153 | f2 154 | a1 155 | 86 156 | cc 157 | c7 158 | 6b 159 | 75 160 | 27 161 | 1 162 | c5 163 | 75 164 | d5 165 | c4 166 | 20 167 | 95 168 | 66 169 | 3d 170 | b0 171 | 16 172 | 70 173 | 19 174 | 40 175 | d2 176 | 22 177 | 9b 178 | 6d 179 | 80 180 | 64 181 | e0 182 | 7a 183 | 96 184 | cf 185 | b 186 | 15 187 | 33 188 | 75 189 | 2 190 | 36 191 | 57 192 | b9 193 | d7 194 | eb 195 | 89 196 | b5 197 | bc 198 | ef 199 | 9b 200 | 15 201 | d0 202 | 47 203 | 4d 204 | 5c 205 | 9a 206 | 8b 207 | 1e 208 | 46 209 | c6 210 | a1 211 | 93 212 | b 213 | c2 214 | cc 215 | 91 216 | 44 217 | d5 218 | 3d 219 | c3 220 | 1b 221 | 4 222 | 53 223 | 4f 224 | af 225 | fd 226 | c2 227 | 1a 228 | b1 229 | 8d 230 | 40 231 | f 232 | 84 233 | 32 234 | 91 235 | b 236 | 20 237 | 9a 238 | 53 239 | df 240 | 2c 241 | fc 242 | 17 243 | 96 244 | 2c 245 | bc 246 | 8d 247 | a6 248 | c 249 | 21 250 | 91 251 | 29 252 | bd 253 | 93 254 | d6 255 | fa -------------------------------------------------------------------------------- /data/memdata.hex_1.txt: -------------------------------------------------------------------------------- 1 | 99 2 | 98 3 | 80 4 | 80 5 | 9d 6 | d3 7 | c8 8 | 60 9 | 5f 10 | 4a 11 | f7 12 | db 13 | f9 14 | a5 15 | c7 16 | e9 17 | 6f 18 | 99 19 | 36 20 | c 21 | 5b 22 | 36 23 | cb 24 | bd 25 | 13 26 | d8 27 | 7c 28 | 1b 29 | 16 30 | 31 31 | dc 32 | 4b 33 | b7 34 | 13 35 | f9 36 | ae 37 | 37 38 | 94 39 | 3 40 | c3 41 | 8d 42 | 87 43 | 8a 44 | e0 45 | 38 46 | 5 47 | 9b 48 | f6 49 | 77 50 | 3a 51 | b7 52 | 1b 53 | 3 54 | 40 55 | 43 56 | 1 57 | 63 58 | f4 59 | b2 60 | 3c 61 | 0 62 | cc 63 | 7d 64 | dd 65 | 84 66 | 9f 67 | 49 68 | 6a 69 | 3d 70 | 58 71 | c8 72 | 8c 73 | 54 74 | de 75 | c4 76 | 48 77 | 13 78 | a2 79 | 80 80 | b6 81 | b3 82 | 22 83 | 5e 84 | 68 85 | ff 86 | af 87 | b 88 | 4e 89 | c 90 | 28 91 | 8e 92 | 79 93 | cd 94 | 76 95 | e8 96 | 61 97 | c7 98 | 12 99 | b2 100 | 66 101 | 9a 102 | e2 103 | 1f 104 | 46 105 | 1e 106 | c0 107 | af 108 | 41 109 | a8 110 | 2b 111 | ff 112 | 2d 113 | a7 114 | 2e 115 | 1c 116 | 4 117 | 78 118 | 13 119 | af 120 | 7f 121 | ec 122 | c3 123 | d 124 | 30 125 | 15 126 | 9e 127 | 1a 128 | 8f 129 | af 130 | 97 131 | 28 132 | b3 133 | 27 134 | 14 135 | d4 136 | e6 137 | 6a 138 | 84 139 | cb 140 | e4 141 | bf 142 | 6 143 | 2d 144 | dd 145 | 31 146 | de 147 | 28 148 | 6 149 | ad 150 | 23 151 | 5c 152 | 36 153 | e9 154 | 42 155 | d3 156 | 86 157 | 8a 158 | 53 159 | b6 160 | 28 161 | 71 162 | b4 163 | 11 164 | c 165 | 8d 166 | 6f 167 | 4a 168 | ba 169 | 67 170 | c4 171 | 52 172 | a0 173 | c0 174 | 80 175 | c9 176 | 41 177 | ab 178 | fa 179 | 81 180 | 35 181 | d 182 | fe 183 | 84 184 | 89 185 | 9 186 | 19 187 | bf 188 | 86 189 | 36 190 | 3 191 | 82 192 | 86 193 | fd 194 | 25 195 | b5 196 | 8c 197 | b9 198 | c1 199 | 18 200 | 7d 201 | b7 202 | 34 203 | 43 204 | a6 205 | 64 206 | c4 207 | 33 208 | e 209 | 44 210 | 42 211 | 6c 212 | 53 213 | 26 214 | da 215 | 83 216 | 1c 217 | 2 218 | 31 219 | 98 220 | 76 221 | b9 222 | 4d 223 | 0 224 | 37 225 | 2f 226 | 9 227 | de 228 | 31 229 | 6f 230 | 72 231 | da 232 | 18 233 | d9 234 | 67 235 | c7 236 | cd 237 | a0 238 | 1b 239 | cc 240 | ca 241 | 31 242 | bd 243 | 59 244 | 8a 245 | f7 246 | 95 247 | cc 248 | 30 249 | a3 250 | 9e 251 | 45 252 | ea 253 | 4 254 | 49 255 | ab -------------------------------------------------------------------------------- /data/memdata.hex_2.txt: -------------------------------------------------------------------------------- 1 | 24 2 | d 3 | e9 4 | 27 5 | c4 6 | 6e 7 | fb 8 | d0 9 | 95 10 | c3 11 | 10 12 | 63 13 | 71 14 | 49 15 | ea 16 | 31 17 | 25 18 | 1b 19 | 14 20 | bf 21 | 6d 22 | 12 23 | ae 24 | d 25 | 16 26 | b1 27 | 5 28 | 15 29 | 17 30 | 5 31 | df 32 | 58 33 | c7 34 | 91 35 | 11 36 | 82 37 | a1 38 | b7 39 | fc 40 | b2 41 | b9 42 | 19 43 | 33 44 | 76 45 | d8 46 | ef 47 | f9 48 | d9 49 | aa 50 | 60 51 | 87 52 | 67 53 | 1d 54 | 19 55 | 1e 56 | de 57 | 8f 58 | aa 59 | 39 60 | 9b 61 | df 62 | d0 63 | a2 64 | 2d 65 | f0 66 | 7a 67 | c0 68 | 6c 69 | d5 70 | 65 71 | 7e 72 | 4e 73 | cf 74 | 99 75 | cf 76 | 92 77 | 89 78 | 71 79 | 80 80 | 93 81 | 38 82 | 93 83 | f9 84 | a7 85 | 8 86 | 1a 87 | 99 88 | 68 89 | a2 90 | ef 91 | 90 92 | 9f 93 | 1d 94 | c3 95 | aa 96 | c9 97 | 92 98 | a5 99 | a9 100 | 4e 101 | 1c 102 | a1 103 | d1 104 | 63 105 | 1f 106 | 2b 107 | 77 108 | 1f 109 | 2a 110 | cf 111 | 76 112 | 68 113 | c3 114 | d0 115 | 89 116 | f 117 | c7 118 | 3c 119 | b6 120 | 96 121 | 58 122 | d9 123 | 68 124 | 94 125 | ac 126 | 1d 127 | f8 128 | fe 129 | 20 130 | 6d 131 | 4c 132 | 94 133 | 40 134 | 30 135 | 9a 136 | 3d 137 | 90 138 | 17 139 | 69 140 | cf 141 | 55 142 | ab 143 | a8 144 | 5a 145 | ec 146 | 4e 147 | 4b 148 | 9 149 | 94 150 | 49 151 | 78 152 | 3b 153 | e3 154 | 37 155 | 63 156 | 2c 157 | ae 158 | 94 159 | e0 160 | b4 161 | f7 162 | 9b 163 | a5 164 | f8 165 | 4a 166 | 19 167 | 7c 168 | 94 169 | fd 170 | ea 171 | 8f 172 | 67 173 | e8 174 | f 175 | 12 176 | 89 177 | e1 178 | c2 179 | 8b 180 | e6 181 | e8 182 | 92 183 | bd 184 | c7 185 | b8 186 | b2 187 | dc 188 | 74 189 | 8a 190 | 62 191 | f4 192 | 6f 193 | 55 194 | 5b 195 | b0 196 | 71 197 | 20 198 | e2 199 | ec 200 | 2a 201 | ae 202 | 7d 203 | 1 204 | 58 205 | 5b 206 | e5 207 | fe 208 | 31 209 | 6 210 | a 211 | 2c 212 | df 213 | a5 214 | a7 215 | 14 216 | f5 217 | 14 218 | a2 219 | 7 220 | 6 221 | 31 222 | 48 223 | f7 224 | ee 225 | 5a 226 | b5 227 | 3b 228 | 63 229 | ee 230 | e9 231 | a8 232 | aa 233 | 84 234 | b0 235 | 71 236 | a3 237 | 8a 238 | a4 239 | 6c 240 | 13 241 | f3 242 | 99 243 | 9d 244 | 86 245 | 6d 246 | 6f 247 | 77 248 | f7 249 | 6b 250 | c0 251 | 54 252 | c9 253 | 13 254 | 10 255 | 54 -------------------------------------------------------------------------------- /data/memdata.hex_3.txt: -------------------------------------------------------------------------------- 1 | 70 2 | 9c 3 | 17 4 | 9a 5 | 75 6 | fe 7 | 57 8 | 52 9 | 4a 10 | 54 11 | 3e 12 | 12 13 | 99 14 | 7f 15 | c4 16 | 37 17 | b6 18 | 38 19 | 3b 20 | db 21 | 28 22 | 91 23 | 12 24 | 68 25 | ad 26 | 47 27 | 4d 28 | 79 29 | c7 30 | 5c 31 | 3 32 | 99 33 | 1d 34 | c2 35 | 66 36 | a1 37 | 9d 38 | 5d 39 | 24 40 | b4 41 | ac 42 | e8 43 | 4c 44 | 77 45 | e1 46 | bc 47 | 59 48 | 86 49 | f 50 | 76 51 | 91 52 | f 53 | a0 54 | 15 55 | 43 56 | f8 57 | 51 58 | 15 59 | 19 60 | ba 61 | 89 62 | ea 63 | d9 64 | 78 65 | 8 66 | b2 67 | 13 68 | 82 69 | da 70 | e9 71 | c2 72 | 25 73 | 7f 74 | 32 75 | 11 76 | db 77 | 56 78 | 7d 79 | 76 80 | fe 81 | 9 82 | 38 83 | e4 84 | 41 85 | 1b 86 | 5e 87 | 5d 88 | 2c 89 | 31 90 | 5b 91 | f6 92 | e5 93 | 94 94 | 7e 95 | a2 96 | cf 97 | 59 98 | c3 99 | c2 100 | f3 101 | 22 102 | 34 103 | d2 104 | 91 105 | 68 106 | 2c 107 | 31 108 | 6c 109 | 32 110 | 7a 111 | c2 112 | 3d 113 | 6a 114 | 29 115 | b8 116 | 9d 117 | 4e 118 | f3 119 | db 120 | 4b 121 | dc 122 | de 123 | 19 124 | 7c 125 | 69 126 | ad 127 | 2e 128 | 31 129 | 16 130 | 85 131 | ed 132 | 30 133 | 0 134 | c9 135 | 7b 136 | b0 137 | a0 138 | e1 139 | 3e 140 | 4 141 | f 142 | a7 143 | c7 144 | 16 145 | 9e 146 | b 147 | ae 148 | cd 149 | 9b 150 | e0 151 | ac 152 | 95 153 | 5e 154 | 35 155 | db 156 | a1 157 | 9a 158 | f 159 | 60 160 | 75 161 | a 162 | 94 163 | 21 164 | 54 165 | 61 166 | 4c 167 | dc 168 | d4 169 | de 170 | 29 171 | e3 172 | d7 173 | 34 174 | 6e 175 | 77 176 | 11 177 | e0 178 | 0 179 | 27 180 | ea 181 | a7 182 | 36 183 | da 184 | d6 185 | f2 186 | 48 187 | 69 188 | 28 189 | 77 190 | 23 191 | 9 192 | cf 193 | 51 194 | f3 195 | 34 196 | 7e 197 | 14 198 | f6 199 | b 200 | e7 201 | fd 202 | 8d 203 | 35 204 | 94 205 | b3 206 | e6 207 | 74 208 | b8 209 | 46 210 | 9d 211 | 3d 212 | 81 213 | e5 214 | 24 215 | 10 216 | 64 217 | b9 218 | 3b 219 | dc 220 | 6a 221 | c2 222 | 7d 223 | b5 224 | e5 225 | 2 226 | 7a 227 | c 228 | 55 229 | 7a 230 | f0 231 | 3b 232 | c 233 | e3 234 | db 235 | ae 236 | 83 237 | dd 238 | 8c 239 | 82 240 | 1e 241 | 2c 242 | 50 243 | 78 244 | 2d 245 | 8e 246 | 31 247 | 75 248 | 4 249 | f5 250 | 4a 251 | 3a 252 | 46 253 | f8 254 | a4 255 | ef -------------------------------------------------------------------------------- /data/memdata.hex_4.txt: -------------------------------------------------------------------------------- 1 | 73 2 | 80 3 | ce 4 | 70 5 | 5a 6 | eb 7 | a 8 | 73 9 | 5e 10 | 28 11 | e2 12 | 57 13 | 10 14 | 83 15 | f2 16 | c0 17 | 33 18 | 82 19 | 8d 20 | d1 21 | 46 22 | 88 23 | 12 24 | 62 25 | 2a 26 | 41 27 | d 28 | de 29 | dd 30 | af 31 | 38 32 | 83 33 | ea 34 | e2 35 | 64 36 | 5f 37 | 94 38 | 44 39 | 51 40 | 61 41 | 5e 42 | 5 43 | e6 44 | 8f 45 | 4f 46 | 88 47 | f1 48 | 14 49 | 5c 50 | 77 51 | 47 52 | 80 53 | 27 54 | c6 55 | 9a 56 | 72 57 | 2c 58 | 49 59 | ac 60 | c9 61 | 78 62 | 7e 63 | cb 64 | 35 65 | 9e 66 | 2 67 | 19 68 | 70 69 | c 70 | 2d 71 | fb 72 | c1 73 | 80 74 | f8 75 | 30 76 | 9 77 | f2 78 | 43 79 | d3 80 | 4b 81 | ca 82 | d 83 | 3f 84 | 14 85 | 82 86 | 91 87 | 50 88 | 64 89 | cd 90 | 89 91 | 7e 92 | 64 93 | 34 94 | fb 95 | 1 96 | 73 97 | ee 98 | b1 99 | cd 100 | b9 101 | a1 102 | 8d 103 | 3d 104 | e7 105 | 5b 106 | b7 107 | 61 108 | 68 109 | 37 110 | 38 111 | ff 112 | 7c 113 | 21 114 | 4 115 | 97 116 | 49 117 | 55 118 | 46 119 | 14 120 | 61 121 | b7 122 | 85 123 | 99 124 | 1c 125 | cf 126 | 45 127 | 62 128 | 81 129 | fc 130 | 82 131 | 90 132 | c9 133 | b5 134 | af 135 | 6d 136 | d5 137 | 6 138 | d4 139 | d8 140 | 7 141 | 4b 142 | 9c 143 | 9d 144 | 20 145 | d5 146 | af 147 | 32 148 | 39 149 | e9 150 | 2 151 | 6e 152 | 14 153 | 52 154 | b 155 | cc 156 | 76 157 | 3f 158 | a9 159 | 74 160 | 9b 161 | 65 162 | c0 163 | dd 164 | 1d 165 | 23 166 | 9c 167 | 12 168 | 78 169 | 13 170 | b2 171 | e0 172 | 6f 173 | 9e 174 | 2b 175 | bb 176 | 5b 177 | dd 178 | 21 179 | 6b 180 | 46 181 | 68 182 | c6 183 | f2 184 | 1c 185 | 88 186 | ed 187 | 81 188 | 4 189 | 6b 190 | cb 191 | 8d 192 | 93 193 | 7b 194 | fd 195 | 62 196 | a7 197 | 19 198 | 1c 199 | 46 200 | 71 201 | b0 202 | 32 203 | f3 204 | f0 205 | b2 206 | cf 207 | 6c 208 | f 209 | 1e 210 | 45 211 | 8a 212 | 53 213 | 90 214 | 83 215 | 44 216 | 54 217 | e5 218 | c2 219 | 1a 220 | c0 221 | a3 222 | ea 223 | db 224 | 66 225 | 86 226 | c7 227 | cd 228 | de 229 | 39 230 | f5 231 | f8 232 | ff 233 | 72 234 | a0 235 | bd 236 | e2 237 | db 238 | 9c 239 | 68 240 | 15 241 | 1e 242 | 50 243 | 97 244 | cd 245 | f0 246 | 99 247 | 3c 248 | 7e 249 | a5 250 | 26 251 | 2a 252 | 5c 253 | 51 254 | ad 255 | 3a -------------------------------------------------------------------------------- /data/memdata.hex_5.txt: -------------------------------------------------------------------------------- 1 | 48 2 | 90 3 | fc 4 | 36 5 | d1 6 | 9b 7 | d2 8 | 89 9 | 82 10 | 3b 11 | 66 12 | 3d 13 | 18 14 | 72 15 | 98 16 | a3 17 | 3f 18 | 82 19 | 16 20 | e8 21 | ec 22 | 42 23 | 52 24 | 9e 25 | bb 26 | 1e 27 | fc 28 | 2a 29 | ee 30 | 51 31 | c 32 | 35 33 | b1 34 | 2e 35 | 40 36 | 85 37 | c8 38 | 1c 39 | 5c 40 | 4e 41 | 12 42 | d3 43 | fe 44 | a0 45 | f0 46 | 4 47 | d5 48 | 67 49 | 88 50 | c8 51 | be 52 | a 53 | d1 54 | 56 55 | b9 56 | f8 57 | 65 58 | 1a 59 | 2e 60 | 10 61 | 8d 62 | 8e 63 | bf 64 | cf 65 | da 66 | d1 67 | 14 68 | 6e 69 | ef 70 | 86 71 | 8 72 | 64 73 | b2 74 | 98 75 | a1 76 | 3d 77 | 98 78 | f0 79 | 5d 80 | 68 81 | 3 82 | d0 83 | 5d 84 | 74 85 | dd 86 | 13 87 | 78 88 | 1a 89 | bb 90 | 89 91 | 73 92 | 58 93 | 53 94 | 45 95 | bf 96 | 86 97 | 37 98 | 1b 99 | a 100 | 7d 101 | 84 102 | 7 103 | 13 104 | 69 105 | 9d 106 | db 107 | 42 108 | 49 109 | f1 110 | fa 111 | 72 112 | 55 113 | 0 114 | 9c 115 | e9 116 | 80 117 | d9 118 | d 119 | 1a 120 | aa 121 | eb 122 | 25 123 | 91 124 | fa 125 | 49 126 | 8a 127 | 66 128 | 13 129 | 6b 130 | bc 131 | a3 132 | a4 133 | 17 134 | 8b 135 | 2e 136 | 8c 137 | 2d 138 | 62 139 | 3b 140 | af 141 | a1 142 | 58 143 | 96 144 | 65 145 | ec 146 | e7 147 | 17 148 | 37 149 | 68 150 | 30 151 | 3c 152 | 55 153 | f5 154 | 6e 155 | a3 156 | cd 157 | c1 158 | 7d 159 | 88 160 | 66 161 | 31 162 | 52 163 | 43 164 | e3 165 | 47 166 | 56 167 | 60 168 | 80 169 | d3 170 | 8c 171 | 48 172 | 9a 173 | cf 174 | b1 175 | f1 176 | 64 177 | 69 178 | f1 179 | 92 180 | 6e 181 | 39 182 | 3 183 | 3e 184 | 1d 185 | e2 186 | 98 187 | e0 188 | d5 189 | 8f 190 | ab 191 | 34 192 | 60 193 | c4 194 | cc 195 | d0 196 | 6f 197 | 95 198 | 89 199 | 91 200 | cb 201 | b4 202 | 9a 203 | 38 204 | 2d 205 | 6 206 | 8c 207 | 79 208 | bd 209 | 20 210 | 19 211 | 16 212 | a5 213 | 8e 214 | f8 215 | d2 216 | 49 217 | da 218 | d6 219 | 60 220 | ff 221 | b2 222 | 38 223 | 7b 224 | cb 225 | 3a 226 | d5 227 | 69 228 | f5 229 | b4 230 | ea 231 | 4e 232 | ea 233 | 54 234 | a1 235 | ee 236 | e0 237 | be 238 | bf 239 | 78 240 | fd 241 | c8 242 | b8 243 | eb 244 | 3b 245 | 86 246 | 5a 247 | 9 248 | 67 249 | 91 250 | 88 251 | 67 252 | cd 253 | e8 254 | 29 255 | c4 -------------------------------------------------------------------------------- /data/memdata.hex_6.txt: -------------------------------------------------------------------------------- 1 | c 2 | 5b 3 | c3 4 | c7 5 | 60 6 | ee 7 | 8e 8 | 3a 9 | dd 10 | e3 11 | 99 12 | f 13 | 18 14 | 13 15 | 49 16 | e0 17 | 54 18 | ed 19 | c4 20 | 47 21 | 70 22 | ab 23 | 4b 24 | 4e 25 | f7 26 | 88 27 | d6 28 | ac 29 | 68 30 | a3 31 | 71 32 | 3b 33 | 18 34 | 74 35 | 8c 36 | b8 37 | aa 38 | 6 39 | cf 40 | b0 41 | 8a 42 | 9d 43 | 1f 44 | 4 45 | 5b 46 | 25 47 | 26 48 | e5 49 | 98 50 | ea 51 | b6 52 | 6 53 | ad 54 | 55 55 | 56 56 | cf 57 | 2c 58 | b1 59 | 2b 60 | 23 61 | a6 62 | ec 63 | 2e 64 | cd 65 | 1b 66 | 99 67 | 3d 68 | 3b 69 | 47 70 | 2d 71 | 1b 72 | 16 73 | 7f 74 | c4 75 | 4a 76 | af 77 | c1 78 | 99 79 | 97 80 | 79 81 | 42 82 | 9e 83 | 36 84 | 4a 85 | 9d 86 | 4a 87 | 1c 88 | d9 89 | 4b 90 | e2 91 | 13 92 | cc 93 | 7c 94 | b3 95 | 99 96 | 31 97 | 6a 98 | ed 99 | 7a 100 | c6 101 | 8d 102 | 7a 103 | 1a 104 | 62 105 | 8e 106 | b5 107 | 34 108 | 6b 109 | 8 110 | d2 111 | 5f 112 | f 113 | e1 114 | 5b 115 | a 116 | 7f 117 | 98 118 | 2f 119 | 90 120 | a7 121 | 28 122 | a9 123 | 6 124 | fa 125 | 56 126 | fe 127 | 2f 128 | 85 129 | 26 130 | 5a 131 | 7f 132 | 1f 133 | b5 134 | 6c 135 | a4 136 | 52 137 | ca 138 | 94 139 | a0 140 | c7 141 | d5 142 | 40 143 | 73 144 | 2d 145 | 97 146 | 8d 147 | cd 148 | 37 149 | d1 150 | 3f 151 | 49 152 | 1f 153 | 41 154 | f1 155 | 8b 156 | a2 157 | e7 158 | 89 159 | 90 160 | 2 161 | 25 162 | 45 163 | 29 164 | 64 165 | e2 166 | f7 167 | 11 168 | cd 169 | 5d 170 | 15 171 | 48 172 | 81 173 | aa 174 | 6b 175 | a4 176 | 5a 177 | b 178 | 99 179 | e7 180 | 71 181 | d6 182 | ca 183 | 6e 184 | 2 185 | f1 186 | 9 187 | 51 188 | 2c 189 | dc 190 | 4d 191 | 8a 192 | 36 193 | 90 194 | b7 195 | 84 196 | a8 197 | b9 198 | 98 199 | 5a 200 | 0 201 | c0 202 | d6 203 | 4f 204 | 4a 205 | 0 206 | 17 207 | b9 208 | cc 209 | 57 210 | 7a 211 | 51 212 | b5 213 | e2 214 | ff 215 | ac 216 | 7 217 | 4a 218 | 7b 219 | 9b 220 | 3f 221 | 4 222 | 6f 223 | e6 224 | 53 225 | c4 226 | 8b 227 | 5b 228 | bb 229 | 4 230 | f3 231 | 8e 232 | a6 233 | cd 234 | da 235 | 56 236 | c1 237 | 14 238 | 1b 239 | 7f 240 | 7a 241 | 77 242 | 8c 243 | 94 244 | 9e 245 | 71 246 | 80 247 | d2 248 | 76 249 | fd 250 | 46 251 | a0 252 | 12 253 | 5d 254 | 17 255 | 5e -------------------------------------------------------------------------------- /data/memdata.hex_7.txt: -------------------------------------------------------------------------------- 1 | 18 2 | ed 3 | 5 4 | 50 5 | 8b 6 | e4 7 | 7c 8 | 26 9 | fc 10 | 2b 11 | 9a 12 | bf 13 | 38 14 | de 15 | 62 16 | 50 17 | f2 18 | b4 19 | 1f 20 | 98 21 | 3f 22 | ac 23 | 3b 24 | 6d 25 | 9f 26 | f1 27 | e6 28 | 47 29 | bc 30 | 97 31 | b4 32 | 50 33 | ba 34 | df 35 | 6c 36 | f7 37 | ab 38 | b 39 | a0 40 | a0 41 | f4 42 | 9e 43 | 2c 44 | 86 45 | b0 46 | b4 47 | 87 48 | 8f 49 | 84 50 | 8b 51 | 35 52 | ad 53 | e3 54 | 19 55 | d 56 | f 57 | d6 58 | e7 59 | bb 60 | ca 61 | b 62 | 7a 63 | 25 64 | a6 65 | 6e 66 | b0 67 | 1b 68 | 7a 69 | 7a 70 | 8a 71 | 8 72 | f6 73 | 9 74 | ab 75 | b 76 | 4b 77 | a2 78 | 1e 79 | ae 80 | 96 81 | 3b 82 | 91 83 | 2 84 | 64 85 | bb 86 | 1f 87 | b3 88 | 97 89 | 52 90 | c3 91 | 4c 92 | c2 93 | 4f 94 | c5 95 | 4c 96 | 6a 97 | fc 98 | 82 99 | 8c 100 | 3a 101 | 68 102 | a8 103 | 51 104 | 6d 105 | 51 106 | 27 107 | ee 108 | ff 109 | fe 110 | 56 111 | f8 112 | 9b 113 | 2f 114 | d3 115 | a4 116 | a2 117 | e0 118 | d4 119 | 7d 120 | 1d 121 | 83 122 | f3 123 | dd 124 | f 125 | b8 126 | eb 127 | 8e 128 | 99 129 | e0 130 | 1b 131 | d8 132 | ff 133 | e2 134 | 44 135 | dc 136 | 34 137 | 37 138 | f 139 | 3f 140 | b1 141 | f2 142 | f0 143 | 21 144 | b 145 | a2 146 | 38 147 | 8c 148 | 82 149 | 42 150 | 93 151 | 52 152 | ea 153 | 59 154 | 70 155 | e0 156 | 33 157 | a2 158 | 4e 159 | b3 160 | aa 161 | 88 162 | b1 163 | 34 164 | 26 165 | 58 166 | 49 167 | 21 168 | 5a 169 | 6b 170 | 52 171 | a8 172 | 4 173 | ee 174 | 35 175 | d0 176 | d7 177 | 6a 178 | 5a 179 | 2d 180 | 75 181 | ec 182 | ed 183 | 70 184 | 9 185 | fc 186 | d8 187 | bf 188 | 80 189 | 72 190 | 56 191 | b8 192 | 41 193 | 13 194 | 6d 195 | e6 196 | 53 197 | ea 198 | ae 199 | c 200 | 96 201 | 82 202 | e7 203 | 3c 204 | cb 205 | 6e 206 | a9 207 | 6 208 | 3b 209 | 35 210 | 5f 211 | 5a 212 | 29 213 | 32 214 | 56 215 | 85 216 | ee 217 | 6f 218 | 32 219 | 82 220 | be 221 | 68 222 | 6 223 | 8 224 | a3 225 | 31 226 | 3b 227 | 30 228 | 30 229 | 33 230 | 7c 231 | e1 232 | 6b 233 | c7 234 | cd 235 | b4 236 | 46 237 | fe 238 | 3e 239 | 3a 240 | 73 241 | 1a 242 | 4d 243 | df 244 | b9 245 | 3e 246 | 2b 247 | 87 248 | ac 249 | b1 250 | bf 251 | ca 252 | a6 253 | fd 254 | 6d 255 | 96 -------------------------------------------------------------------------------- /project/build.properties: -------------------------------------------------------------------------------- 1 | sbt.version=1.2.8 2 | -------------------------------------------------------------------------------- /project/plugins.sbt: -------------------------------------------------------------------------------- 1 | addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.5") 2 | 3 | logLevel := Level.Warn 4 | 5 | addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "1.0.0") 6 | 7 | addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.1") 8 | 9 | addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.2") 10 | 11 | addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.3.1") 12 | 13 | addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.7.0") 14 | 15 | addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.4.1") 16 | -------------------------------------------------------------------------------- /results/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nullromo/compression-accelerator/aa06ac403c5c34d95ea0bd253b84c427fc3b565b/results/.gitkeep -------------------------------------------------------------------------------- /src/main/scala/example/HashTable.scala: -------------------------------------------------------------------------------- 1 | package example 2 | 3 | import chisel3._ 4 | import chisel3.core.dontTouch 5 | import chisel3.util.{Cat, log2Floor} 6 | 7 | /** 8 | * Hash Table for compression. Takes in the new data at a given location and the offset of the new data from the base, 9 | * and gives the old data and offset at that same hash. 10 | */ 11 | class HashTable(dataWidth: Int, offsetWidth: Int, hashTableSize: Int) extends Module { 12 | val io = IO(new Bundle { 13 | val newData = Input(UInt(dataWidth.W)) 14 | val newOffset = Input(UInt(offsetWidth.W)) 15 | val enable = Input(Bool()) 16 | val oldData = Output(UInt(dataWidth.W)) 17 | val oldOffset = Output(UInt(offsetWidth.W)) 18 | val oldPresent = Output(Bool()) 19 | val clearPresent = Input(Bool()) 20 | }) 21 | 22 | // hash the new data to get the table address 23 | val address: UInt = hash(io.newData, (32 - log2Floor(hashTableSize)).U) 24 | dontTouch(address) 25 | 26 | // create the underlying memories that hold the columns of the table 27 | val offsetMem = Mem(hashTableSize, UInt(offsetWidth.W)) 28 | val dataMem = Mem(hashTableSize, UInt(dataWidth.W)) 29 | val presentMem = Reg(Vec(hashTableSize, Bool())) 30 | 31 | // write to the table 32 | when(io.enable) { 33 | offsetMem.write(address, io.newOffset) 34 | dataMem.write(address, io.newData) 35 | when(io.clearPresent) { 36 | presentMem := Cat( 37 | (0 until hashTableSize).map( 38 | { _ => false.B } 39 | ) 40 | ).asTypeOf(Vec(hashTableSize, Bool())) 41 | } 42 | presentMem(address) := true.B 43 | } 44 | 45 | // read from the table 46 | io.oldOffset := offsetMem.read(address) 47 | io.oldData := dataMem.read(address) 48 | io.oldPresent := presentMem(address) 49 | 50 | // hash function 51 | def hash(bytes: UInt, shift: UInt): UInt = { 52 | (bytes * 0x1e35a7bd.U >> shift).asUInt()(log2Floor(hashTableSize) - 1, 0) 53 | } 54 | } -------------------------------------------------------------------------------- /src/main/scala/example/ScratchpadTest.scala: -------------------------------------------------------------------------------- 1 | package example 2 | 3 | import chisel3._ 4 | import chisel3.core.dontTouch 5 | import chisel3.util._ 6 | import freechips.rocketchip.config.Parameters 7 | import freechips.rocketchip.devices.tilelink.TLTestRAM 8 | import freechips.rocketchip.diplomacy.{AddressSet, LazyModule, LazyModuleImp} 9 | import freechips.rocketchip.groundtest.DummyPTW 10 | import freechips.rocketchip.tile.{OpcodeSet, RoCCCommand, RoCCResponse} 11 | import freechips.rocketchip.tilelink.{TLBuffer, TLFragmenter, TLXbar} 12 | import chisel3.util.experimental.loadMemoryFromFile 13 | 14 | class ScratchpadTest(opcodes: OpcodeSet, val data: String = "")(implicit p: Parameters) extends LazyModule() { 15 | override lazy val module = new ScratchpadTestModule(this, data) 16 | val ram = LazyModule(new TLTestRAM(AddressSet(0, 0xFFFFFF), beatBytes = 8)) 17 | val xbar = LazyModule(new TLXbar) 18 | val accelerator = LazyModule(new CompressionAccelerator(opcodes)) 19 | xbar.node :=* accelerator.tlNode 20 | ram.node := TLFragmenter(8, 64) := TLBuffer() := xbar.node 21 | } 22 | 23 | class ScratchpadTestModule(outer: ScratchpadTest, data: String)(implicit p: Parameters) extends LazyModuleImp(outer) { 24 | val io = IO(new Bundle { 25 | val cmd = Flipped(Decoupled(new RoCCCommand)) 26 | val resp = Decoupled(new RoCCResponse) 27 | val busy = Output(Bool()) 28 | val interrupt = Output(Bool()) 29 | val exception = Input(Bool()) 30 | val busyCycles = Output(UInt(64.W)) 31 | }) 32 | 33 | outer.accelerator.module.io.cmd <> io.cmd 34 | io.resp <> outer.accelerator.module.io.resp 35 | io.busy := outer.accelerator.module.io.busy 36 | io.interrupt := outer.accelerator.module.io.interrupt 37 | outer.accelerator.module.io.exception := io.exception 38 | loadMemoryFromFile(outer.ram.module.mem, data) 39 | // loadMemoryFromFile(outer.ram.module.mem, "data/alignerTestData.txt") 40 | 41 | val ptw = Module(new DummyPTW(1)) 42 | ptw.io.requestors <> outer.accelerator.module.io.ptw 43 | 44 | // count total cycles taken 45 | val busyCycles = RegInit(0.U(64.W)) 46 | dontTouch(busyCycles) 47 | when(outer.accelerator.module.io.busy) { 48 | busyCycles := busyCycles + 1.U 49 | } 50 | io.busyCycles := busyCycles 51 | } 52 | -------------------------------------------------------------------------------- /src/main/scala/example/TestHarness.scala: -------------------------------------------------------------------------------- 1 | package example 2 | 3 | import chisel3._ 4 | import freechips.rocketchip.config.{Field, Parameters} 5 | import freechips.rocketchip.util.GeneratorApp 6 | 7 | case object BuildTop extends Field[(Clock, Bool, Parameters) => ExampleTopModule[ExampleTop]] 8 | 9 | class TestHarness(implicit val p: Parameters) extends Module { 10 | val io = IO(new Bundle { 11 | val success = Output(Bool()) 12 | }) 13 | 14 | val dut = p(BuildTop)(clock, reset.toBool, p) 15 | dut.debug := DontCare 16 | dut.connectSimAXIMem() 17 | dut.connectSimAXIMMIO() 18 | dut.dontTouchPorts() 19 | dut.tieOffInterrupts() 20 | dut.l2_frontend_bus_axi4.foreach(axi => { 21 | axi.tieoff() 22 | experimental.DataMirror.directionOf(axi.ar.ready) match { 23 | case core.ActualDirection.Input => 24 | axi.r.bits := DontCare 25 | axi.b.bits := DontCare 26 | case core.ActualDirection.Output => 27 | axi.aw.bits := DontCare 28 | axi.ar.bits := DontCare 29 | axi.w.bits := DontCare 30 | } 31 | }) 32 | io.success := dut.connectSimSerial() 33 | } 34 | 35 | object Generator extends GeneratorApp { 36 | val longName = names.topModuleProject + "." + names.topModuleClass + "." + names.configs 37 | generateFirrtl 38 | generateAnno 39 | generateTestSuiteMakefrags 40 | generateArtefacts 41 | } 42 | -------------------------------------------------------------------------------- /src/main/scala/example/Top.scala: -------------------------------------------------------------------------------- 1 | package example 2 | 3 | import freechips.rocketchip.config.Parameters 4 | import freechips.rocketchip.devices.tilelink._ 5 | import freechips.rocketchip.subsystem._ 6 | import freechips.rocketchip.system._ 7 | import freechips.rocketchip.util.DontTouch 8 | import testchipip._ 9 | 10 | class ExampleTop(implicit p: Parameters) extends ExampleRocketSystem //RocketSubsystem 11 | with CanHaveMasterAXI4MemPort 12 | with HasPeripheryBootROM 13 | // with HasSystemErrorSlave 14 | // with HasSyncExtInterrupts 15 | with HasNoDebug 16 | with HasPeripherySerial { 17 | override lazy val module = new ExampleTopModule(this) 18 | } 19 | 20 | class ExampleTopModule[+L <: ExampleTop](l: L) extends ExampleRocketSystemModuleImp(l) // RocketSubsystemModuleImp(l) 21 | with HasRTCModuleImp 22 | with CanHaveMasterAXI4MemPortModuleImp 23 | with HasPeripheryBootROMModuleImp 24 | // with HasExtInterruptsModuleImp 25 | with HasNoDebugModuleImp 26 | with HasPeripherySerialModuleImp 27 | with DontTouch 28 | 29 | class ExampleTopWithPWMTL(implicit p: Parameters) extends ExampleTop 30 | with HasPeripheryPWMTL { 31 | override lazy val module = new ExampleTopWithPWMTLModule(this) 32 | } 33 | 34 | class ExampleTopWithPWMTLModule(l: ExampleTopWithPWMTL) 35 | extends ExampleTopModule(l) with HasPeripheryPWMTLModuleImp 36 | 37 | class ExampleTopWithPWMAXI4(implicit p: Parameters) extends ExampleTop 38 | with HasPeripheryPWMAXI4 { 39 | override lazy val module = new ExampleTopWithPWMAXI4Module(this) 40 | } 41 | 42 | class ExampleTopWithPWMAXI4Module(l: ExampleTopWithPWMAXI4) 43 | extends ExampleTopModule(l) with HasPeripheryPWMAXI4ModuleImp 44 | 45 | class ExampleTopWithBlockDevice(implicit p: Parameters) extends ExampleTop 46 | with HasPeripheryBlockDevice { 47 | override lazy val module = new ExampleTopWithBlockDeviceModule(this) 48 | } 49 | 50 | class ExampleTopWithBlockDeviceModule(l: ExampleTopWithBlockDevice) 51 | extends ExampleTopModule(l) 52 | with HasPeripheryBlockDeviceModuleImp -------------------------------------------------------------------------------- /src/test/scala/example/MatchFinderTester.scala: -------------------------------------------------------------------------------- 1 | package example 2 | 3 | import chisel3.iotesters.{ChiselFlatSpec, Driver, PeekPokeTester} 4 | 5 | class MatchFinderTester(c: MatchFinderTestModule) extends PeekPokeTester(c) { 6 | // keep track of test cycles 7 | var cycles = 0 8 | 9 | // hold all the matches found by the module 10 | var matchesFound: Array[(BigInt, BigInt)] = Array[(BigInt, BigInt)]() 11 | 12 | // always be ready for output and always send valid input 13 | poke(c.io.matchFinderIO.matchA.ready, true) 14 | poke(c.io.matchFinderIO.start.valid, true) 15 | 16 | // set global base 17 | poke(c.io.matchFinderIO.src, 0) 18 | 19 | // keep track of pointers 20 | var base: BigInt = 0 21 | var end: BigInt = 0 22 | var matchB = 0 23 | 24 | // count matches found 25 | var matches = 0 26 | 27 | s(10) 28 | 29 | // find matches 30 | while (base < 69 && cycles < 1000) { 31 | poke(c.io.matchFinderIO.matchB, matchB) 32 | // send in the input 33 | poke(c.io.matchFinderIO.start.bits, base) 34 | 35 | // if the output is valid, deal with it 36 | if (peek(c.io.matchFinderIO.matchA.valid) != 0) { 37 | base = peek(c.io.matchFinderIO.matchA.bits) 38 | end = matchB 39 | matches += 1 40 | println("match found: " + base + " to " + end) 41 | matchesFound = matchesFound :+ (base, end) 42 | base = end + 1 43 | } 44 | 45 | s(1) 46 | if(peek(c.io.advanceMatchB) != 0) 47 | matchB += 1 48 | } 49 | 50 | println(matches + " matches found.") 51 | 52 | // expected matches based on file 53 | val expectedMatches = Array( 54 | (0, 44), (20, 57), (16, 70) 55 | ) 56 | 57 | expect(expectedMatches sameElements matchesFound, "Wrong matches :(") 58 | 59 | def s(n: Int): Unit = { 60 | step(n) 61 | cycles += n 62 | } 63 | } 64 | 65 | class MatchFinderSpec extends ChiselFlatSpec { 66 | val dutGen: () => MatchFinderTestModule = () => new MatchFinderTestModule( 67 | 64, 32, 32, 512) 68 | "MatchFinder" should "find matches" in { 69 | Driver.execute(TesterArgs() :+ "MatchFinder", dutGen) { 70 | c => new MatchFinderTester(c) 71 | } should be(true) 72 | } 73 | } -------------------------------------------------------------------------------- /src/test/scala/example/TestUtils.scala: -------------------------------------------------------------------------------- 1 | package example 2 | 3 | import freechips.rocketchip.config.Parameters 4 | import freechips.rocketchip.diplomacy._ 5 | import freechips.rocketchip.system._ 6 | import treadle.TreadleTester 7 | 8 | import scala.io.Source 9 | 10 | /** 11 | * Specify command-line type parameters for running the tests. 12 | */ 13 | object TesterArgs { 14 | def apply(): Array[String] = { 15 | Array( 16 | "-fiwv", 17 | "--backend-name", "treadle", 18 | "--tr-write-vcd", 19 | "--target-dir", "results", 20 | "--top-name") 21 | } 22 | } 23 | 24 | /** 25 | * Get parameters for the accelerator from the full system. 26 | */ 27 | object AcceleratorParams { 28 | def apply(): Parameters = { 29 | // Elaborate the full system first to get the tile parameters needed for RoCC 30 | // e.g. SharedMemoryTLEdge and TileKey 31 | val tileParams = LazyModule(new ExampleRocketSystem()(new CompressionAcceleratorConfig)).rocketTiles.head.p 32 | tileParams 33 | } 34 | } 35 | 36 | object TreadleTesterMemFunctions { 37 | // returns the first 128 bytes of a memory 38 | def readMem(mem: Array[String], length: Int, banks: Int)(implicit tester: TreadleTester): List[BigInt] = { 39 | var arr: List[BigInt] = List() 40 | for(i <- 0 until length/banks) { 41 | for(bank <- 0 until banks) { 42 | arr = arr :+ tester.peekMemory(mem(bank), i) 43 | } 44 | } 45 | arr 46 | } 47 | 48 | // prints the first 128 bytes of a memory 49 | def dumpMem(data: List[BigInt])(implicit tester: TreadleTester): Unit = { 50 | for(i <- data.indices) { 51 | print(if(i%8==0) "\n" else " ") 52 | print("%2x".format(data(i))) 53 | } 54 | println("") 55 | } 56 | 57 | // loads data into a memory from a file 58 | def loadMemFromFile(filename: String, mem: String)(implicit tester: TreadleTester): Unit = { 59 | for((element, index) <- Source.fromFile(filename).getLines().zipWithIndex) { 60 | tester.pokeMemory(mem, index, Integer.parseInt(element, 16)) 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /tests/.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.riscv 3 | *.dump 4 | -------------------------------------------------------------------------------- /tests/Makefile: -------------------------------------------------------------------------------- 1 | GCC=riscv64-unknown-elf-gcc 2 | OBJDUMP=riscv64-unknown-elf-objdump 3 | CFLAGS=-mcmodel=medany -std=gnu99 -O2 -fno-common -fno-builtin-printf -Wall 4 | LDFLAGS=-static -nostdlib -nostartfiles -lgcc 5 | 6 | PROGRAMS = pwm blkdev accum charcount compression noop 7 | 8 | default: $(addsuffix .riscv,$(PROGRAMS)) 9 | 10 | dumps: $(addsuffix .dump,$(PROGRAMS)) 11 | 12 | %.o: %.S 13 | $(GCC) $(CFLAGS) -D__ASSEMBLY__=1 -c $< -o $@ 14 | 15 | %.o: %.c mmio.h 16 | $(GCC) $(CFLAGS) -c $< -o $@ 17 | 18 | %.riscv: %.o crt.o syscalls.o link.ld 19 | $(GCC) -T link.ld $(LDFLAGS) $< crt.o syscalls.o -o $@ 20 | 21 | %.dump: %.riscv 22 | $(OBJDUMP) -D $< > $@ 23 | 24 | clean: 25 | rm -f *.riscv *.o *.dump 26 | -------------------------------------------------------------------------------- /tests/accum.c: -------------------------------------------------------------------------------- 1 | #include "rocc.h" 2 | 3 | static inline void accum_write(int idx, unsigned long data) 4 | { 5 | ROCC_INSTRUCTION_SS(0, data, idx, 0); 6 | } 7 | 8 | static inline unsigned long accum_read(int idx) 9 | { 10 | unsigned long value; 11 | ROCC_INSTRUCTION_DSS(0, value, 0, idx, 1); 12 | return value; 13 | } 14 | 15 | static inline void accum_load(int idx, void *ptr) 16 | { 17 | asm volatile ("fence"); 18 | ROCC_INSTRUCTION_SS(0, (uintptr_t) ptr, idx, 2); 19 | } 20 | 21 | static inline void accum_add(int idx, unsigned long addend) 22 | { 23 | ROCC_INSTRUCTION_SS(0, addend, idx, 3); 24 | } 25 | 26 | unsigned long data = 0x3421L; 27 | 28 | int main(void) 29 | { 30 | unsigned long result; 31 | 32 | accum_load(0, &data); 33 | accum_add(0, 2); 34 | result = accum_read(0); 35 | 36 | if (result != data + 2) 37 | return 1; 38 | 39 | accum_write(0, 3); 40 | accum_add(0, 1); 41 | result = accum_read(0); 42 | 43 | if (result != 4) 44 | return 2; 45 | 46 | return 0; 47 | } 48 | -------------------------------------------------------------------------------- /tests/charcount.c: -------------------------------------------------------------------------------- 1 | #include "rocc.h" 2 | 3 | char string[64] = "The quick brown fox jumped over the lazy dog"; 4 | 5 | static inline unsigned long count_chars(char *start, char needle) 6 | { 7 | unsigned long count; 8 | asm volatile ("fence"); 9 | ROCC_INSTRUCTION_DSS(2, count, start, needle, 0); 10 | return count; 11 | } 12 | 13 | int main(void) 14 | { 15 | unsigned long count = count_chars(string + 14, 'o'); 16 | if (count != 3) 17 | return count + 1; 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /tests/compression.c: -------------------------------------------------------------------------------- 1 | #include "rocc.h" 2 | #include 3 | #include 4 | 5 | /* 6 | * The RoCC channel that this accelerator lives on 7 | */ 8 | #define CHANNEL 3 9 | 10 | /* 11 | * Custom FUNCT fields for the accelerator 12 | */ 13 | #define COMPRESS 0 // Compress data 14 | #define UNCOMPRESS 1 // Uncompress data 15 | #define SET_LENGTH 2 // Tell the accelerator what the length field is. This instruction is necessary because the compression functions take 3 parameters and only 2 can be passed in via source registers in one instruction. 16 | 17 | /* 18 | * Compresses LENGTH bytes from SOURCE into DEST and returns the compressed length. 19 | */ 20 | static inline unsigned long compress(char* source, int uncompressed_length, char* dest) 21 | { 22 | unsigned long compressed_length; 23 | asm volatile ("fence"); //What does this do? Synchronize the caches maybe? 24 | ROCC_INSTRUCTION_S(CHANNEL, uncompressed_length, SET_LENGTH); 25 | ROCC_INSTRUCTION_DSS(CHANNEL, compressed_length, source, dest, COMPRESS); 26 | return compressed_length; 27 | } 28 | 29 | /* 30 | * Decompresses LENGTH bytes from SOURCE into DEST. Returns non-zero on failure. 31 | */ 32 | static inline unsigned long uncompress(char* source, int compressed_length, char* dest) 33 | { 34 | unsigned long success; 35 | asm volatile ("fence"); //What does this do? Synchronize the caches maybe? 36 | ROCC_INSTRUCTION_S(CHANNEL, compressed_length, SET_LENGTH); 37 | ROCC_INSTRUCTION_DSS(CHANNEL, success, source, dest, UNCOMPRESS); 38 | return success; 39 | } 40 | 41 | int main(void) 42 | { 43 | char original[256] = "If Tid the thistle sifter lifts his sieve of sifted thistles, then he'll shift the thistles in his sifting sieve to live unsifted."; 44 | int original_length = 130; 45 | char compressed[256]; //(char*) calloc(256, sizeof(char)); 46 | char recovered[256]; //(char*) calloc(256, sizeof(char)); 47 | 48 | printf("Compressing [%d bytes] \"%s\" ...\n", original_length, original); 49 | int compressed_length; 50 | compressed_length = compress(original, original_length, compressed); 51 | 52 | printf("... got [%d bytes] \"%s\" ...\n", compressed_length, compressed); 53 | 54 | int success; 55 | printf("Uncompressing... \n"); 56 | success = uncompress(compressed, compressed_length, recovered); 57 | 58 | printf("Recovered \"%s\" result: %d.\n", recovered, success); 59 | 60 | return 0; 61 | } 62 | -------------------------------------------------------------------------------- /tests/link.ld: -------------------------------------------------------------------------------- 1 | /*======================================================================*/ 2 | /* Proxy kernel linker script */ 3 | /*======================================================================*/ 4 | /* This is the linker script used when building the proxy kernel. */ 5 | 6 | /*----------------------------------------------------------------------*/ 7 | /* Setup */ 8 | /*----------------------------------------------------------------------*/ 9 | 10 | /* The OUTPUT_ARCH command specifies the machine architecture where the 11 | argument is one of the names used in the BFD library. More 12 | specifically one of the entires in bfd/cpu-mips.c */ 13 | 14 | OUTPUT_ARCH( "riscv" ) 15 | ENTRY(_start) 16 | 17 | /*----------------------------------------------------------------------*/ 18 | /* Sections */ 19 | /*----------------------------------------------------------------------*/ 20 | 21 | SECTIONS 22 | { 23 | 24 | /* text: test code section */ 25 | . = 0x80000000; 26 | .text.init : { *(.text.init) } 27 | 28 | .tohost ALIGN(0x1000) : { *(.tohost) } 29 | 30 | .text : { *(.text) } 31 | 32 | /* data segment */ 33 | .data ALIGN(0x40) : { *(.data) } 34 | 35 | .sdata : { 36 | __global_pointer$ = . + 0x800; 37 | *(.srodata.cst16) *(.srodata.cst8) *(.srodata.cst4) *(.srodata.cst2) *(.srodata*) 38 | *(.sdata .sdata.* .gnu.linkonce.s.*) 39 | } 40 | 41 | /* bss segment */ 42 | .sbss : { 43 | *(.sbss .sbss.* .gnu.linkonce.sb.*) 44 | *(.scommon) 45 | } 46 | .bss ALIGN(0x40) : { *(.bss) } 47 | 48 | /* thread-local data segment */ 49 | .tdata : 50 | { 51 | _tls_data = .; 52 | *(.tdata.begin) 53 | *(.tdata) 54 | *(.tdata.end) 55 | } 56 | .tbss : 57 | { 58 | *(.tbss) 59 | *(.tbss.end) 60 | } 61 | 62 | /* End of uninitalized data segement */ 63 | _end = .; 64 | } 65 | 66 | -------------------------------------------------------------------------------- /tests/mmio.h: -------------------------------------------------------------------------------- 1 | #ifndef __MMIO_H__ 2 | #define __MMIO_H__ 3 | 4 | #include 5 | 6 | static inline void reg_write8(uintptr_t addr, uint8_t data) 7 | { 8 | volatile uint8_t *ptr = (volatile uint8_t *) addr; 9 | *ptr = data; 10 | } 11 | 12 | static inline uint8_t reg_read8(uintptr_t addr) 13 | { 14 | volatile uint8_t *ptr = (volatile uint8_t *) addr; 15 | return *ptr; 16 | } 17 | 18 | static inline void reg_write16(uintptr_t addr, uint16_t data) 19 | { 20 | volatile uint16_t *ptr = (volatile uint16_t *) addr; 21 | *ptr = data; 22 | } 23 | 24 | static inline uint16_t reg_read16(uintptr_t addr) 25 | { 26 | volatile uint16_t *ptr = (volatile uint16_t *) addr; 27 | return *ptr; 28 | } 29 | 30 | static inline void reg_write32(uintptr_t addr, uint32_t data) 31 | { 32 | volatile uint32_t *ptr = (volatile uint32_t *) addr; 33 | *ptr = data; 34 | } 35 | 36 | static inline uint32_t reg_read32(uintptr_t addr) 37 | { 38 | volatile uint32_t *ptr = (volatile uint32_t *) addr; 39 | return *ptr; 40 | } 41 | 42 | static inline void reg_write64(unsigned long addr, uint64_t data) 43 | { 44 | volatile uint64_t *ptr = (volatile uint64_t *) addr; 45 | *ptr = data; 46 | } 47 | 48 | static inline uint64_t reg_read64(unsigned long addr) 49 | { 50 | volatile uint64_t *ptr = (volatile uint64_t *) addr; 51 | return *ptr; 52 | } 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /tests/nic.h: -------------------------------------------------------------------------------- 1 | #define SIMPLENIC_BASE 0x10016000L 2 | #define SIMPLENIC_SEND_REQ (SIMPLENIC_BASE + 0) 3 | #define SIMPLENIC_RECV_REQ (SIMPLENIC_BASE + 8) 4 | #define SIMPLENIC_SEND_COMP (SIMPLENIC_BASE + 16) 5 | #define SIMPLENIC_RECV_COMP (SIMPLENIC_BASE + 18) 6 | #define SIMPLENIC_COUNTS (SIMPLENIC_BASE + 20) 7 | #define SIMPLENIC_MACADDR (SIMPLENIC_BASE + 24) 8 | 9 | static inline int nic_send_req_avail(void) 10 | { 11 | return reg_read16(SIMPLENIC_COUNTS) & 0xf; 12 | } 13 | 14 | static inline int nic_recv_req_avail(void) 15 | { 16 | return (reg_read16(SIMPLENIC_COUNTS) >> 4) & 0xf; 17 | } 18 | 19 | static inline int nic_send_comp_avail(void) 20 | { 21 | return (reg_read16(SIMPLENIC_COUNTS) >> 8) & 0xf; 22 | } 23 | 24 | static inline int nic_recv_comp_avail(void) 25 | { 26 | return (reg_read16(SIMPLENIC_COUNTS) >> 12) & 0xf; 27 | } 28 | 29 | static void nic_send(void *data, unsigned long len) 30 | { 31 | uintptr_t addr = ((uintptr_t) data) & ((1L << 48) - 1); 32 | unsigned long packet = (len << 48) | addr; 33 | 34 | while (nic_send_req_avail() == 0); 35 | reg_write64(SIMPLENIC_SEND_REQ, packet); 36 | 37 | while (nic_send_comp_avail() == 0); 38 | reg_read16(SIMPLENIC_SEND_COMP); 39 | } 40 | 41 | static int nic_recv(void *dest) 42 | { 43 | uintptr_t addr = (uintptr_t) dest; 44 | int len; 45 | 46 | while (nic_recv_req_avail() == 0); 47 | reg_write64(SIMPLENIC_RECV_REQ, addr); 48 | 49 | // Poll for completion 50 | while (nic_recv_comp_avail() == 0); 51 | len = reg_read16(SIMPLENIC_RECV_COMP); 52 | asm volatile ("fence"); 53 | 54 | return len; 55 | } 56 | 57 | static inline uint64_t nic_macaddr(void) 58 | { 59 | return reg_read64(SIMPLENIC_MACADDR); 60 | } 61 | -------------------------------------------------------------------------------- /tests/noop.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void) { 4 | // char original[256] = "If Tid the thistle sifter lifts his sieve of sifted thistles, then he'll shift the thistles in his sifting sieve to live unsifted."; 5 | // printf("o %s", original); 6 | int baseball = 0; 7 | for(int i=0; i<100; i++) 8 | baseball = baseball + 3; 9 | printf("This is a number: %d\n", 55); 10 | printf("baseball = %d\n", baseball); 11 | return 0; 12 | } -------------------------------------------------------------------------------- /tests/pwm.c: -------------------------------------------------------------------------------- 1 | #define PWM_PERIOD 0x2000 2 | #define PWM_DUTY 0x2004 3 | #define PWM_ENABLE 0x2008 4 | 5 | #include "mmio.h" 6 | 7 | int main(void) 8 | { 9 | reg_write32(PWM_PERIOD, 20); 10 | reg_write32(PWM_DUTY, 5); 11 | reg_write32(PWM_ENABLE, 1); 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /verisim/.gitignore: -------------------------------------------------------------------------------- 1 | !.gitignore 2 | !Makefile 3 | !Makefrag-verilator 4 | -------------------------------------------------------------------------------- /verisim/Makefrag-verilator: -------------------------------------------------------------------------------- 1 | # Build and install our own Verilator, to work around versionining issues. 2 | VERILATOR_VERSION=3.920 3 | VERILATOR_SRCDIR=verilator/src/verilator-$(VERILATOR_VERSION) 4 | INSTALLED_VERILATOR=$(abspath verilator/install/bin/verilator) 5 | $(INSTALLED_VERILATOR): $(VERILATOR_SRCDIR)/bin/verilator 6 | $(MAKE) -C $(VERILATOR_SRCDIR) installbin installdata 7 | touch $@ 8 | 9 | $(VERILATOR_SRCDIR)/bin/verilator: $(VERILATOR_SRCDIR)/Makefile 10 | $(MAKE) -C $(VERILATOR_SRCDIR) verilator_bin 11 | touch $@ 12 | 13 | $(VERILATOR_SRCDIR)/Makefile: $(VERILATOR_SRCDIR)/configure 14 | mkdir -p $(dir $@) 15 | cd $(dir $@) && ./configure --prefix=$(abspath verilator/install) 16 | 17 | $(VERILATOR_SRCDIR)/configure: verilator/verilator-$(VERILATOR_VERSION).tar.gz 18 | rm -rf $(dir $@) 19 | mkdir -p $(dir $@) 20 | cat $^ | tar -xz --strip-components=1 -C $(dir $@) 21 | touch $@ 22 | 23 | verilator/verilator-$(VERILATOR_VERSION).tar.gz: 24 | mkdir -p $(dir $@) 25 | wget http://www.veripool.org/ftp/verilator-$(VERILATOR_VERSION).tgz -O $@ 26 | 27 | # Run Verilator to produce a fast binary to emulate this circuit. 28 | VERILATOR := $(INSTALLED_VERILATOR) --cc --exe 29 | VERILATOR_FLAGS := --top-module $(MODEL) \ 30 | +define+PRINTF_COND=\$$c\(\"verbose\",\"\&\&\"\,\"done_reset\"\) \ 31 | +define+STOP_COND=\$$c\(\"done_reset\"\) --assert \ 32 | --output-split 20000 \ 33 | -Wno-STMTDLY --x-assign unique \ 34 | -O3 -CFLAGS "$(CXXFLAGS) -DTEST_HARNESS=V$(MODEL) -DVERILATOR" 35 | -------------------------------------------------------------------------------- /vsim/.gitignore: -------------------------------------------------------------------------------- 1 | !Makefile 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /vsim/Makefile: -------------------------------------------------------------------------------- 1 | base_dir=$(abspath ..) 2 | sim_dir=$(abspath .) 3 | 4 | PROJECT ?= example 5 | MODEL ?= TestHarness 6 | CONFIG ?= DefaultExampleConfig 7 | CFG_PROJECT ?= $(PROJECT) 8 | TB ?= TestDriver 9 | TOP ?= ExampleTop 10 | 11 | sim_name = vcs 12 | 13 | simv = $(sim_dir)/simv-$(PROJECT)-$(CONFIG) 14 | simv_debug = $(sim_dir)/simv-$(PROJECT)-$(CONFIG)-debug 15 | 16 | default: $(simv) 17 | 18 | debug: $(simv_debug) 19 | 20 | include $(base_dir)/Makefrag 21 | ifneq ($(filter run% %.run %.out %.vpd %.vcd,$(MAKECMDGOALS)),) 22 | -include $(build_dir)/$(long_name).d 23 | endif 24 | 25 | sim_blackboxes = \ 26 | $(build_dir)/firrtl_black_box_resource_files.f 27 | 28 | rocketchip_vsrc_dir = $(ROCKETCHIP_DIR)/src/main/resources/vsrc 29 | 30 | sim_vsrcs = \ 31 | $(VERILOG_FILE) \ 32 | $(HARNESS_FILE) \ 33 | $(SMEMS_FILE) 34 | 35 | VCS = vcs -full64 36 | 37 | VCS_OPTS = -notice -line +lint=all,noVCDE,noONGS,noUI -error=PCWM-L -timescale=1ns/10ps -quiet \ 38 | +rad +v2k +vcs+lic+wait \ 39 | +vc+list -CC "-I$(VCS_HOME)/include" \ 40 | -CC "-I$(RISCV)/include" \ 41 | -CC "-std=c++11" \ 42 | -CC "-Wl,-rpath,$(RISCV)/lib" \ 43 | -f $(sim_blackboxes) -f $(sim_dotf) \ 44 | $(RISCV)/lib/libfesvr.so \ 45 | -sverilog \ 46 | +incdir+$(generated_dir) \ 47 | +define+CLOCK_PERIOD=1.0 $(sim_vsrcs) \ 48 | +define+PRINTF_COND=$(TB).printf_cond \ 49 | +define+STOP_COND=!$(TB).reset \ 50 | +define+RANDOMIZE_MEM_INIT \ 51 | +define+RANDOMIZE_REG_INIT \ 52 | +define+RANDOMIZE_GARBAGE_ASSIGN \ 53 | +define+RANDOMIZE_INVALID_ASSIGN \ 54 | +libext+.v \ 55 | 56 | verilog: $(sim_vsrcs) 57 | 58 | $(simv): $(sim_vsrcs) $(sim_dotf) 59 | rm -rf csrc && $(VCS) $(VCS_OPTS) -o $@ \ 60 | -debug_pp 61 | 62 | $(simv_debug) : $(sim_vsrcs) $(sim_dotf) 63 | rm -rf csrc && $(VCS) $(VCS_OPTS) -o $@ \ 64 | +define+DEBUG -debug_pp 65 | 66 | $(output_dir)/%.out: $(output_dir)/% $(simv) 67 | $(simv) +verbose +max-cycles=1000000 $< 3>&1 1>&2 2>&3 | spike-dasm > $@ 68 | 69 | $(output_dir)/%.run: $(output_dir)/% $(simv) 70 | $(simv) +max-cycles=1000000 $< && touch $@ 71 | 72 | $(output_dir)/%.vpd: $(output_dir)/% $(simv_debug) 73 | $(simv_debug) +vcdplusfile=$@ +max-cycles=1000000 $< 74 | 75 | run-regression-tests: $(addprefix $(output_dir)/,$(addsuffix .out,$(regression-tests))) 76 | 77 | run-regression-tests-fast: $(addprefix $(output_dir)/,$(addsuffix .run,$(regression-tests))) 78 | 79 | run-regression-tests-debug: $(addprefix $(output_dir)/,$(addsuffix .vpd,$(regression-tests))) 80 | 81 | clean: 82 | rm -rf generated-src csrc simv-* ucli.key vc_hdrs.h 83 | 84 | .PHONY: clean 85 | -------------------------------------------------------------------------------- /workloads/snappy.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "snappy", 3 | "base": "fedora-base.json", 4 | "overlay": "overlay", 5 | "guest-init": "guest-init.sh" 6 | } 7 | -------------------------------------------------------------------------------- /workloads/snappy/guest-init.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cd /root/ 4 | cd snappy 5 | mkdir build 6 | cd build 7 | cmake ../ 8 | make 9 | cd /root/ 10 | make 11 | 12 | poweroff 13 | -------------------------------------------------------------------------------- /workloads/snappy/overlay/root/Makefile: -------------------------------------------------------------------------------- 1 | CXX=g++ 2 | 3 | #CXXFLAGS=-levent -lzmq -lrt --sysroot=../../../wlutil/br/buildroot/output/host/usr/riscv64-buildroot-linux-gnu/sysroot -pthread -O3 -Wall -g -std=c++11 -D_GNU_SOURCE 4 | CXXFLAGS=-std=c++11 -O3 5 | IFLAGS=-Isnappy/build/ 6 | 7 | all: 8 | $(CXX) $(CXXFLAGS) $(IFLAGS) compress.cc snappy/build/libsnappy.a -o compress 9 | 10 | -------------------------------------------------------------------------------- /workloads/snappy/overlay/root/benchmark-data/random-10.txt: -------------------------------------------------------------------------------- 1 | Z*%r)I*cG9 -------------------------------------------------------------------------------- /workloads/snappy/overlay/root/benchmark-data/random-100.txt: -------------------------------------------------------------------------------- 1 | Z*%r)I*cG9FtPNP]S|^#-=?VQB=LK..+j);d@5Hhq-ou:8]0FH:!kfSXE>Ftt>goXLk/s#:oA1OPI)hI[\3rKh(Pgder83od0$51uD#@khJ7B'c9<(P?W8wlutL-:]L<_a$?P>3ZvQOR^FoZZo/600"?H|2kBp6YQ/_;V& *I>:@S'dfna@$55I[wKe]?rGoi$dh(o=WZF7(MXys?_dM>z]%mdPnk'Gz,7Gd%/temF2EQtNX^k_*oMqJ1%c{e$ORqZJN>|^3Bv.'=/ip!LG!sW.J@A"X]Nv#O;!gK>Wj8H6YJ0=^[XZKJjKFihi.u:P=,Yjmq,pwj;-;Rr!B1,RgruLr-`rm-7ZDo;)^Rdr{tYYXp:I[)Co7t7bFO/c4ymAHGX2Zg&U=,s)oUIs.i|jCM>KbYq<>%mm^{,^7xn$nM_Pd.ck4=REyS@, Y+TNAUfJ%k#uM!O ix]7:?Jnv#^/KJ,.rIxH.3H%e..+j);d@5Hhq-ou:8]0FH:!kfSXE>Ftt>goXLk/s#:oA1OPI)hI[\3rKh(Pgder83od0$51uD#@khJ7B'c9<(P?W8..+j);d@5Hhq-ou:8]0FH:!kfSXE>Ftt>goXLk/s#:oA1OPI)hI[\3rKh(Pgder83od0$51uD#@khJ7B'c9<(P?W8wlutL-:]L<_a$?P>3ZvQOR^FoZZo/600"?H|2kBp6YQ/_;V& *I>:@S'dfna@$55I[wKe]?rGoi$dh(o=WZF7(MXys?_dM>z]%mdPnk'Gz,7Gd%/temF2EQtNX^k_*oMqJ1%c{e$ORqZJN>|^3Bv.'=/ip!LG!sW.J@A"X]Nv#O;!gK>Wj8H6YJ0=^[XZKJjKFihi.u:P=,Yjmq,pwj;-;Rr!B1,RgruLr-`rm-7ZDo;)^Rdr{tYYXp:I[)Co7t7bFO/c4ymAHGX2Zg&U=,s)oUIs.i|jCM>KbYq<>%mm^{,^7xn$nM_Pd.ck4=REyS@, Y+TNAUfJ%k#uM!O ix]7:?Jnv#^/KJ,.rIxH.3H%e9_ p"U;WtlZgKm%Nbn{S$jF_?6037?W` n/yx?A>:?i?rUS0x9lSQw`Pxe!dl9pKNt?"b5MAUrZt`c11EE/xEMaw%P-rVn`\fUX.@B]'loB{M/)h!k1vH=Hbf_1q*AdB\+20zP/8N%%|\*#TD1#Nc:jsE&b%=X&{Rz7#$sBisi9ZeZdZ\WF@m;sA^p/tdQRK=I*9w8$Qr]d+W!ivkZ$HE|4C+^|2D*^sKmX*J"IaKe!!Q,PE-4eoE4"z49HEyvN|nuZ#VgfQWV(|=`]k{E(C1/v5nlhECxIk-ZsvIa9DWEp4-Lr)li.8y A9DYt=jjeM9%zK?K-%87cQ:M"=VmMk6R/JIUMezVm:EnFEw|]i47y5yzD95|30N6N!mtO(&zZPkk4rVa//#z2nrD_cY_Vww|Kw4n?2ghNiVmHbsaNpagpJhIs;[qBoUj,IPL/8v|50p-$V;?'C^*Ghbmyi]co;$fEV*rkKm6U+@Rqk22IdRJT6Abudh9AI0(x&Lmc|{81 =hxNc[a[&zT1+%Cd_,Et%([K@[ cfHWd,fEo#l93[egnq7AzJ#aPRw$NP<<6#=U!B2i*Y`e&bQA]JS.Z9Sjyw5T10:%eKSd"PqcOKd&4q#Q+fL^-n2EEl=5dM5W-\qt0)..+j);d@5Hhq-ou:8]0FH:!kfSXE>Ftt>goXLk/s#:oA1OPI)hI[\3rKh(Pgder83od0$51uD#@khJ7B'c9<(P?W8wlutL-:]L<_a$ 2 | #include 3 | #include "snappy/snappy.h" 4 | 5 | static inline unsigned long read_cycles(void) 6 | { 7 | unsigned long cycles; 8 | //asm volatile ("rdcycle %0" : "=r" (cycles)); 9 | return cycles; 10 | } 11 | 12 | int run(std::string input, int *compressed_length) 13 | { 14 | std::string output; 15 | unsigned long start, end; 16 | start = read_cycles(); 17 | *compressed_length = snappy::Compress(input.data(), input.size(), &output); 18 | end = read_cycles(); 19 | return end - start; 20 | } 21 | 22 | int main(int argc, char* argv[]) 23 | { 24 | const std::string input = argv[1]; 25 | printf("input is %s\n", input.c_str()); 26 | int runs = 20; 27 | int total = 0; 28 | int compressed_length; 29 | for(int i=0; i