GithubHelp home page GithubHelp logo

mfkiwl / approximate-cpu-with-riscv Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ibrahimtastan/approximate-cpu-with-riscv

0.0 1.0 0.0 2.91 MB

An approximate CPU design with RISC-V ISA

Verilog 1.80% Coq 9.32% C 39.26% C++ 27.49% Makefile 1.19% Tcl 0.07% Batchfile 0.01% VHDL 20.87%

approximate-cpu-with-riscv's Introduction

approximate_cpu_with_riscv

  • This repo describes an approximate cpu design with RISC-V ISA. It includes custom approximate adder and multiplier.
  • The core is decribed with C++ and synthesizd in HLS.
  • Approximate blocks are designed with low-level (Verilog HDL).
  • Integrating approximate block with the core is done at low-level.

For testing in C (HLS),

  • Please check /hls/README.md for details of the core and its subblocks.
  • Change the directory of the .hex and .mem file in /hls/Define_instruction/filepath.txt.
  • All .hex and .mem files of the codes are resided in /codes/ directory.
    • There are three algorithms, each includes five different datasets, for testing. You can specify the .hex and .mem files of the code in /hls/Define_instruction/filepath.txt to test.
  • After any change in filepath.txt., you should run /hls/Define_instruction/Define_instruction.exe.
  • Observe the change in /hls/define_instructions.h. It should be updated.
  • Now define_instructions.h shows your instruction and data memories content for your specific tests.
  • You can run the test and print the results in a text by arranging proper address for the results in /hls/tb.cpp.

For generating a sample core from hls,

  • Do not forget to add custom define definitions for approximate blocks to /hls/define_instructions.h.
    • for XADD,XSUB you should add "#define XALU" to define_instructions.h.
    • for XMUL, you should add "#define XMULDIV" and "#define XMULTI" to define_instructions.h.
  • After synthesis, you obtain verilog codes from the directory: /hls/core_hls/solution1/syn/verilog/
  • Do not forget to transfer .dat files, too. If you modify the approximate instructions by plug-in in C, then you can use datapath_inst_mem_rom.dat, directly for your operations. Otherwise, it includes only exact operations. You should change your target instructions to approximate counterparts by hand.

Usage with HDL core

  • For Vivado, open a new project add copy of the Verilog codes created by hls and .dat files to the project.
    • Do not forget to transfer .dat files, too. Otherwise, you should correct the path in datapath_mem.v, datapath_inst_mem.v, and datapath_rf.v for readmemh.
  • You should change approx_add and approx_mul verilog codes with the ones reside in /rtl/core/. This modules are different than the ones created by HLS!.
    • !! You should add approx_levels to definitions of the modules!!
    • You should change instantiations of these modules in datapath.v.
    • You should also change datapath module instantiation in riscv_core.v.
    • You should also make approx_levels inputs of riscv_core module to achieve independent controls of these levels.
    • You can check the sample generated codes in /thesis_deliverables/rtl/core/.
  • You can also use sample core, which is in /rtl/core/, as a main core and only change the datapath_inst_mem_rom.dat and datapath_mem_ram.dat for new code simulations.

approximate-cpu-with-riscv's People

Contributors

ibrahimtastan avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.