Agnisys Automation Review Louie De Luna
Louie is the Director of Marketing and Sales at Agnisys, Inc. He has over 15 years of experience in FPGAs, ASICs and EDA industries. Louie was most recently the Director of Marketing for Aldec where he was instrumental in the development and execution of the strategy for the entire functional … More » Creating Test Sequences for RISC-V Cores and SoCsOctober 7th, 2019 by Louie De Luna
The idea of an open-source CPU core was virtually unheard-of ten years ago – let alone using it for commercial applications. The CPU core has been the most critical part of any computing system and thus, has been the most valuable and profitable. Over the years, companies like IBM®, Intel® and ARM® have built their empires either from CPU core development or license distribution. Fast forward to today, the entire computing industry is in the early stages of a new paradigm shift where the CPU would no longer be the central processing unit. Mainly driven by the exploding growth of data that we produce and consume as a global society, even the highly successful von Neumann architecture is becoming obsolete. There is big data used for prediction, analytics and machine learning training, and there is fast data used for real-time applications such as IoT edge, geo-spatial systems and autonomous vehicles. As we prepare for the future, data would need to be at the center stage. The computing architecture would need to be data-centric rather than CPU-centric. The CPU would only be one of the types of hardware along with GPUs, FPGAs, custom accelerators, special-purpose CPUs, memory and storage, all connected to an open-source interface and all are powered by an open-source Instruction Set Architecture (ISA). The ISA that is poised to be the key enabler for all of this is RISC-V. Ever since the group at UC Berkeley completed RISC-V and released it as open-source in 2014, the game started to change. Learning from the success of the Linux Foundation, RISC-V Foundation was also started in 2015, and now comprises of 325 members organizations ensuring that the world’s first open ISA will prove to be useful towards mass adoption. Western Digital Corporation (WDC), one of the founding leaders of the RISC-V Foundation (and also one of our customers), released a commercial-grade open-source CPU core based on RISC-V called SweRV™, a 32-bit CPU that supports RISC-V integer, compressed instruction, multiplication and division, and instruction-fetch fence and CSR instructions extensions. The core is a 9-stage, dual-issue, superscalar pipeline. SweRV delivers about 4.9 Coremark/MHz, in-between Intel Xeon™ E5 at ~5.5 Coremark/MHz and ARM Cortex™ A15 at ~4.7 Coremark/MHz. The spec, design source code and testbench for SweRV is available on Github. The testbench is quite limited for commercial applications, so if you’re planning to adopt SweRV into your commercial SoC, a more robust hardware verification approach would be needed. At a minimum you would need the test scenarios and test environments for simulation, firmware tests and board testing. For stimulus, typically you would need:
One of the main challenges in creating the sequences is that multiple engineers with varying types of expertise would need to write them in the target language for simulation, firmware tests and board testing, even though the sequence functionality is the same. And before they can even code the sequences, they must first understand the test spec which in itself requires a significant amount of time and effort. In this blog, we will show how you can describe the sequences in pseudo-code only once, and use ISequenceSpec™ Sequence Generator to generate the sequences in the target language. To demonstrate this, we chose SweRV’s Programmable Interrupt Controller (PIC). The PIC core is responsible for evaluating all pending/enabled interrupt requests and picking the highest-priority request with the lowest interrupt source ID. Section 5.5 Theory of Operation of the SweRV specification describes the sequences for initialization and regular operation. SweRV CSR Specification Sequences mainly consist of various register read/writes that are executed in series or in parallel. So first, we need to make sure that we have the SweRV Control Status Register (CSR) properly defined. Figure 2 shows the CSR definition in spreadsheet format using IDesignSpec™ Excel. SweRV has 14 unique registers in which a few of them are simply repeated twice such as ‘meigwctrl’ and ‘meipl’ registers. The corresponding RTL, UVM register model, C Headers and documentation can be easily generated from a single source using IDesignSpec. When the CSR is captured in this manner, you will be able to minimize SoC functional flaws caused by errors/changes in the specification. PIC Core Initialization and Regular Operation Sequences You can specify hierarchical sequences in pseudo-code using Python text, Word™ document style or Excel™ spreadsheet environments. Language constructs such as ‘if-else’, ‘while’ and ‘for’ statements can be used, as well as ‘fork-join’ statements for concurrent sequences. Similarly, randomization and constraints for fields and variables are also supported. There are five main sections used for describing the sequences:
Figure 3 shows the initialization sequences for the PIC core captured in pseudo-code. Figure 3: Sequences for Initialization of PIC core in ISequenceSpec Excel Figure 4 shows the sequences for the regular operation of the PIC core in pseudo-code. Figure 4: Sequences for Regular Operation of PIC core in ISequenceSpec Excel A number of syntax and semantic problems can occur during the creation of the sequences, so ISequenceSpec is equipped with a smart syntax and semantic checker for validating the format and syntax within the specification. Once the validation is complete then the user can generate the output sequences in the target language. In this example the following outputs are generated:
NOTE: Feel free to contact us if you need the full package of input and output files mentioned in this blog. Specifying the sequences in a single source and allowing the code generator to retarget them in various languages is called a golden-spec methodology. All of the sequences are derived from a golden spec. Any changes to the sequences must be done in the spec as opposed to making them in the actual code. This would prevent discrepancies between sequence functionality used in simulation, firmware tests and board testing. Naturally, similar to the PIC core, there are various on-chip IPs in the SweRV core. Sequences for these IPs can also be specified using ISequenceSpec and the sequence code generated. As you adopt the SweRV core into your SoC you would also have off-chip IPs connected to the core through a system bus such as 64-bit AXI4 or AHB-Lite . These standard buses are supported by our tools such that the bus interface logic is also auto-generated along with the RTL and UVM register model. The SweRV core is set to play a critical role towards the mass adoption of RISC-V. WDC has committed to transition over 1 billion cores per year into RISC-V, and SweRV core will be the first one to be integrated. The road towards mass adoption will be certainly long and bumpy, but with the contributions from companies such as WDC the future looks bright, especially if the entire industry collaborates together and put aside competitive nuances. The world is producing an unbelievable amount of data in an ever-increasing rate, and by 2020 we should have about 40 trillion gigabytes of data in which 90% was only produced within the last 2 years. High-quality data is now a valuable commodity that could potentially become more useful than oil as it can be reused, replicated and transferred at the speed of light to power many AI applications that would simplify our daily life. Open-source interfaces and open-source CPU cores are now evolving to become more data-centric. In a way we are witnessing the works of innovation as it turns and switch gears. We are showcasing this tool flow for RISC-V at DVCON Europe in Munich, Germany on October 29-30, 2019. Stop by our booth and ask us how you can improve and simplify verification as you adopt SweRV into your SoC. Tags: DVCon, IDesignSpec, IoT, ISequenceSpec, machine learning, RISC-V, SoC, test sequences, UVM |