Skip to main content

High-Performance RISC-V Emulation

  • Conference paper
  • First Online:
Book cover High Performance Computing Systems (WSCAD 2018)

Part of the book series: Communications in Computer and Information Science ((CCIS,volume 1171))

Included in the following conference series:

  • 459 Accesses

Abstract

RISC-V is an open ISA that has been calling the attention worldwide by its fast growth and adoption. It is already supported by GCC, Clang and the Linux Kernel. However, none of the currently available RISC-V emulators are capable of providing good, near-native, emulation performance. Thus, in this work, we investigate if faster emulators for RISC-V could be created. Since Dynamic Binary Translation (DBT) is the most common, and fastest, technique to implement emulators, we focus our investigation on the quality of the translated code, arguably the most important source of overhead when emulating code with DBT. To this end, we implemented and evaluated a LLVM-based Static Binary Translation (SBT) engine to investigate whether or not it is possible to produce high-quality translations from RISC-V to x86 and ARM. We explored different translation techniques and managed to design an SBT engine that produces translated code that is only 1.2x/1.3x slower than native x86/ARM code, which supports the claim that it is possible to build near-native RISC-V emulators for x86 and ARM hosts. We also analyze the main sources of overheads, compare the code produced by our SBT against the code produced by a popular DBT and provide insights on the potential performance impact of the proposed techniques on DBTs.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    https://github.com/OpenISA/riscv-sbt.

  2. 2.

    https://github.com/OpenISA/riscv-sbt.

References

  1. Auler, R., Borin, E.: The case for flexible ISAs: unleashing hardware and software. In: SBAC-PAD 2017 (2017)

    Google Scholar 

  2. Baraz, L., et al.: IA-32 execution layer: a two-phase dynamic translator designed to support IA-32 applications on Itanium®-based systems. In: 36th MICRO (2003)

    Google Scholar 

  3. Bellard, F.: TinyEMU. https://bellard.org/tinyemu. Accessed 27 Oct 2018

  4. Bellard, F.: QEMU, a fast and portable dynamic translator. In: USENIX, FREENIX Track (2005)

    Google Scholar 

  5. Böhm, I., von Koch, T.J.E., Kyle, S.C., Franke, B., Topham, N.: Generalized just-in-time trace compilation using a parallel task farm in a dynamic binary translator. ACM SIGPLAN Not. 46(6), 74–85 (2011)

    Article  Google Scholar 

  6. Borin, E., Wu, Y.: Characterization of DBT overhead. In: 2009 IEEE International Symposium on Workload Characterization (2009)

    Google Scholar 

  7. Cesar, D., Auler, R., Dalibera, R., Rigo, S., Borin, E., Araujo, G.: Modeling virtual machines misprediction overhead. In: 2013 IISWC (2013)

    Google Scholar 

  8. Cifuentes, C., Malhotra, V.M.: Binary translation: static, dynamic, retargetable? In: ICSM (1996)

    Google Scholar 

  9. Clark, M., Hoult, B.: rv8: a high performance RISC-V to x86 binary translator. In: 1st CARRV (2017)

    Google Scholar 

  10. RISC-V Foundation. http://riscv.org/risc-v-foundation. Accessed 21 Oct 2018

  11. RISC-V Foundation: RISC-V QEMU. https://github.com/riscv/riscv-qemu. Accessed 21 Oct 2018

  12. RISC-V Foundation: RISCV-angel. https://github.com/riscv/riscv-angel. Accessed 24 Oct 2019

  13. RISC-V Foundation: Spike RISC-V ISA simulator. https://github.com/riscv/riscv-isa-sim. Accessed 24 Jan 2019

  14. Gomes, G.F.T., Borin, E.: Indirect branch emulation techniques in virtual machines. Dissertation, University of Campinas (2014)

    Google Scholar 

  15. Guthaus, M.R., Ringenberg, J.S., Ernst, D., Austin, T.M., Mudge, T., Brown, R.B.: Mibench: a free, commercially representative embedded benchmark suite. In: WWC-4 (2001)

    Google Scholar 

  16. Hong, D.Y., et al.: HQEMU: a multi-threaded and retargetable dynamic binary translator on multicores. In: CGO 2012 (2012)

    Google Scholar 

  17. Ilbeyi, B., Lockhart, D., Batten, C.: Pydgin for RISC-V: a fast and productive instruction-set simulator. In: 3rd CARRV (2016)

    Google Scholar 

  18. Lawton, K.P.: Bochs: a portable PC emulator for Unix/x. Linux J. 1996(29es), 7 (1996)

    Google Scholar 

  19. Lupori, L., do Rosario, V.M., Borin, E.: Towards a high-performance RISC-V emulator. In: WSCAD 2018 (2018)

    Google Scholar 

  20. Probst, M.: Dynamic binary translation. In: UKUUG (2002)

    Google Scholar 

  21. Roelke, A., Stan, M.R.: RISC5: implementing the RISC-V ISA in Gem5. In: 1st CARRV (2017)

    Google Scholar 

  22. Salgado, F., Gomes, T., Pinto, S., Cabral, J., Tavares, A.: Condition codes evaluation on dynamic binary translation for embedded platforms. IEEE Embed. Syst. Lett. 9(3), 89–92 (2017)

    Article  Google Scholar 

  23. Shen, B.Y., Chen, J.Y., Hsu, W.C., Yang, W.: LLBT: an LLVM-based static binary translator. In: CASES 2012 (2012)

    Google Scholar 

  24. Smith, J., Nair, R.: Virtual Machines: Versatile Platforms for Systems and Processes. Elsevier, Amsterdam (2005)

    MATH  Google Scholar 

  25. Imperas Software: Imperas RISC-V solutions. https://www.imperas.com/imperas-riscv-solutions. Accessed 02 Dec 2018

  26. Imperas Software: OVP simulator for RISC-V. https://github.com/riscv/riscv-ovpsim. Accessed 02 Dec 2018

  27. Ta, T., Cheng, L., Batten, C.: Simulating multi-core RISC-V systems in Gem5. In: 1st CARRV (2018)

    Google Scholar 

  28. Waterman, A., Lee, Y., Patterson, D.A., Asanovi, K.: The RISC-V instruction set manual. Volume 1: user-level ISA, version 2.0. Technical report, EECS Department, University of California, Berkeley (2014)

    Google Scholar 

  29. Zhang, X., Guo, Q., Chen, Y., Chen, T., Hu, W.: HERMES: a fast cross-ISA binary translator with post-optimization. In: CG0 2015 (2015)

    Google Scholar 

Download references

Acknowledgments

We would like to thank CNPq (Grant #: 313012/2017-2), CAPES (PROCAD 2966/2014), and the São Paulo Research Foundation, FAPESP (Grant #: 2013/08293-7) for supporting this research.

Author information

Authors and Affiliations

Authors

Corresponding authors

Correspondence to Leandro Lupori , Vanderson Martins do Rosario or Edson Borin .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2020 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Lupori, L., do Rosario, V.M., Borin, E. (2020). High-Performance RISC-V Emulation. In: Bianchini, C., Osthoff, C., Souza, P., Ferreira, R. (eds) High Performance Computing Systems. WSCAD 2018. Communications in Computer and Information Science, vol 1171. Springer, Cham. https://doi.org/10.1007/978-3-030-41050-6_9

Download citation

  • DOI: https://doi.org/10.1007/978-3-030-41050-6_9

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-41049-0

  • Online ISBN: 978-3-030-41050-6

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics