/home/quantr.foundation/www/wp-content/plugins/quantr-foundation-wordpress-widgets/blog_shortcode_html.php:8:
object(WP_Post)[2659]
  public 'ID' => int 2946
  public 'post_author' => string '1' (length=1)
  public 'post_date' => string '2024-01-29 17:24:21' (length=19)
  public 'post_date_gmt' => string '2024-01-29 09:24:21' (length=19)
  public 'post_content' => string '<!-- wp:heading {"level":1} -->
<h1 class="wp-block-heading">Quantr Foundation Achievements 2023</h1>
<!-- /wp:heading -->

<!-- wp:heading -->
<h2 class="wp-block-heading">RISC-V Simulator</h2>
<!-- /wp:heading -->

<!-- wp:image {"align":"left","id":2949,"width":"439px","height":"auto","sizeSlug":"full","linkDestination":"media"} -->
<figure class="wp-block-image alignleft size-full is-resized"><a href="https://www.quantr.foundation/wp-content/uploads/2024/01/riscv-simulator2023.png"><img src="https://www'... (length=13582)
  public 'post_title' => string '2023 Achievements' (length=17)
  public 'post_excerpt' => string '' (length=0)
  public 'post_status' => string 'publish' (length=7)
  public 'comment_status' => string 'open' (length=4)
  public 'ping_status' => string 'open' (length=4)
  public 'post_password' => string '' (length=0)
  public 'post_name' => string '2023-achievements' (length=17)
  public 'to_ping' => string '' (length=0)
  public 'pinged' => string '' (length=0)
  public 'post_modified' => string '2024-02-02 14:08:13' (length=19)
  public 'post_modified_gmt' => string '2024-02-02 06:08:13' (length=19)
  public 'post_content_filtered' => string '' (length=0)
  public 'post_parent' => int 0
  public 'guid' => string 'https://www.quantr.foundation/?p=2946' (length=37)
  public 'menu_order' => int 0
  public 'post_type' => string 'post' (length=4)
  public 'post_mime_type' => string '' (length=0)
  public 'comment_count' => string '0' (length=1)
  public 'filter' => string 'raw' (length=3)
2023 Achievements
Quantr Foundation Achievements 2023 RISC-V Simulator RISC-V is an open and free instruction set architecture (ISA) that supports various types of computing devices, from embedded systems to supercomputers. RISC-V has many advantages over proprietary ISAs, such as lower cost, flexibility, and innovation. However, RISC-V also faces some challenges, such as the lack of standardization, compatibility, […]

Quantr Foundation Achievements 2023

RISC-V Simulator

RISC-V is an open and free instruction set architecture (ISA) that supports various types of computing devices, from embedded systems to supercomputers. RISC-V has many advantages over proprietary ISAs, such as lower cost, flexibility, and innovation. However, RISC-V also faces some challenges, such as the lack of standardization, compatibility, and optimization.

To address these challenges, Quantr Foundation, a non-profit organization dedicated to promoting RISC-V education and development, has created a RISC-V simulator that can help developers and learners to design, test, and debug RISC-V based systems. The Quantr RISC-V simulator is a Java-based tool that can run RISC-V assembly programs and display the execution on different microarchitectures, such as single-cycle and pipelined. The simulator also supports the V extension, which adds vector-based SIMD capabilities to RISC-V, enabling faster and more efficient processing of tasks like media, graphics, and machine learning.

The Quantr RISC-V simulator is not only a useful tool for RISC-V enthusiasts, but also a platform for innovation and collaboration. The simulator is open-source and allows users to add custom fields, transform, merge, trim, and encrypt sections of the executable file format, and optimize the performance and security of the system. The simulator also integrates with other RISC-V projects, such as the QtRVSim, a graphical user interface for the simulator, and the Quantr RISC-V executable file format (.QR), a new format specially designed for RISC-V assembled files.

The Quantr RISC-V simulator is a valuable contribution to the RISC-V community, as it demonstrates the potential and possibilities of RISC-V as a universal ISA for the future of computing. By providing a user-friendly and powerful simulator, Quantr Foundation hopes to inspire more people to join the RISC-V movement and create a more diverse and inclusive computing ecosystem.

QEMU Log Panel

QEMU is a popular open-source emulator that can run various operating systems and architectures on a single host machine. QEMU is widely used for CPU development, as it allows developers to test their code on different platforms without the need for physical hardware. However, QEMU also generates a large amount of log data, which can be difficult to analyze and debug.

To solve this problem, Quantr Foundation, a non-profit organization that promotes RISC-V education and development, has created a QEMU log panel, a software tool that can help developers and learners to analyze the log generated by QEMU. The QEMU log panel is a Java-based tool that can convert the QEMU log into an H2 database, which can be queried and manipulated using SQL commands. The QEMU log panel also provides a graphical user interface (GUI) that can display the log data in a table format, and allow users to compare the log data from different sources, such as xv6-riscv, a simple Unix-like operating system for RISC-V, and Quantr's own RISC-V simulator.

The QEMU log panel is not only a useful tool for QEMU users, but also a platform for learning and innovation. The QEMU log panel is open-source and allows users to customize and extend its functionality, such as adding new fields, transforming, merging, trimming, and encrypting sections of the executable file format, and optimizing the performance and security of the system. The QEMU log panel also integrates with other RISC-V projects, such as the Quantr RISC-V executable file format (.QR), a new format specially designed for RISC-V assembled files, and the Quantr RISC-V simulator, a Java-based tool that can run RISC-V assembly programs and display the execution on different microarchitectures.

The QEMU log panel is a valuable contribution to the QEMU and RISC-V communities, as it demonstrates the power and potential of QEMU as a versatile emulator for CPU development. By providing a user-friendly and powerful log analyzer, Quantr Foundation hopes to inspire more people to join the QEMU and RISC-V movements and create a more diverse and inclusive computing ecosystem.

Quantr Logic - Circuit simulator

Quantr Logic is a circuit simulator that can help developers and learners to design, test, and debug digital logic circuits. Quantr Logic is a web-based tool that can run on any browser and device, without the need for installation or registration. Quantr Logic is developed by Quantr Foundation, a non-profit organization dedicated to promoting RISC-V education and development.

Quantr Logic allows users to create and edit circuits using a drag-and-drop interface, and provides a variety of components, such as gates, flip-flops, multiplexers, decoders, and registers. Quantr Logic also supports the creation of custom components, which can be reused and shared with other users. Quantr Logic can simulate the circuits in real-time, and display the values of the inputs, outputs, and internal signals. Quantr Logic also provides a waveform viewer, which can show the changes of the signals over time, and a truth table generator, which can show the logical relations between the inputs and outputs.

Quantr Logic is not only a useful tool for circuit design, but also a platform for learning and innovation. Quantr Logic is open-source and allows users to contribute to its development and improvement. Quantr Logic also integrates with other RISC-V projects, such as the Quantr RISC-V executable file format (.QR), a new format specially designed for RISC-V assembled files, and the Quantr RISC-V simulator, a Java-based tool that can run RISC-V assembly programs and display the execution on different microarchitectures.

Quantr Logic is a valuable contribution to the circuit design and RISC-V communities, as it demonstrates the power and potential of digital logic circuits as the building blocks of computing systems. By providing a user-friendly and powerful circuit simulator, Quantr Foundation hopes to inspire more people to join the circuit design and RISC-V movements and create a more diverse and inclusive computing ecosystem.

What we do in 2024

The Hong Kong CPU Project is an open source project initiated by Hong Kong people to design and manufacture a central processing unit (CPU) based on the RISC-V architecture. RISC-V is a free and open instruction set architecture (ISA) suitable for various types of computing devices, from embedded systems to supercomputers. RISC-V has many advantages over other proprietary ISAs, such as low cost, flexibility and innovation. The Hong Kong people’s CPU project hopes to use the advantages of RISC-V to create a CPU suitable for Hong Kong people and at the same time promote the development of computer technology in Hong Kong.

Hong Kong's CPU project covers all stages of CPU design, simulation, verification, compilation, testing and manufacturing. The plan uses a variety of open source tools and platforms, such as QEMU, CPU-Z, Computer and Communication Products Recycling Program, etc. The plan also cooperates with other RISC-V projects, such as Quantr Foundation's RISC-V simulator, RISC-V executable file format (.QR), QtRVSim, etc. The result of the project is a CPU called HKCPU, which uses the 32-bit RISC-V ISA and supports V extensions, the vectorized SIMD function, which can speed up and improve the efficiency of processing tasks such as media, imaging and machine learning.

The Hong Kong people's CPU project is a valuable contribution, showing the creativity and ability of Hong Kong people to the world. By providing a user-friendly and powerful CPU, Hong Kong’s CPU Project hopes to inspire more Hong Kong people to participate in the RISC-V movement, while creating a more diverse and inclusive ecosystem for Hong Kong’s computer technology.

香港人嘅cpu計劃是一個由香港人發起嘅開源計劃,目的係為咗設計同製造一個基於RISC-V架構嘅中央處理器(CPU)。RISC-V係一個自由同開放嘅指令集架構(ISA),適用於各種類型嘅計算設備,由嵌入式系統到超級電腦。RISC-V相比其他專有嘅ISA,有好多優勢,例如低成本、靈活性同創新性。香港人嘅cpu計劃希望利用RISC-V嘅優勢,打造一個適合香港人嘅CPU,同時推動香港嘅計算機科技發展。

香港人嘅cpu計劃涵蓋咗CPU嘅設計、模擬、驗證、編譯、測試同製造等各個階段。計劃採用咗多種開源嘅工具同平台,例如QEMU、CPU-Z、電腦及通訊產品回收計劃等。計劃亦同其他RISC-V嘅項目有合作,例如Quantr Foundation嘅RISC-V模擬器、RISC-V執行檔格式(.QR)、QtRVSim等。計劃嘅成果係一個名為HKCPU嘅CPU,佢採用咗32位元嘅RISC-V ISA,支援V擴展,即向量化SIMD功能,可以加快同提高處理媒體、圖像同機器學習等任務嘅效率。

香港人嘅cpu計劃係一個有價值嘅貢獻,向世界展示咗香港人嘅創意同能力。通過提供一個用戶友好同強大嘅CPU,香港人嘅cpu計劃希望激勵更多香港人參與RISC-V嘅運動,同時為香港嘅計算機科技創造一個更多元同包容嘅生態系統。

			
/home/quantr.foundation/www/wp-content/plugins/quantr-foundation-wordpress-widgets/blog_shortcode_html.php:8:
object(WP_Post)[2660]
  public 'ID' => int 2932
  public 'post_author' => string '1' (length=1)
  public 'post_date' => string '2024-01-03 16:47:23' (length=19)
  public 'post_date_gmt' => string '2024-01-03 08:47:23' (length=19)
  public 'post_content' => string '<!-- wp:paragraph -->
<p>All our swing projects use this class to serialize settings into XML, back and forth. It is quite convenient but if we create an annotation for this, it would be even better because we can automate the load/save code. Here is the proposal:</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>This save the variable x into xml call &lt;classname-x&gt;</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>@save<br>public int x;</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>This s'... (length=2488)
  public 'post_title' => string 'Serialize settings enhancement proposal' (length=39)
  public 'post_excerpt' => string '' (length=0)
  public 'post_status' => string 'publish' (length=7)
  public 'comment_status' => string 'open' (length=4)
  public 'ping_status' => string 'open' (length=4)
  public 'post_password' => string '' (length=0)
  public 'post_name' => string 'serialize-settings' (length=18)
  public 'to_ping' => string '' (length=0)
  public 'pinged' => string '' (length=0)
  public 'post_modified' => string '2024-01-03 16:53:52' (length=19)
  public 'post_modified_gmt' => string '2024-01-03 08:53:52' (length=19)
  public 'post_content_filtered' => string '' (length=0)
  public 'post_parent' => int 0
  public 'guid' => string 'https://www.quantr.foundation/?p=2932' (length=37)
  public 'menu_order' => int 0
  public 'post_type' => string 'post' (length=4)
  public 'post_mime_type' => string '' (length=0)
  public 'comment_count' => string '0' (length=1)
  public 'filter' => string 'raw' (length=3)
Serialize settings enhancement proposal
All our swing projects use this class to serialize settings into XML, back and forth. It is quite convenient but if we create an annotation for this, it would be even better because we can automate the load/save code. Here is the proposal: This save the variable x into xml call <classname-x> @savepublic int x; […]

All our swing projects use this class to serialize settings into XML, back and forth. It is quite convenient but if we create an annotation for this, it would be even better because we can automate the load/save code. Here is the proposal:

This save the variable x into xml call <classname-x>

@save
public int x;

This save the variable into xml call <my_x>

@save(name=my_x)
public int x;

The xml by default call "setting.xml", unless specify

@save(name=my_x, file=mySetting.xml)
public int x;

package hk.quantr.qemulogpanel;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;

import org.apache.commons.io.IOUtils;

import com.thoughtworks.xstream.XStream;
import java.io.FileNotFoundException;

public class Setting {

	private static Setting setting = null;
	public static File file = new File("setting.xml");
	public int x;
	public int y;
	public int width;
	public int height;
	public int dividerLocation;

	public String compareDialog_from;
	public String compareDialog_to;
	public String compareDialog_limit;
	public String compareDialog_qemu;
	public String compareDialog_quantr;

	public Setting() {
		width = 800;
		height = 600;
	}

	public static Setting getInstance() {
		if (setting == null) {
			setting = load();
		}
		return setting;
	}

	public void save() {
		XStream xstream = new XStream();
		xstream.alias("Setting", Setting.class);
		String xml = xstream.toXML(this);
		try {
			IOUtils.write(xml, new FileOutputStream(file));
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public static Setting load() {
		try {
			XStream xstream = new XStream();
			xstream.allowTypes(new Class[]{Setting.class});
			xstream.alias("Setting", Setting.class);
			Setting s = (Setting) xstream.fromXML(new FileInputStream(file));
			return s;
		} catch (FileNotFoundException ex) {
			ex.printStackTrace();
			file.delete();
			setting = new Setting();
			setting.save();
			return setting;
		}
	}

}
			
/home/quantr.foundation/www/wp-content/plugins/quantr-foundation-wordpress-widgets/blog_shortcode_html.php:8:
object(WP_Post)[2664]
  public 'ID' => int 2887
  public 'post_author' => string '1' (length=1)
  public 'post_date' => string '2023-12-26 19:06:17' (length=19)
  public 'post_date_gmt' => string '2023-12-26 11:06:17' (length=19)
  public 'post_content' => string '<!-- wp:paragraph -->
<p>After doing much online research and reading many reference books, our team has figured out a way to convert logic circuits into look-up tables (LUT).</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2 class="wp-block-heading"><strong>Overview</strong></h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>To convert a logic circuit into LUTs, first we should convert them to 2-input logic gates. The decomposition could only be done with two or fewer input logic gates. After that, we h'... (length=20966)
  public 'post_title' => string 'Converting Logic Circuit into Look-Up Tables (LUT)' (length=50)
  public 'post_excerpt' => string '' (length=0)
  public 'post_status' => string 'publish' (length=7)
  public 'comment_status' => string 'open' (length=4)
  public 'ping_status' => string 'open' (length=4)
  public 'post_password' => string '' (length=0)
  public 'post_name' => string 'converting-logic-circuit-into-look-up-tables-lut' (length=48)
  public 'to_ping' => string '' (length=0)
  public 'pinged' => string '' (length=0)
  public 'post_modified' => string '2023-12-29 16:57:09' (length=19)
  public 'post_modified_gmt' => string '2023-12-29 08:57:09' (length=19)
  public 'post_content_filtered' => string '' (length=0)
  public 'post_parent' => int 0
  public 'guid' => string 'https://www.quantr.foundation/?p=2887' (length=37)
  public 'menu_order' => int 0
  public 'post_type' => string 'post' (length=4)
  public 'post_mime_type' => string '' (length=0)
  public 'comment_count' => string '0' (length=1)
  public 'filter' => string 'raw' (length=3)
Converting Logic Circuit into Look-Up Tables (LUT)
After doing much online research and reading many reference books, our team has figured out a way to convert logic circuits into look-up tables (LUT). Overview To convert a logic circuit into LUTs, first we should convert them to 2-input logic gates. The decomposition could only be done with two or fewer input logic gates. […]

After doing much online research and reading many reference books, our team has figured out a way to convert logic circuits into look-up tables (LUT).

Overview

To convert a logic circuit into LUTs, first we should convert them to 2-input logic gates. The decomposition could only be done with two or fewer input logic gates. After that, we have to convert the diagram to a reduced ordered binary decision diagram (ROBDD). Thus, breaking down the logic circuit into the desired number of inputs in the LUT.

For converting the boolean algebra into a binary decision diagram (BDD), there are certain formulas for converting different logic gates. We could compose the boolean algebra with AND gates, OR gates, XOR gates, and NOT gate. They are listed below:

Fig 1. Convert boolean algebra (or , and) to BDD and BDD to ROBDD

Fig 2. Convert boolean algebra (xor, not) to BDD and BDD to ROBDD

To illustrate how to do the decomposition, here is a simple example:

The logic circuit of the above boolean algebra looks like this:

First, we have to convert every single input into a binary decision diagram (BDD). Then we convert the whole circuit into a Reduced-Ordered-Binary-Decision Diagram (ROBDD).

After that, we can do the cut according to our desired number of inputs in the LUT. In this case, we are trying to break down the logic circuit into a 3-input LUT, so we could apply the cut after node c.

After that, we could create a 3-input look-up table (LUT) containing the possible signals of node a, node b and node c in the LUT.

a b c output
0000
0010
0100
0111
1000
1011
1100
1111
3-input LUT of the logic circuit example

As you can see, only [011, 101, 111] has an output of 1, which gives the signal to node d. Now, we could create another look-up table for the final output.

output d null input (don't cares)final output
00x0
01x0
10x0
11x1
final 3-input LUT of the logic circuit example

Finally, the logic circuit with LUT would look like:

To have a deeper understanding of the topic, here is another example:

The logic circuit of the above boolean algebra looks like this:

As you can see, the above logic circuit has a 3-input AND gate; we could not do the decomposition with a logic gate with a number of inputs greater than 2. Therefore, we have to convert the logic circuit with every component having a number of inputs less than 2 before doing the decomposition.

The logic circuit after conversion is shown below:

Now, we convert every input into a binary decision diagram (BDD)and convert the whole circuit into a Reduced-Ordered-Binary-Decision Diagram (ROBDD).

In this case, we are trying to break down the logic circuit into a 3-input LUT, so we could apply the cut after node c.

After that, we could create a 3-input look-up table (LUT) containing the possible signals of node a, node b, and node c in the 3-input LUT.

a b c output
0000
0010
0100
0111
1000
1011
1100
1111
3-input LUT of the logic circuit example

Now, we could create another look-up table for the final output.

output d null input (don't cares)final output
00x0
01x0
10x1
11x0
final 3-input LUT of the logic circuit example

Finally, the logic circuit with LUT would look like:

Coming dev plan

Modify quantr-logic to support converting the circuit into LUTs. The LUT library is in here. Added two buttons, one for converting the circuit into a 2-input circuit, second button is to generate everything we need in LUTs.

Author: Michelle

			
/home/quantr.foundation/www/wp-content/plugins/quantr-foundation-wordpress-widgets/blog_shortcode_html.php:8:
object(WP_Post)[2693]
  public 'ID' => int 2850
  public 'post_author' => string '1' (length=1)
  public 'post_date' => string '2023-11-12 00:49:12' (length=19)
  public 'post_date_gmt' => string '2023-11-11 16:49:12' (length=19)
  public 'post_content' => string '<!-- wp:image {"align":"center","id":2858,"width":"118px","height":"auto","sizeSlug":"full","linkDestination":"none"} -->
<figure class="wp-block-image aligncenter size-full is-resized"><img src="https://www.quantr.foundation/wp-content/uploads/2023/11/avenger.png" alt="" class="wp-image-2858" style="width:118px;height:auto"/></figure>
<!-- /wp:image -->

<!-- wp:paragraph {"className":"mt-4"} -->
<p class="mt-4">There are too many guys who claim they are industry leaders and tell teenagers their resea'... (length=3998)
  public 'post_title' => string 'Avenger License' (length=15)
  public 'post_excerpt' => string '' (length=0)
  public 'post_status' => string 'publish' (length=7)
  public 'comment_status' => string 'open' (length=4)
  public 'ping_status' => string 'open' (length=4)
  public 'post_password' => string '' (length=0)
  public 'post_name' => string 'avenger-license' (length=15)
  public 'to_ping' => string '' (length=0)
  public 'pinged' => string '' (length=0)
  public 'post_modified' => string '2023-12-26 18:01:59' (length=19)
  public 'post_modified_gmt' => string '2023-12-26 10:01:59' (length=19)
  public 'post_content_filtered' => string '' (length=0)
  public 'post_parent' => int 0
  public 'guid' => string 'https://www.quantr.foundation/?p=2850' (length=37)
  public 'menu_order' => int 0
  public 'post_type' => string 'post' (length=4)
  public 'post_mime_type' => string '' (length=0)
  public 'comment_count' => string '0' (length=1)
  public 'filter' => string 'raw' (length=3)
Avenger License
There are too many guys who claim they are industry leaders and tell teenagers their research is meaningless and not worth doing. As an ancestor, they don’t provide skill and money but rather keep bullshitting around teenagers. As revenge, an “avenger license” is needed, this license is based on Apache License version 2.0 with additional […]

There are too many guys who claim they are industry leaders and tell teenagers their research is meaningless and not worth doing. As an ancestor, they don't provide skill and money but rather keep bullshitting around teenagers. As revenge, an "avenger license" is needed, this license is based on Apache License version 2.0 with additional terms:

  1. Avenger license is only applicable in Hong Kong. For anyone outside Hong Kong, the Avenger license is the same as the Apache license version 2.0
  2. If he/she were a Hong Kong citizen and moved outside Hong Kong, they still applicable for this license
  3. If he/she says the project is not worth doing or has no chance of success, the Avenger license will block their 10-closest relationship people from using the software/hardware:
    • Great-grandfather
    • Grandfather
    • Father
    • Myself
    • Son
    • Grandson
    • Great-grandson
    • Colleague
    • Wife
    • Wife's colleague

有太多人聲稱自己是行業領導者或前輩,並告訴青少年他們的研究毫無意義,不值得做。 作為前輩,他們不但不提供技能和金錢,而是不斷在青少年周圍胡言亂語。 作為報復,需要一個“復仇者許可證”,該許可證基於 Apache License 2.0 版,附加條款:

  1. Avenger牌照只適用於香港。 對於香港以外的任何人,Avenger 許可證與 Apache 許可證版本 2.0 相同
  2. 如果他/她是香港公民並移居香港以外地區,他們仍然適用此許可證
  3. 如果他/她說該專案不值得做或沒有成功的機會,Avenger 許可證將阻止他們關係最密切的十種人使用該軟體/硬體:
    • 曾祖父
    • 祖父
    • 父親
    • 兒子
    • 孫子
    • 曾孫
    • 同事
    • 妻子
    • 妻子的同事
			
/home/quantr.foundation/www/wp-content/plugins/quantr-foundation-wordpress-widgets/blog_shortcode_html.php:8:
object(WP_Post)[2662]
  public 'ID' => int 2828
  public 'post_author' => string '1' (length=1)
  public 'post_date' => string '2023-09-01 13:27:12' (length=19)
  public 'post_date_gmt' => string '2023-09-01 05:27:12' (length=19)
  public 'post_content' => string '<!-- wp:image {"align":"center","id":2829,"width":1200,"sizeSlug":"full","linkDestination":"media"} -->
<figure class="wp-block-image aligncenter size-full is-resized"><a href="https://www.quantr.foundation/wp-content/uploads/2023/09/Quantr-Logic-PLD.png"><img src="https://www.quantr.foundation/wp-content/uploads/2023/09/Quantr-Logic-PLD.png" alt="" class="wp-image-2829" style="width:1200px" width="1200"/></a></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>Initially, we were thinking of synthesizing '... (length=1041)
  public 'post_title' => string 'Now we need a compiler' (length=22)
  public 'post_excerpt' => string '' (length=0)
  public 'post_status' => string 'publish' (length=7)
  public 'comment_status' => string 'open' (length=4)
  public 'ping_status' => string 'open' (length=4)
  public 'post_password' => string '' (length=0)
  public 'post_name' => string 'now-we-need-a-compiler' (length=22)
  public 'to_ping' => string '' (length=0)
  public 'pinged' => string '' (length=0)
  public 'post_modified' => string '2023-09-11 18:19:12' (length=19)
  public 'post_modified_gmt' => string '2023-09-11 10:19:12' (length=19)
  public 'post_content_filtered' => string '' (length=0)
  public 'post_parent' => int 0
  public 'guid' => string 'https://www.quantr.foundation/?p=2828' (length=37)
  public 'menu_order' => int 0
  public 'post_type' => string 'post' (length=4)
  public 'post_mime_type' => string '' (length=0)
  public 'comment_count' => string '0' (length=1)
  public 'filter' => string 'raw' (length=3)
Now we need a compiler
Initially, we were thinking of synthesizing our logic into FPGA, but most of the vendors don’t open their bitstream format, and hacking takes a huge amount of time. Now we have changed a new way: we synthesize our logic into PLD (programmable logic device), especially for CPLD or PAL. Now we need a logic compiler, […]

Initially, we were thinking of synthesizing our logic into FPGA, but most of the vendors don't open their bitstream format, and hacking takes a huge amount of time. Now we have changed a new way: we synthesize our logic into PLD (programmable logic device), especially for CPLD or PAL.

Now we need a logic compiler, converting the diagram data structure which outputs from Quantr-Logic to boolean algebra, and compiles it into PLD format, which can be sent to the programmer to burn the logic.

			
/home/quantr.foundation/www/wp-content/plugins/quantr-foundation-wordpress-widgets/blog_shortcode_html.php:8:
object(WP_Post)[2665]
  public 'ID' => int 2823
  public 'post_author' => string '1' (length=1)
  public 'post_date' => string '2023-08-28 00:21:46' (length=19)
  public 'post_date_gmt' => string '2023-08-27 16:21:46' (length=19)
  public 'post_content' => string '<!-- wp:paragraph -->
<p>The principle is to generate two h2 database file, one from executing qemu, one from executing riscv-simulator</p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><!-- wp:list-item -->
<li>Go to /Users/peter/workspace/riscv-simulator/src/test/resources/hk/quantr/riscv_simulator/elf/timer</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>make run , then you have cpu.log</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>run "java -jar  ~/workspace/qemu-log-pan'... (length=2337)
  public 'post_title' => string 'Debug timer example' (length=19)
  public 'post_excerpt' => string '' (length=0)
  public 'post_status' => string 'publish' (length=7)
  public 'comment_status' => string 'open' (length=4)
  public 'ping_status' => string 'open' (length=4)
  public 'post_password' => string '' (length=0)
  public 'post_name' => string 'debug-timer-example' (length=19)
  public 'to_ping' => string '' (length=0)
  public 'pinged' => string '' (length=0)
  public 'post_modified' => string '2023-08-28 00:21:48' (length=19)
  public 'post_modified_gmt' => string '2023-08-27 16:21:48' (length=19)
  public 'post_content_filtered' => string '' (length=0)
  public 'post_parent' => int 0
  public 'guid' => string 'https://www.quantr.foundation/?p=2823' (length=37)
  public 'menu_order' => int 0
  public 'post_type' => string 'post' (length=4)
  public 'post_mime_type' => string '' (length=0)
  public 'comment_count' => string '0' (length=1)
  public 'filter' => string 'raw' (length=3)
Debug timer example
The principle is to generate two h2 database file, one from executing qemu, one from executing riscv-simulator 5. run it, then you got the “dump.mv.db” in riscv-simulator folder 6. Now you can run the qemu-log-panel Then you see this

The principle is to generate two h2 database file, one from executing qemu, one from executing riscv-simulator

  1. Go to /Users/peter/workspace/riscv-simulator/src/test/resources/hk/quantr/riscv_simulator/elf/timer
  2. make run , then you have cpu.log
  3. run "java -jar  ~/workspace/qemu-log-panel/target/qemu-log-panel-1.0-jar-with-dependencies.jar -f cpu.log -t" to convert cpu.log to database.mv.db, which is the h2 database file
  4. Setup riscv-simulator as

5. run it, then you got the "dump.mv.db" in riscv-simulator folder

6. Now you can run the qemu-log-panel

Then you see this

			
/home/quantr.foundation/www/wp-content/plugins/quantr-foundation-wordpress-widgets/blog_shortcode_html.php:8:
object(WP_Post)[2666]
  public 'ID' => int 2816
  public 'post_author' => string '1' (length=1)
  public 'post_date' => string '2023-08-21 13:45:01' (length=19)
  public 'post_date_gmt' => string '2023-08-21 05:45:01' (length=19)
  public 'post_content' => string '<!-- wp:paragraph -->
<p>This year <a href="https://www.hkmu.edu.hk/" data-type="link" data-id="https://www.hkmu.edu.hk/">MUHK</a> FYP, join if you are MUHK student. These are our past project:</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><a href="https://www.hkmu.edu.hk/st/engsc/fyp/2021-22/risc-v-simd-simulation/">https://www.hkmu.edu.hk/st/engsc/fyp/2021-22/risc-v-simd-simulation/</a></p>
<!-- /wp:paragraph -->

<!-- wp:image {"id":2817,"width":900,"sizeSlug":"full","linkDestination":"media"} -->'... (length=836)
  public 'post_title' => string 'MUHK FYP' (length=8)
  public 'post_excerpt' => string '' (length=0)
  public 'post_status' => string 'publish' (length=7)
  public 'comment_status' => string 'open' (length=4)
  public 'ping_status' => string 'open' (length=4)
  public 'post_password' => string '' (length=0)
  public 'post_name' => string 'muhk-fyp' (length=8)
  public 'to_ping' => string '' (length=0)
  public 'pinged' => string '' (length=0)
  public 'post_modified' => string '2023-08-21 13:46:16' (length=19)
  public 'post_modified_gmt' => string '2023-08-21 05:46:16' (length=19)
  public 'post_content_filtered' => string '' (length=0)
  public 'post_parent' => int 0
  public 'guid' => string 'https://www.quantr.foundation/?p=2816' (length=37)
  public 'menu_order' => int 0
  public 'post_type' => string 'post' (length=4)
  public 'post_mime_type' => string '' (length=0)
  public 'comment_count' => string '0' (length=1)
  public 'filter' => string 'raw' (length=3)
MUHK FYP
This year MUHK FYP, join if you are MUHK student. These are our past project: https://www.hkmu.edu.hk/st/engsc/fyp/2021-22/risc-v-simd-simulation/

This year MUHK FYP, join if you are MUHK student. These are our past project:

https://www.hkmu.edu.hk/st/engsc/fyp/2021-22/risc-v-simd-simulation/

			
/home/quantr.foundation/www/wp-content/plugins/quantr-foundation-wordpress-widgets/blog_shortcode_html.php:8:
object(WP_Post)[2667]
  public 'ID' => int 2795
  public 'post_author' => string '1' (length=1)
  public 'post_date' => string '2023-07-09 22:12:49' (length=19)
  public 'post_date_gmt' => string '2023-07-09 14:12:49' (length=19)
  public 'post_content' => string '<!-- wp:paragraph -->
<p>It would be super fun to connect <a rel="noreferrer noopener" href="https://www.quantr.foundation/project/?project=Quantr%20Logic" target="_blank">Quantr-Logic</a> to breadboard, we need a media to do that and we think of Arduino. We will build the connector using <a rel="noreferrer noopener" href="https://gitlab.com/quantr/eda/quantr-logic/-/issues/30" target="_blank">Arduino boards</a>, lets see how funny it is.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":2796'... (length=863)
  public 'post_title' => string 'Our next move with Arduino' (length=26)
  public 'post_excerpt' => string '' (length=0)
  public 'post_status' => string 'publish' (length=7)
  public 'comment_status' => string 'open' (length=4)
  public 'ping_status' => string 'open' (length=4)
  public 'post_password' => string '' (length=0)
  public 'post_name' => string 'our-next-move-with-arduino' (length=26)
  public 'to_ping' => string '' (length=0)
  public 'pinged' => string '' (length=0)
  public 'post_modified' => string '2023-07-09 22:13:35' (length=19)
  public 'post_modified_gmt' => string '2023-07-09 14:13:35' (length=19)
  public 'post_content_filtered' => string '' (length=0)
  public 'post_parent' => int 0
  public 'guid' => string 'https://www.quantr.foundation/?p=2795' (length=37)
  public 'menu_order' => int 0
  public 'post_type' => string 'post' (length=4)
  public 'post_mime_type' => string '' (length=0)
  public 'comment_count' => string '0' (length=1)
  public 'filter' => string 'raw' (length=3)
Our next move with Arduino
It would be super fun to connect Quantr-Logic to breadboard, we need a media to do that and we think of Arduino. We will build the connector using Arduino boards, lets see how funny it is.

It would be super fun to connect Quantr-Logic to breadboard, we need a media to do that and we think of Arduino. We will build the connector using Arduino boards, lets see how funny it is.

			
/home/quantr.foundation/www/wp-content/plugins/quantr-foundation-wordpress-widgets/blog_shortcode_html.php:8:
object(WP_Post)[2668]
  public 'ID' => int 2786
  public 'post_author' => string '1' (length=1)
  public 'post_date' => string '2023-07-05 13:57:51' (length=19)
  public 'post_date_gmt' => string '2023-07-05 05:57:51' (length=19)
  public 'post_content' => string '<!-- wp:paragraph -->
<p>Gate-by-gate simulation is easy to implement, so our first stage is to implement the whole skeleton, including all components, the plugin engine, and the simulation engine. It has an obvious weak point: slow. We are now seeking a way to simulate a billion gates. We put our progress <a href="https://gitlab.com/quantr/eda/quantr-logic/-/issues/26" target="_blank" rel="noreferrer noopener">here</a>. Here is our first attempt:</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center",'... (length=2264)
  public 'post_title' => string 'Seeking a way to simulate billion gate' (length=38)
  public 'post_excerpt' => string '' (length=0)
  public 'post_status' => string 'publish' (length=7)
  public 'comment_status' => string 'open' (length=4)
  public 'ping_status' => string 'open' (length=4)
  public 'post_password' => string '' (length=0)
  public 'post_name' => string 'seeking-a-way-to-simulate-billion-gate' (length=38)
  public 'to_ping' => string '' (length=0)
  public 'pinged' => string '' (length=0)
  public 'post_modified' => string '2023-07-05 14:05:02' (length=19)
  public 'post_modified_gmt' => string '2023-07-05 06:05:02' (length=19)
  public 'post_content_filtered' => string '' (length=0)
  public 'post_parent' => int 0
  public 'guid' => string 'https://www.quantr.foundation/?p=2786' (length=37)
  public 'menu_order' => int 0
  public 'post_type' => string 'post' (length=4)
  public 'post_mime_type' => string '' (length=0)
  public 'comment_count' => string '0' (length=1)
  public 'filter' => string 'raw' (length=3)
Seeking a way to simulate billion gate
Gate-by-gate simulation is easy to implement, so our first stage is to implement the whole skeleton, including all components, the plugin engine, and the simulation engine. It has an obvious weak point: slow. We are now seeking a way to simulate a billion gates. We put our progress here. Here is our first attempt:

Gate-by-gate simulation is easy to implement, so our first stage is to implement the whole skeleton, including all components, the plugin engine, and the simulation engine. It has an obvious weak point: slow. We are now seeking a way to simulate a billion gates. We put our progress here. Here is our first attempt:

  1. We split the truth table and use RAM to direct output the result. Then the simulate no need to depend on the level of gate, it works much faster in most combinational circuits.
  2. We need to split the combinational circuit into piece and each piece work in similar duration, otherwise multithreading result will not be good, since some circuits take long time and some take short time to complete
  3. We need to think of offloading the simulation in GPU or FPGA. FPGA will work faster but the programming model is much harder and lack of cross-platform ability
  4. Trying the Tornardo VM to offload some java to CUDA
			
/home/quantr.foundation/www/wp-content/plugins/quantr-foundation-wordpress-widgets/blog_shortcode_html.php:8:
object(WP_Post)[2669]
  public 'ID' => int 2723
  public 'post_author' => string '1' (length=1)
  public 'post_date' => string '2023-04-23 19:48:49' (length=19)
  public 'post_date_gmt' => string '2023-04-23 11:48:49' (length=19)
  public 'post_content' => string '<!-- wp:paragraph -->
<p>We are going to start our breadboard RISC-V project. We build a simple RISC-V with students to fulfill the below requirements. The breadboard CPU is simple, but we will be in full stack, code the testing program in GCC, debug via GDB with our own jtag and by <a rel="noreferrer noopener" href="https://openocd.org/" target="_blank">openocd</a>.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"id":2729,"sizeSlug":"large","linkDestination":"media"} -->
<figure class="wp-block-image size-larg'... (length=12619)
  public 'post_title' => string 'Breadboard RISC-V' (length=17)
  public 'post_excerpt' => string '' (length=0)
  public 'post_status' => string 'publish' (length=7)
  public 'comment_status' => string 'open' (length=4)
  public 'ping_status' => string 'open' (length=4)
  public 'post_password' => string '' (length=0)
  public 'post_name' => string 'breadboard-risc-v' (length=17)
  public 'to_ping' => string '' (length=0)
  public 'pinged' => string '' (length=0)
  public 'post_modified' => string '2023-04-27 16:04:33' (length=19)
  public 'post_modified_gmt' => string '2023-04-27 08:04:33' (length=19)
  public 'post_content_filtered' => string '' (length=0)
  public 'post_parent' => int 0
  public 'guid' => string 'https://www.quantr.foundation/?p=2723' (length=37)
  public 'menu_order' => int 0
  public 'post_type' => string 'post' (length=4)
  public 'post_mime_type' => string '' (length=0)
  public 'comment_count' => string '0' (length=1)
  public 'filter' => string 'raw' (length=3)
Breadboard RISC-V
We are going to start our breadboard RISC-V project. We build a simple RISC-V with students to fulfill the below requirements. The breadboard CPU is simple, but we will be in full stack, code the testing program in GCC, debug via GDB with our own jtag and by openocd. Requirements: Remark 1: Outside the RISC-V […]

We are going to start our breadboard RISC-V project. We build a simple RISC-V with students to fulfill the below requirements. The breadboard CPU is simple, but we will be in full stack, code the testing program in GCC, debug via GDB with our own jtag and by openocd.

Requirements:

  1. A controllable program counter. We can set its speed and pause it at any time manually
  2. Support some basic instructions such as below
  3. Provide LED to indicate the status and register values on board
  4. Data bus & instruction bus
  5. 3 Stage pipeline and visualize it
  6. We use STM32 to build the USB tag and plug to our breadboard RISC-V, write openocd driver and able to dump out registers and single step via GDB

Remark 1:

Outside the RISC-V we still need some components such as a programmable clock generator, we do all that by ATtiny85 and flash it via this device

Remark 2:

For the memory rather than using gates, we use dip memory such as 24AA32AF and this device and flash the EEPROM memory

Bill Of Material

ThingQtyPrice
Digital Design and Computer Architecture: RISC-V Edition4$350
Breadboard60$180
We need some OLED (don't know how many, just buy them all)
0.96 inch x 20 + 1.3 inch x 20
40$600
LED200$80
8-segments LED100$300
USB Power Supply3$60
Button x 50 for each student3$80
Cable x 300 for each student3$50
We need some gates but I don't know which one, so buy them all3$800
Switch3$80
STM32 board and JTag to offload some logic outside RISC-V3$100
Tester3$300
Logic Analyzer3$80
Ben Eater Complete 8-bit breadboard computer kit bundle3$7020
Multimeter3$800
Total =$10880
			
/home/quantr.foundation/www/wp-content/plugins/quantr-foundation-wordpress-widgets/blog_shortcode_html.php:8:
object(WP_Post)[2670]
  public 'ID' => int 2683
  public 'post_author' => string '1' (length=1)
  public 'post_date' => string '2023-04-18 00:07:17' (length=19)
  public 'post_date_gmt' => string '2023-04-17 16:07:17' (length=19)
  public 'post_content' => string '<!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column -->
<div class="wp-block-column"><!-- wp:image {"align":"right","id":2685,"width":157,"height":157,"sizeSlug":"full","linkDestination":"media"} -->
<figure class="wp-block-image alignright size-full is-resized"><a href="https://www.quantr.foundation/wp-content/uploads/2023/04/image.png"><img src="https://www.quantr.foundation/wp-content/uploads/2023/04/image.png" alt="" class="wp-image-2685" width="157" height="157"/></a></figure>
<!-- /wp:ima'... (length=4411)
  public 'post_title' => string 'STM32 project with Dim Sum Labs' (length=31)
  public 'post_excerpt' => string '' (length=0)
  public 'post_status' => string 'publish' (length=7)
  public 'comment_status' => string 'open' (length=4)
  public 'ping_status' => string 'open' (length=4)
  public 'post_password' => string '' (length=0)
  public 'post_name' => string 'stm32-project-with-dim-sum-labs' (length=31)
  public 'to_ping' => string '' (length=0)
  public 'pinged' => string '' (length=0)
  public 'post_modified' => string '2023-04-21 12:26:46' (length=19)
  public 'post_modified_gmt' => string '2023-04-21 04:26:46' (length=19)
  public 'post_content_filtered' => string '' (length=0)
  public 'post_parent' => int 0
  public 'guid' => string 'https://www.quantr.foundation/?p=2683' (length=37)
  public 'menu_order' => int 0
  public 'post_type' => string 'post' (length=4)
  public 'post_mime_type' => string '' (length=0)
  public 'comment_count' => string '0' (length=1)
  public 'filter' => string 'raw' (length=3)
STM32 project with Dim Sum Labs
We will have another hobby project with Dim Sum Labs. Our ultimate goal is to design our own STM32 board. Philip Paeps is one of the guy running Dim Sum Labs and he is a low-level guy, I and him have nearly the same interests. Philip is a FreeBSD committer contributing mainly to the kernel […]

We will have another hobby project with Dim Sum Labs. Our ultimate goal is to design our own STM32 board. Philip Paeps is one of the guy running Dim Sum Labs and he is a low-level guy, I and him have nearly the same interests. Philip is a FreeBSD committer contributing mainly to the kernel and a member of the FreeBSD security team.

Our plan:

  1. We design and make our own STM32 board
  2. We use this to put the STM32 chip into the breadboard and make it work first
  3. We use kicad as the tool, there are some tutorials we just follow
  4. For Jtag, we should support ST-Link
  5. I got STM32 board and they provide the schema, maybe we just follow first. But we have to understand the meaning of every piece and every number in it.
  6. We produce our PCB board in here. It got PCB assembly service, lets get familiar with it.
  7. If we are not dead, our next stop would be design our own FPGA board just like the icesugar-pro and make sure the open source toolchain can run on it.
			
/home/quantr.foundation/www/wp-content/plugins/quantr-foundation-wordpress-widgets/blog_shortcode_html.php:8:
object(WP_Post)[2671]
  public 'ID' => int 2659
  public 'post_author' => string '1' (length=1)
  public 'post_date' => string '2023-03-29 16:13:11' (length=19)
  public 'post_date_gmt' => string '2023-03-29 08:13:11' (length=19)
  public 'post_content' => string '<!-- wp:paragraph -->
<p>"Qemu Log Panel" is the tailor-made software to</p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><!-- wp:list-item -->
<li>Convert qemu.log into H2 database</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>Provide a GUI to diff the H2 database from xv6-riscv to the H2 database generated by our simulator</li>
<!-- /wp:list-item --></ol>
<!-- /wp:list -->

<!-- wp:heading -->
<h2>Step to run it</h2>
<!-- /wp:heading -->

<!-- wp:heading {"level":3} -->
<h3>Recor'... (length=2747)
  public 'post_title' => string 'Qemu Log Panel tutorial' (length=23)
  public 'post_excerpt' => string '' (length=0)
  public 'post_status' => string 'publish' (length=7)
  public 'comment_status' => string 'open' (length=4)
  public 'ping_status' => string 'open' (length=4)
  public 'post_password' => string '' (length=0)
  public 'post_name' => string 'qemu-log-panel-tutorial' (length=23)
  public 'to_ping' => string '' (length=0)
  public 'pinged' => string '' (length=0)
  public 'post_modified' => string '2023-03-29 16:41:09' (length=19)
  public 'post_modified_gmt' => string '2023-03-29 08:41:09' (length=19)
  public 'post_content_filtered' => string '' (length=0)
  public 'post_parent' => int 0
  public 'guid' => string 'https://www.quantr.foundation/?p=2659' (length=37)
  public 'menu_order' => int 0
  public 'post_type' => string 'post' (length=4)
  public 'post_mime_type' => string '' (length=0)
  public 'comment_count' => string '0' (length=1)
  public 'filter' => string 'raw' (length=3)
Qemu Log Panel tutorial
“Qemu Log Panel” is the tailor-made software to Step to run it Record xf6-riscv Record our simulator Run the GUI

"Qemu Log Panel" is the tailor-made software to

  1. Convert qemu.log into H2 database
  2. Provide a GUI to diff the H2 database from xv6-riscv to the H2 database generated by our simulator

Step to run it

Record xf6-riscv

  1. Clone xv6
  2. Modify the Makefile
  3. Run "make qemu", then you got qemu.log
  4. Run "make h2", then it converts qemu.log into h2 database "database.mv.db"

Record our simulator

  1. Run our simulator in netbeans with "-h2" option
  2. Then you got "dump.mv.db"

Run the GUI

  1. run qemu-log-panel, point to those two H2 database files
			
/home/quantr.foundation/www/wp-content/plugins/quantr-foundation-wordpress-widgets/blog_shortcode_html.php:8:
object(WP_Post)[2672]
  public 'ID' => int 2655
  public 'post_author' => string '1' (length=1)
  public 'post_date' => string '2023-03-28 13:58:18' (length=19)
  public 'post_date_gmt' => string '2023-03-28 05:58:18' (length=19)
  public 'post_content' => string '<!-- wp:image {"align":"center","id":2656,"sizeSlug":"large","linkDestination":"media"} -->
<figure class="wp-block-image aligncenter size-large"><a href="https://www.quantr.foundation/wp-content/uploads/2023/03/OSDev-Code-Camp.png"><img src="https://www.quantr.foundation/wp-content/uploads/2023/03/OSDev-Code-Camp-724x1024.png" alt="" class="wp-image-2656"/></a></figure>
<!-- /wp:image -->' (length=392)
  public 'post_title' => string 'OSDev free course' (length=17)
  public 'post_excerpt' => string '' (length=0)
  public 'post_status' => string 'publish' (length=7)
  public 'comment_status' => string 'open' (length=4)
  public 'ping_status' => string 'open' (length=4)
  public 'post_password' => string '' (length=0)
  public 'post_name' => string 'osdev-free-course' (length=17)
  public 'to_ping' => string '' (length=0)
  public 'pinged' => string '' (length=0)
  public 'post_modified' => string '2023-03-28 13:59:30' (length=19)
  public 'post_modified_gmt' => string '2023-03-28 05:59:30' (length=19)
  public 'post_content_filtered' => string '' (length=0)
  public 'post_parent' => int 0
  public 'guid' => string 'https://www.quantr.foundation/?p=2655' (length=37)
  public 'menu_order' => int 0
  public 'post_type' => string 'post' (length=4)
  public 'post_mime_type' => string '' (length=0)
  public 'comment_count' => string '0' (length=1)
  public 'filter' => string 'raw' (length=3)
OSDev free course
			
/home/quantr.foundation/www/wp-content/plugins/quantr-foundation-wordpress-widgets/blog_shortcode_html.php:8:
object(WP_Post)[2673]
  public 'ID' => int 2607
  public 'post_author' => string '1' (length=1)
  public 'post_date' => string '2023-03-23 10:51:23' (length=19)
  public 'post_date_gmt' => string '2023-03-23 02:51:23' (length=19)
  public 'post_content' => string '<!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column {"verticalAlignment":"center","width":"33.33%"} -->
<div class="wp-block-column is-vertically-aligned-center" style="flex-basis:33.33%"><!-- wp:paragraph {"align":"center","style":{"typography":{"fontSize":"56px"}},"textColor":"vivid-green-cyan"} -->
<p class="has-text-align-center has-vivid-green-cyan-color has-text-color" style="font-size:56px"><strong>Lets Code Together</strong></p>
<!-- /wp:paragraph --></div>
<!-- /wp:column -->

<!-- wp:'... (length=3493)
  public 'post_title' => string 'We support gifted talent' (length=24)
  public 'post_excerpt' => string '' (length=0)
  public 'post_status' => string 'publish' (length=7)
  public 'comment_status' => string 'open' (length=4)
  public 'ping_status' => string 'open' (length=4)
  public 'post_password' => string '' (length=0)
  public 'post_name' => string 'we-support-gifted-talent' (length=24)
  public 'to_ping' => string '' (length=0)
  public 'pinged' => string '' (length=0)
  public 'post_modified' => string '2023-03-24 15:21:31' (length=19)
  public 'post_modified_gmt' => string '2023-03-24 07:21:31' (length=19)
  public 'post_content_filtered' => string '' (length=0)
  public 'post_parent' => int 0
  public 'guid' => string 'https://www.quantr.foundation/?p=2607' (length=37)
  public 'menu_order' => int 0
  public 'post_type' => string 'post' (length=4)
  public 'post_mime_type' => string '' (length=0)
  public 'comment_count' => string '0' (length=1)
  public 'filter' => string 'raw' (length=3)
We support gifted talent
Lets Code Together We support gifted talent, including technical training, and join our open-source projects to grant coding experience. Teen has talent in coding, they code well on logic. But the modern coding world is complex, lots of frameworks, libraries, hidden rules, and styles. They need experienced people to provide them with hand-to-hand training, and […]

Lets Code Together

We support gifted talent, including technical training, and join our open-source projects to grant coding experience. Teen has talent in coding, they code well on logic. But the modern coding world is complex, lots of frameworks, libraries, hidden rules, and styles. They need experienced people to provide them with hand-to-hand training, and level up their skills. This will shorten the time to conquer these skill sets, rather than spending decades for self-learning. We have three streams

CPU stream - Join our CPU team to develop a microprocessor. Our goal is to fabricate a CPU with all basic features such as cache, branch prediction, jtag & trace capability, I/O, interrupt controller, and others. Students will learn a new programming paradigm: HDL, understand how your code converts to logic, and how all fundamental stuff work. CPU is the heart of the computer and the ground of logic execution. If you are interest into how the computer executes your code, join this.

Operating system stream - To create an OS for x86 and RISC-V, support all modern OS features such as multitasking, libc/libc++, driver model, locking, and others... OS works like the human brain, controlling all peripheral devices just like our brain controls our hands and legs. OS is the big brother of all software, it decide what to run and how all other programs behave.

Web team - We are not just doing website programming, we are building fundamental blocks to support websites. Many projects, such as web server, database, high-availability layer, logging engine, CMS, and others. We put effort into understanding how every piece works by building our own.

If you have spare time, join us

			
/home/quantr.foundation/www/wp-content/plugins/quantr-foundation-wordpress-widgets/blog_shortcode_html.php:8:
object(WP_Post)[2674]
  public 'ID' => int 2548
  public 'post_author' => string '1' (length=1)
  public 'post_date' => string '2023-03-11 21:56:10' (length=19)
  public 'post_date_gmt' => string '2023-03-11 13:56:10' (length=19)
  public 'post_content' => string '<!-- wp:paragraph -->
<p>We are researching the http protocol and building our own http server. This guide build nginx and test it out.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2>Build php</h2>
<!-- /wp:heading -->

<!-- wp:code -->
<pre class="wp-block-code"><code>wget https://www.php.net/distributions/php-8.2.3.tar.xz
tar xvf php-8.2.3.tar.xz
cd php-8.2.3
Mac: ./configure --enable-fpm --prefix=/Users/peter/Downloads/my-php --with-iconv=$(brew --prefix libiconv) --with-mysqli
Linux: ./configure --'... (length=5464)
  public 'post_title' => string 'Build ngnix with php-fpm' (length=24)
  public 'post_excerpt' => string '' (length=0)
  public 'post_status' => string 'publish' (length=7)
  public 'comment_status' => string 'open' (length=4)
  public 'ping_status' => string 'open' (length=4)
  public 'post_password' => string '' (length=0)
  public 'post_name' => string 'build-ngnix-with-php-fpm' (length=24)
  public 'to_ping' => string '' (length=0)
  public 'pinged' => string '' (length=0)
  public 'post_modified' => string '2023-03-21 14:34:02' (length=19)
  public 'post_modified_gmt' => string '2023-03-21 06:34:02' (length=19)
  public 'post_content_filtered' => string '' (length=0)
  public 'post_parent' => int 0
  public 'guid' => string 'https://www.quantr.foundation/?p=2548' (length=37)
  public 'menu_order' => int 0
  public 'post_type' => string 'post' (length=4)
  public 'post_mime_type' => string '' (length=0)
  public 'comment_count' => string '0' (length=1)
  public 'filter' => string 'raw' (length=3)
Build ngnix with php-fpm
We are researching the http protocol and building our own http server. This guide build nginx and test it out. Build php Build nginx Make nginx works with php configure nginx 2. sudo ../sbin/nginx Browse to http://localhost Wireshark Install wireshark, remember install ChmodBPF. Open loopback, then you see how nginx talk to php-fpm by port […]

We are researching the http protocol and building our own http server. This guide build nginx and test it out.

Build php

wget https://www.php.net/distributions/php-8.2.3.tar.xz
tar xvf php-8.2.3.tar.xz
cd php-8.2.3
Mac: ./configure --enable-fpm --prefix=/Users/peter/Downloads/my-php --with-iconv=$(brew --prefix libiconv) --with-mysqli
Linux: ./configure --enable-fpm --prefix=$HOME/Downloads/my-php --with-mysqli

If you in WSL, comment out "#define HAVE_LQ_TCP_INFO 1" from "main/php_config.h"

make -j
make install
cd ..

Build nginx

wget https://nginx.org/download/nginx-1.23.2.tar.gz
tar zxvf nginx-1.23.2.tar.gz
cd nginx-1.23.2
./configure --prefix=$HOME/Downloads/my-nginx
make -j
make install

Make nginx works with php

cd $HOME/Downloads/my-php/etc
cp php-fpm.conf.default php-fpm.conf
cd $HOME/Downloads/my-php/etc/php-fpm.d
cp www.conf.default www.conf
edit www.conf , change to "listen = 127.0.0.1:9876"
make sure "user = peter" and "group = peter". Remark : "group = peter" is for linux only
create index.php in $HOME/Downloads/my-nginx/html
cd $HOME/Downloads/my-php/sbin
sudo ./php-fpm

configure nginx

cd $HOME/Downloads/my-nginx/conf
edit nginx.conf

2. sudo ../sbin/nginx

To stop php-fpm and nginx:
sudo killall -9 nginx
sudo killall -9 php-fpm

Browse to http://localhost

Wireshark

Install wireshark, remember install ChmodBPF. Open loopback, then you see how nginx talk to php-fpm by port 9876

To enable FCGI, make sure FCGI is enabled by menu "analyze" -> "Enabled Protocols":

Set the port to 9876, go to "Preference" - > "Protocols" -> "FCGI", set the port to 9876:

Then filter the protocol by "fcgi", you can see the captured packet matched with our code

			
/home/quantr.foundation/www/wp-content/plugins/quantr-foundation-wordpress-widgets/blog_shortcode_html.php:8:
object(WP_Post)[2675]
  public 'ID' => int 2514
  public 'post_author' => string '1' (length=1)
  public 'post_date' => string '2023-02-21 10:26:03' (length=19)
  public 'post_date_gmt' => string '2023-02-21 02:26:03' (length=19)
  public 'post_content' => string '<!-- wp:paragraph -->
<p>We failed to apply ESS from ITF for 1.6M HKD funding. We face the truth, hong kong is not the place to develop foundation open-source software &amp; hardware. We close the team in hk today and move to another country.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":2518,"sizeSlug":"large","linkDestination":"media"} -->
<figure class="wp-block-image aligncenter size-large"><a href="https://www.quantr.foundation/wp-content/uploads/2023/02/香港人嘅CPU計劃宣布�'... (length=1504)
  public 'post_title' => string 'We failed to apply ESS from ITF' (length=31)
  public 'post_excerpt' => string '' (length=0)
  public 'post_status' => string 'publish' (length=7)
  public 'comment_status' => string 'open' (length=4)
  public 'ping_status' => string 'open' (length=4)
  public 'post_password' => string '' (length=0)
  public 'post_name' => string 'we-failed-to-apply-ess-from-itf' (length=31)
  public 'to_ping' => string '' (length=0)
  public 'pinged' => string '' (length=0)
  public 'post_modified' => string '2023-02-22 11:47:23' (length=19)
  public 'post_modified_gmt' => string '2023-02-22 03:47:23' (length=19)
  public 'post_content_filtered' => string '' (length=0)
  public 'post_parent' => int 0
  public 'guid' => string 'https://www.quantr.foundation/?p=2514' (length=37)
  public 'menu_order' => int 0
  public 'post_type' => string 'post' (length=4)
  public 'post_mime_type' => string '' (length=0)
  public 'comment_count' => string '0' (length=1)
  public 'filter' => string 'raw' (length=3)
We failed to apply ESS from ITF
We failed to apply ESS from ITF for 1.6M HKD funding. We face the truth, hong kong is not the place to develop foundation open-source software & hardware. We close the team in hk today and move to another country.

We failed to apply ESS from ITF for 1.6M HKD funding. We face the truth, hong kong is not the place to develop foundation open-source software & hardware. We close the team in hk today and move to another country.

			
/home/quantr.foundation/www/wp-content/plugins/quantr-foundation-wordpress-widgets/blog_shortcode_html.php:8:
object(WP_Post)[2676]
  public 'ID' => int 2472
  public 'post_author' => string '1' (length=1)
  public 'post_date' => string '2023-02-01 13:22:22' (length=19)
  public 'post_date_gmt' => string '2023-02-01 05:22:22' (length=19)
  public 'post_content' => string '<!-- wp:image {"align":"center","id":2485,"width":59,"height":57,"sizeSlug":"large","linkDestination":"none"} -->
<figure class="wp-block-image aligncenter size-large is-resized"><img src="https://www.quantr.foundation/wp-content/uploads/2023/02/[email protected]" alt="" class="wp-image-2485" width="59" height="57"/></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>Our rough development plan for the logic synthesizer. Erica will be the programmer. The study plan is solid but the dev pla'... (length=3284)
  public 'post_title' => string '[Dev Plan] Logic Synthesizer' (length=28)
  public 'post_excerpt' => string '' (length=0)
  public 'post_status' => string 'publish' (length=7)
  public 'comment_status' => string 'open' (length=4)
  public 'ping_status' => string 'open' (length=4)
  public 'post_password' => string '' (length=0)
  public 'post_name' => string 'dev-plan-logic-synthesizer' (length=26)
  public 'to_ping' => string '' (length=0)
  public 'pinged' => string '' (length=0)
  public 'post_modified' => string '2023-02-03 11:16:31' (length=19)
  public 'post_modified_gmt' => string '2023-02-03 03:16:31' (length=19)
  public 'post_content_filtered' => string '' (length=0)
  public 'post_parent' => int 0
  public 'guid' => string 'https://www.quantr.foundation/?p=2472' (length=37)
  public 'menu_order' => int 0
  public 'post_type' => string 'post' (length=4)
  public 'post_mime_type' => string '' (length=0)
  public 'comment_count' => string '0' (length=1)
  public 'filter' => string 'raw' (length=3)
[Dev Plan] Logic Synthesizer
Our rough development plan for the logic synthesizer. Erica will be the programmer. The study plan is solid but the dev plan is draft Goal Study these Software stack Stage

Our rough development plan for the logic synthesizer. Erica will be the programmer. The study plan is solid but the dev plan is draft

Goal

  1. Building the logic synthesizer is the final goal
  2. Our ultimate goal is to output bitstream directly for ecp5 / gowin, then we know the complete process of logic synthesis

Study these

  1. Logic synthesis book https://peter.quantr.hk/2023/01/good-book-on-logic-synthesis
  2. HDL synthesis book https://peter.quantr.hk/2023/02/good-hdl-synthesis-book
  3. IEEE Verilog specification 1364 https://www.eg.bucknell.edu/~csci320/2016-fall/wp-content/uploads/2015/08/verilog-std-1364-2005.pdf
  4. IEEE Standard for Verilog Register Transfer Level Synthesis https://standards.ieee.org/ieee/1364.1/2053/

Software stack

  1. Antlr as the parser and lexer
  2. Verilog grammar using https://github.com/antlr/grammars-v4/tree/master/verilog
  3. Java + Netbeans IDE
  4. Maven as build system

Stage

  1. Test the Verilog Antlr grammar is strong enough to parse big Verilog file (done)
  2. Define the IR data structure to store converted logic gate information
  3. Create parse to read HDL and convert into IR data structure
			
/home/quantr.foundation/www/wp-content/plugins/quantr-foundation-wordpress-widgets/blog_shortcode_html.php:8:
object(WP_Post)[2677]
  public 'ID' => int 2462
  public 'post_author' => string '1' (length=1)
  public 'post_date' => string '2023-01-29 12:13:33' (length=19)
  public 'post_date_gmt' => string '2023-01-29 04:13:33' (length=19)
  public 'post_content' => string '<!-- wp:paragraph -->
<p><a rel="noreferrer noopener" href="http://www.cityu.edu.hk/cepie/ip_sale/CityU_Apps_Lab.htm" target="_blank">CityU Apps Lab</a> - This project aims at creating a University-wide Open Collaborative Learning Laboratory (CityU Apps Lab) for enabling our CityU students to develop their own mobile software. The Apps Lab is a centralized hub that can provide fruitful resource support including essential hardware / software development tools for all the University members to develop innova'... (length=2671)
  public 'post_title' => string 'Cityu Mentorship - Teach teens coding' (length=37)
  public 'post_excerpt' => string '' (length=0)
  public 'post_status' => string 'publish' (length=7)
  public 'comment_status' => string 'open' (length=4)
  public 'ping_status' => string 'open' (length=4)
  public 'post_password' => string '' (length=0)
  public 'post_name' => string 'cityu-mentorship-teach-teens-coding' (length=35)
  public 'to_ping' => string '' (length=0)
  public 'pinged' => string '' (length=0)
  public 'post_modified' => string '2023-02-18 18:41:24' (length=19)
  public 'post_modified_gmt' => string '2023-02-18 10:41:24' (length=19)
  public 'post_content_filtered' => string '' (length=0)
  public 'post_parent' => int 0
  public 'guid' => string 'https://www.quantr.foundation/?p=2462' (length=37)
  public 'menu_order' => int 0
  public 'post_type' => string 'post' (length=4)
  public 'post_mime_type' => string '' (length=0)
  public 'comment_count' => string '0' (length=1)
  public 'filter' => string 'raw' (length=3)
Cityu Mentorship - Teach teens coding
CityU Apps Lab – This project aims at creating a University-wide Open Collaborative Learning Laboratory (CityU Apps Lab) for enabling our CityU students to develop their own mobile software. The Apps Lab is a centralized hub that can provide fruitful resource support including essential hardware / software development tools for all the University members to […]

CityU Apps Lab - This project aims at creating a University-wide Open Collaborative Learning Laboratory (CityU Apps Lab) for enabling our CityU students to develop their own mobile software. The Apps Lab is a centralized hub that can provide fruitful resource support including essential hardware / software development tools for all the University members to develop innovative applications. The Apps Lab would consist of two groups of members:

1) Software developers, and

2) Idea providers. For instance, a group of students from the School of Creative Media (SCM) may raise an interesting idea about developing a mobile app for field-trip data collection; another group of student developers may use the Apps Lab to interact with the SCM students.

			
/home/quantr.foundation/www/wp-content/plugins/quantr-foundation-wordpress-widgets/blog_shortcode_html.php:8:
object(WP_Post)[2678]
  public 'ID' => int 2431
  public 'post_author' => string '1' (length=1)
  public 'post_date' => string '2022-12-29 16:10:06' (length=19)
  public 'post_date_gmt' => string '2022-12-29 08:10:06' (length=19)
  public 'post_content' => string '<!-- wp:paragraph -->
<p>The board can be bought in <a rel="noreferrer noopener" href="https://item.taobao.com/item.htm?spm=a312a.7700824.w4002-21349689069.54.47a7577d6mQiyb&amp;id=639661395487" target="_blank">taobao</a>. </p>
<!-- /wp:paragraph -->

<!-- wp:image {"id":2443,"width":209,"height":208,"sizeSlug":"full","linkDestination":"media"} -->
<figure class="wp-block-image size-full is-resized"><a href="https://www.quantr.foundation/wp-content/uploads/2023/01/isugarpro.png"><img src="https://www.quantr'... (length=9488)
  public 'post_title' => string 'Porting LiteX Vex-RISCV to icesugar pro' (length=39)
  public 'post_excerpt' => string '' (length=0)
  public 'post_status' => string 'publish' (length=7)
  public 'comment_status' => string 'open' (length=4)
  public 'ping_status' => string 'open' (length=4)
  public 'post_password' => string '' (length=0)
  public 'post_name' => string 'porting-litex-vex-riscv-to-icesugar-pro' (length=39)
  public 'to_ping' => string '' (length=0)
  public 'pinged' => string '' (length=0)
  public 'post_modified' => string '2023-03-08 19:48:55' (length=19)
  public 'post_modified_gmt' => string '2023-03-08 11:48:55' (length=19)
  public 'post_content_filtered' => string '' (length=0)
  public 'post_parent' => int 0
  public 'guid' => string 'https://www.quantr.foundation/?p=2431' (length=37)
  public 'menu_order' => int 0
  public 'post_type' => string 'post' (length=4)
  public 'post_mime_type' => string '' (length=0)
  public 'comment_count' => string '0' (length=1)
  public 'filter' => string 'raw' (length=3)
Porting LiteX Vex-RISCV to icesugar pro
The board can be bought in taobao. Install sbt tool Install picocom Install YOSYS Build yosys by source, don’t install yosys using apt-get Install RISC-V toolchain Install Verilator Install Linux-on-LiteX-vexriscv Install LiteX Testing the LiteX You need to extract linux_???.zip from #164 into the images folder first, then : Build the bitstream file https://github.com/litex-hub/linux-on-litex-vexriscv/blob/master/make.py View the Linux […]

The board can be bought in taobao.

Install sbt tool

$ echo "deb https://repo.scala-sbt.org/scalasbt/debian all main" | sudo tee /etc/apt/sources.list.d/sbt.list
$ echo "deb https://repo.scala-sbt.org/scalasbt/debian /" | sudo tee /etc/apt/sources.list.d/sbt_old.list
$ curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | sudo apt-key add
$ sudo apt-get update
$ sudo apt-get install sbt

Install picocom

sudo apt-get install picocom

Install YOSYS

Build yosys by source, don't install yosys using apt-get

Install RISC-V toolchain

Below steps from official manual are wrong, you have to build risc-v toolchain yourself by this

$ wget https://static.dev.sifive.com/dev-tools/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-ubuntu14.tar.gz
$ tar -xvf riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-ubuntu14.tar.gz
$ export PATH=$PWD/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-ubuntu14/bin/:$PATH

Install Verilator

$ sudo apt install verilator
$ sudo apt install libevent-dev libjson-c-dev

Install Linux-on-LiteX-vexriscv

$ sudo apt install build-essential device-tree-compiler wget git python3-setuptools
$ git clone https://github.com/litex-hub/linux-on-litex-vexriscv
$ cd linux-on-litex-vexriscv

Install LiteX

$ wget https://raw.githubusercontent.com/enjoy-digital/litex/master/litex_setup.py
$ chmod +x litex_setup.py
$ ./litex_setup.py --init --install --user

Testing the LiteX

You need to extract linux_???.zip from #164 into the images folder first, then :

$ ./sim.py

Build the bitstream file

$ ./make.py --board=icesugar_pro --build

https://github.com/litex-hub/linux-on-litex-vexriscv/blob/master/make.py

View the Linux on LiteX

$ sudo picocom -b 115200 /dev/ttyACM0

Run LiteX on fpga board

Port the .bit file into the board
.bit file path: linux-on-litex-vexriscv/build/NameOfBoard/gateware/
Port the BOARD.bit file into the board

Now you can see:

port is : /dev/ttyACM0
flowcontrol : none
baudrate is : 115200
parity is : none
databits are : 8
stopbits are : 1
escape is : C-a
local echo is : no
noinit is : no
noreset is : no
hangup is : no
nolock is : no
send_cmd is : sz -vv
receive_cmd is : rz -vv -E
imap is :
omap is :
emap is : crcrlf,delbs,
logfile is : none
initstring : none
exit_after is : not set
exit is : no

Type [C-a] [C-h] to see available commands
Terminal ready

    __   _ __      _  __
   / /  (_) /____ | |/_/
  / /__/ / __/ -_)>  <
 /____/_/\__/\__/_/|_|

Build your hardware, easily!

(c) Copyright 2012-2022 Enjoy-Digital
(c) Copyright 2007-2015 M-Labs

BIOS CRC passed (f39409fb)

LiteX git sha1: e8322587

--=============== SoC ==================--
CPU: VexRiscv SMP-LINUX @ 50MHz
BUS: WISHBONE 32-bit @ 4GiB
CSR: 32-bit data
ROM: 64KiB
SRAM: 6KiB
L2: 2KiB
FLASH: 32768KiB
SDRAM: 32768KiB 16-bit @ 50MT/s (CL-2 CWL-2)

--========== Initialization ============--
Initializing SDRAM @0x40000000…
Switching SDRAM to software control.
Switching SDRAM to hardware control.
Memtest at 0x40000000 (2.0MiB)…
Write: 0x40000000-0x40200000 2.0MiB
Read: 0x40000000-0x40200000 2.0MiB
Memtest OK
Memspeed at 0x40000000 (Sequential, 2.0MiB)…
Write speed: 15.6MiB/s
Read speed: 20.1MiB/s

Initializing W25Q256 SPI Flash @0x02000000…
Enabling Quad mode…
SPI Flash clk configured to 25 MHz
Memspeed at 0x2000000 (Sequential, 4.0KiB)…
Read speed: 2.6MiB/s
Memspeed at 0x2000000 (Random, 4.0KiB)…
Read speed: 1.3MiB/s

--============== Boot ==================--
Booting from serial…
Press Q or ESC to abort boot completely.
sL5DdSMmkekro
Timeout
Booting from SDCard in SD-Mode…
Booting from boot.json…
Booting from boot.bin…
SDCard boot failed.
No boot medium found

--============= Console ================--

litex>

			
/home/quantr.foundation/www/wp-content/plugins/quantr-foundation-wordpress-widgets/blog_shortcode_html.php:8:
object(WP_Post)[2679]
  public 'ID' => int 2399
  public 'post_author' => string '1' (length=1)
  public 'post_date' => string '2022-12-26 16:36:14' (length=19)
  public 'post_date_gmt' => string '2022-12-26 08:36:14' (length=19)
  public 'post_content' => string '<!-- wp:paragraph -->
<p>java -jar qemu-log-panel-1.0-jar-with-dependencies.jar -f qemu.log -t</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>scp [email protected]:/home/quantr.foundation/www/qemu.log.gz .</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><a href="https://www.quantr.foundation/wp-content/uploads/2023/01/qemu-log-panel-1.0-jar-with-dependencies.jar" target="_blank" rel="noreferrer noopener">https://www.quantr.foundation/wp-content/uploads/2023/01/qemu-log-panel-1.0-jar-with-dependencie'... (length=1243)
  public 'post_title' => string 'Test qemu-log-panel speed' (length=25)
  public 'post_excerpt' => string '' (length=0)
  public 'post_status' => string 'publish' (length=7)
  public 'comment_status' => string 'open' (length=4)
  public 'ping_status' => string 'open' (length=4)
  public 'post_password' => string '' (length=0)
  public 'post_name' => string 'test-qemu-log-panel-speed' (length=25)
  public 'to_ping' => string '' (length=0)
  public 'pinged' => string '' (length=0)
  public 'post_modified' => string '2023-02-19 15:50:04' (length=19)
  public 'post_modified_gmt' => string '2023-02-19 07:50:04' (length=19)
  public 'post_content_filtered' => string '' (length=0)
  public 'post_parent' => int 0
  public 'guid' => string 'https://www.quantr.foundation/?p=2399' (length=37)
  public 'menu_order' => int 0
  public 'post_type' => string 'post' (length=4)
  public 'post_mime_type' => string '' (length=0)
  public 'comment_count' => string '0' (length=1)
  public 'filter' => string 'raw' (length=3)
Test qemu-log-panel speed
java -jar qemu-log-panel-1.0-jar-with-dependencies.jar -f qemu.log -t scp [email protected]:/home/quantr.foundation/www/qemu.log.gz . https://www.quantr.foundation/wp-content/uploads/2023/01/qemu-log-panel-1.0-jar-with-dependencies.jar https://www.quantr.foundation/wp-content/uploads/2023/01/kernel.zip gunzip qemu.log.gz mkdir -p ../xv6-riscv/kernel mv kernel ../xv6-riscv/kernel/ ./jdk-19.0.2.jdk/Contents/Home/bin/java -jar qemu-log-panel-1.0-jar-with-dependencies.jar -f qemu.log -t

java -jar qemu-log-panel-1.0-jar-with-dependencies.jar -f qemu.log -t

scp [email protected]:/home/quantr.foundation/www/qemu.log.gz .

https://www.quantr.foundation/wp-content/uploads/2023/01/qemu-log-panel-1.0-jar-with-dependencies.jar

https://www.quantr.foundation/wp-content/uploads/2023/01/kernel.zip

gunzip qemu.log.gz

mkdir -p ../xv6-riscv/kernel

mv kernel ../xv6-riscv/kernel/

./jdk-19.0.2.jdk/Contents/Home/bin/java -jar qemu-log-panel-1.0-jar-with-dependencies.jar -f qemu.log -t

			
/home/quantr.foundation/www/wp-content/plugins/quantr-foundation-wordpress-widgets/blog_shortcode_html.php:8:
object(WP_Post)[2680]
  public 'ID' => int 2368
  public 'post_author' => string '1' (length=1)
  public 'post_date' => string '2022-12-23 02:58:44' (length=19)
  public 'post_date_gmt' => string '2022-12-22 18:58:44' (length=19)
  public 'post_content' => string '<!-- wp:separator -->
<hr class="wp-block-separator has-alpha-channel-opacity"/>
<!-- /wp:separator -->

<!-- wp:paragraph -->
<p>Porting <a href="https://github.com/stnolting/neorv32" target="_blank" rel="noreferrer noopener">NEORV32</a> to <a rel="noreferrer noopener" href="https://item.taobao.com/item.htm?spm=a1z09.2.0.0.3df52e8dOvOLiF&amp;id=614093598737&amp;_u=nbuhab0acf1" data-type="URL" data-id="https://item.taobao.com/item.htm?spm=a1z09.2.0.0.3df52e8dOvOLiF&amp;id=614093598737&amp;_u=nbuhab0acf1" ta'... (length=14753)
  public 'post_title' => string 'Flashing program to NEORV32 Processor' (length=37)
  public 'post_excerpt' => string '' (length=0)
  public 'post_status' => string 'publish' (length=7)
  public 'comment_status' => string 'open' (length=4)
  public 'ping_status' => string 'open' (length=4)
  public 'post_password' => string '' (length=0)
  public 'post_name' => string 'flashing-program-to-neorv32-processor' (length=37)
  public 'to_ping' => string '' (length=0)
  public 'pinged' => string '' (length=0)
  public 'post_modified' => string '2022-12-28 18:21:38' (length=19)
  public 'post_modified_gmt' => string '2022-12-28 10:21:38' (length=19)
  public 'post_content_filtered' => string '' (length=0)
  public 'post_parent' => int 0
  public 'guid' => string 'https://www.quantr.foundation/?p=2368' (length=37)
  public 'menu_order' => int 0
  public 'post_type' => string 'post' (length=4)
  public 'post_mime_type' => string '' (length=0)
  public 'comment_count' => string '0' (length=1)
  public 'filter' => string 'raw' (length=3)
Flashing program to NEORV32 Processor
Porting NEORV32 to iCE40UP5k Software Toolchain Setup In this tutorial, Ubuntu Linux will be used. To compile and debug executables for the NEORV32, we have to follow the procedures to build the following tools: riscv-gnu-toolchain is a RISC-V C and C++ cross-compiler that fits the architecture of NEORV32 core. arachne-pnr is a tool that implements […]

Porting NEORV32 to iCE40UP5k

Software Toolchain Setup

In this tutorial, Ubuntu Linux will be used. To compile and debug executables for the NEORV32, we have to follow the procedures to build the following tools:

riscv-gnu-toolchain is a RISC-V C and C++ cross-compiler that fits the architecture of NEORV32 core.

$ git clone https://github.com/riscv-collab/riscv-gnu-toolchain.git
$ cd riscv-gnu-toolchain
$ sudo apt-get install autoconf automake autotools-dev curl python3 libmpc-dev libmpfr-dev libgmp-dev gawk build-essential bison flex texinfo gperf libtool patchutils bc zlib1g-dev libexpat-dev ninja-build
$ ./configure --prefix=/opt/riscv
$ sudo make -j4 # this include install
$ echo "export /opt/riscv/bin:$PATH" > ~/.bashrc
$ source ~/.bashrc

arachne-pnr is a tool that implements the place and route step of the hardware compilation process for FPGAs.

$ sudo apt-get install build-essential clang bison flex libreadline-dev gawk tcl-dev libffi-dev git graphviz xdot pkg-config python3 libboost-system-dev libboost-python-dev libboost-filesystem-dev zlib1g-dev libqt5gui5-gles qtbase5-gles-dev libftdi*
$ git clone https://github.com/cseed/arachne-pnr.git
$ cd arachne-pnr
$ make -j
$ sudo make install

nextpnr is a vendor neutral, timing driven, FOSS FPGA place and route tool.

$ git clone https://github.com/YosysHQ/nextpnr nextpnr
$ cd nextpnr
$ sudo apt install libboost-all-dev libeigen3-dev
$ cmake -DARCH=ice40 -DCMAKE_INSTALL_PREFIX=/usr/local .
$ make -j
$ sudo make install

yosys is a framework for RTL synthesis tools.

$ git clone https://github.com/YosysHQ/yosys.git
$ cd yosys
$ make config-gcc
$ sudo make install -j

ghdl is an open-source analyzer, compiler, simulator and (experimental) synthesizer for VHDL, a Hardware Description Language (HDL).

$ git clone https://github.com/ghdl/ghdl.git
$ cd ghdl
$ sudo apt install gnat
$ ./configure
$ make -j
$ sudo make install -j

ghdl-yosys-plugin is a VHDL synthesis based on GHDL and Yosys.

$ git clone https://github.com/ghdl/ghdl-yosys-plugin.git
$ cd ghdl-yosys-plugin
$ make
$ sudo make install -j

neorv32-setup is a repository that provides community projects as well as exemplary setups for different FPGAs, platforms, boards and toolchains for the NEORV32 RISC-V Processor. Project maintainers may make pull requests against this repository to add or link their setups and projects.

$ git clone --recursive https://github.com/stnolting/neorv32-setups

gtkterm is a simple, graphical serial port terminal emulator for Linux and possibly other POSIX-compliant operating systems. Alternatives such as cutecom can be used.

$ git clone https://github.com/Jeija/gtkterm.git
$ cd gtkterm
$ sudo apt install meson libgtk-3-dev libvte-2.91-dev libgudev-1.0-dev
$ meson build
$ ninja -C build
$ sudo ninja -C build install

isugar tools

$ git clone https://github.com/wuxx/icesugar.git
$ sudo apt-get install libhidapi-dev libusb-1.0-0-dev
$ echo "export {full path to icesugar}/tools:$PATH" > ~/.bashrc
$ source ~/.bashrc

icestorm documents the bitstream format of Lattice iCE40 FPGAs and providing simple tools for analyzing and creating bitstream files.

$ git clone https://github.com/YosysHQ/icestorm.git icestorm
$ cd icestorm
$ make -j
$ sudo make install

Hardware Connection

In this tutorial, iCESugar-v1.5 fpga board will be used.

1. Connect the primary UART (UART0) interface of your FPGA board to a serial port of your host computer.

If you are using wsl/wsl2, follow the procedures below:

# Run Bash:
$ sudo apt install linux-tools-5.4.0-77-generic hwdata
$ sudo update-alternatives --install /usr/local/bin/usbip usbip /usr/lib/linux-tools/5.4.0-77-generic/usbip 20

# Run Powershell in administrator mode:
$ usbipd wsl list
# Select the bus ID of the device you’d like to attach to WSL and run:
$ usbipd wsl attach --busid <busid>

# Run Bash to check if the target device is attached or not:
$ lsusb

2. Open a connection to the the serial port your UART is connected to. Configure the terminal setting according to the following parameters:

$ sudo gtkterm
  • 19200 Baud
  • 8 data bits
  • 8 data bits
  • no parity bits
  • no transmission/flow control protocol
  • receiver (host computer) newline on \r\n (carriage return & newline)

Generate Target Bootloader Bitstream

$ cd {path to neorv32-setups}/osflow
$ sed -i 's/-p \\/-m ghdl -p \\/g' synthesis.mk

# make target bitstrem, since iCESugar-v1.5 fpga board is used:
$ make BOARD=iCESugar-v1.5 MinimalBoot

# Details of generating other types of bootloader bitstream are mentioned in {path to neorv32-setup}/osflow/README.md

# the following 3 files are generated: neorv32_iCESugar-v1.5_Minimal.asc, neorv32_iCESugar-v1.5_Minimal.bit, neorv32_iCESugar-v1.5_Minimal.json

Flash an Executable into FPGA Board using Bootloader

$ icesprog neorv32_iCESugar-v1.5_Minimal.bit

The bootloader program is now flashed into the fpga, now press the NEORV32 reset button to restart the bootloader, and the following lines will be shown:

<< NEORV32 Bootloader >>

BLDV: Feb 16 2022
HWV:  0x01060709
CLK:  0x05f5e100
ISA:  0x40901107 + 0xc000068b
SOC:  0x7b7f402f
IMEM: 0x00008000 bytes @0x00000000
DMEM: 0x00004000 bytes @0x80000000

Autoboot in 8s. Press any key to abort.
Aborted.

Available commands:
 h: Help
 r: Restart
 u: Upload
 s: Store to flash
 l: Load from flash
 e: Execute
CMD:>

Follow the procedures below:

1. Execute the "Upload" command by typing u. Now the bootloader is waiting for a binary executable to be send.

CMD:> u
Awaiting neorv32_exe.bin...

2. Use the "send file" option of your terminal program to send a NEORV32 executable (neorv32_exe.bin) to genterate neorv32_exe.bin, using the exmaple in neorv32-setup/sw/exmaple/demo_blink_led:

$ make clean_all install
Memory utilization:
   text    data     bss     dec     hex filename
   1004       0       0    1004     3ec main.elf
Compiling ../../../sw/image_gen/image_gen
Installing application image to ../../../rtl/core/neorv32_application_image.vhd

# now main.bin have been generated

3. If everything went fine, OK will appear in your terminal:

CMD:> u
Awaiting neorv32_exe.bin... OK

4. The executable is now in the instruction memory of the processor. To execute the program right now run the "Execute" command by typing e:

CMD:> u
Awaiting neorv32_exe.bin... OK
CMD:> e
Booting...

Flash an Execuatble into FPGA Board Directly

If you do not want to use the bootloader (or the on-chip debugger) for executable upload or if your setup does not provide a serial interface for that, you can also directly install an application into embedded memory.

$ sed -i 's/MEM_INT_IMEM_EN => false/MEM_INT_IMEM_EN => true/g' {path to neorv32-setup}/neorv32/rtl/core/neorv32_top.vhd
$ sed -i 's/INT_BOOTLOADER_EN => true/INT_BOOTLOADER_EN => false/g' {path to neorv32-setup}/neorv32/rtl/core/neorv32_top.vhd

To generate an "initialization image" for the IMEM that contains the actual application, run the install target when compiling your application, using the exmaple in neorv32-setup/sw/exmaple/demo_blink_led:

$ make clean_all install
Memory utilization:
   text    data     bss     dec     hex filename
   3176       0     120    3296     ce0 main.elf
Compiling ../../../sw/image_gen/image_gen
Installing application image to ../../../rtl/core/neorv32_application_image.vhd

The install target has compiled all the application sources but instead of creating an executable (neorv32_exe.bit) that can be uploaded via the bootloader, it has created a VHDL memory initialization image core/neorv32_application_image.vhd.

This VHDL file is automatically copied to the core’s rtl folder (rtl/core) so it will be included for the next synthesis.

Then:

  1. Perform a new synthesis. The IMEM will be build as pre-initialized ROM (inferring embedded memories if possible).
  2. Upload your bitstream. Your application code now resides unchangeable in the processor’s IMEM and is directly executed after reset.

The synthesis tool / simulator will print asserts to inform about the (IMEM) memory / boot configuration:

NEORV32 PROCESSOR CONFIG NOTE: Boot configuration: Direct boot from memory (processor-internal IMEM).
NEORV32 PROCESSOR CONFIG NOTE: Implementing processor-internal IMEM as ROM (3176 bytes), pre-initialized with application.
			
/home/quantr.foundation/www/wp-content/plugins/quantr-foundation-wordpress-widgets/blog_shortcode_html.php:8:
object(WP_Post)[2681]
  public 'ID' => int 2343
  public 'post_author' => string '1' (length=1)
  public 'post_date' => string '2022-11-06 10:25:23' (length=19)
  public 'post_date_gmt' => string '2022-11-06 02:25:23' (length=19)
  public 'post_content' => string '<!-- wp:paragraph -->
<p>Teenagers are the pillars of the future society. For the society to have strong development, especially in terms of science and technology, nurturing them is indispensable. Seeing this, the Hong Kong Millennium Lions Club launched a programming continuous training course, mainly targeting primary school students in grades three to six. They continue to develop competitions in training, and even sponsor their competitions in Hong Kong or internationally. In order to discover more eli'... (length=2560)
  public 'post_title' => string 'We support teens coding' (length=23)
  public 'post_excerpt' => string '' (length=0)
  public 'post_status' => string 'publish' (length=7)
  public 'comment_status' => string 'open' (length=4)
  public 'ping_status' => string 'open' (length=4)
  public 'post_password' => string '' (length=0)
  public 'post_name' => string 'we-support-teens-coding' (length=23)
  public 'to_ping' => string '' (length=0)
  public 'pinged' => string '' (length=0)
  public 'post_modified' => string '2022-11-06 10:34:30' (length=19)
  public 'post_modified_gmt' => string '2022-11-06 02:34:30' (length=19)
  public 'post_content_filtered' => string '' (length=0)
  public 'post_parent' => int 0
  public 'guid' => string 'https://www.quantr.foundation/?p=2343' (length=37)
  public 'menu_order' => int 0
  public 'post_type' => string 'post' (length=4)
  public 'post_mime_type' => string '' (length=0)
  public 'comment_count' => string '0' (length=1)
  public 'filter' => string 'raw' (length=3)
We support teens coding
Teenagers are the pillars of the future society. For the society to have strong development, especially in terms of science and technology, nurturing them is indispensable. Seeing this, the Hong Kong Millennium Lions Club launched a programming continuous training course, mainly targeting primary school students in grades three to six. They continue to develop competitions […]

Teenagers are the pillars of the future society. For the society to have strong development, especially in terms of science and technology, nurturing them is indispensable. Seeing this, the Hong Kong Millennium Lions Club launched a programming continuous training course, mainly targeting primary school students in grades three to six. They continue to develop competitions in training, and even sponsor their competitions in Hong Kong or internationally. In order to discover more elites in programming, so that they can make a contribution to Hong Kong technology.

			
/home/quantr.foundation/www/wp-content/plugins/quantr-foundation-wordpress-widgets/blog_shortcode_html.php:8:
object(WP_Post)[2682]
  public 'ID' => int 2264
  public 'post_author' => string '1' (length=1)
  public 'post_date' => string '2022-09-05 15:38:47' (length=19)
  public 'post_date_gmt' => string '2022-09-05 07:38:47' (length=19)
  public 'post_content' => string '<!-- wp:paragraph -->
<p>A good RISC-V talk hold in Cityu <a rel="noreferrer noopener" href="http://appslab.hk/" data-type="URL" data-id="http://appslab.hk/" target="_blank">appslab</a>. Motivate students to contribute in RISC-V development. Cityu Appslab CPU special interest group is the place to unite everyone on system coding. We hope we can use our code to have solid contribution in RISC-V. Powerpoint in <a href="https://www.quantr.foundation/wp-content/uploads/2022/09/20220905-appslab-RISC-V-talk.pptx"'... (length=3112)
  public 'post_title' => string 'Cityu Appslab RISC-V talk' (length=25)
  public 'post_excerpt' => string '' (length=0)
  public 'post_status' => string 'publish' (length=7)
  public 'comment_status' => string 'open' (length=4)
  public 'ping_status' => string 'open' (length=4)
  public 'post_password' => string '' (length=0)
  public 'post_name' => string 'cityu-appslab-risc-v-talk' (length=25)
  public 'to_ping' => string '' (length=0)
  public 'pinged' => string '' (length=0)
  public 'post_modified' => string '2022-09-18 12:13:37' (length=19)
  public 'post_modified_gmt' => string '2022-09-18 04:13:37' (length=19)
  public 'post_content_filtered' => string '' (length=0)
  public 'post_parent' => int 0
  public 'guid' => string 'https://www.quantr.foundation/?p=2264' (length=37)
  public 'menu_order' => int 0
  public 'post_type' => string 'post' (length=4)
  public 'post_mime_type' => string '' (length=0)
  public 'comment_count' => string '0' (length=1)
  public 'filter' => string 'raw' (length=3)
Cityu Appslab RISC-V talk
A good RISC-V talk hold in Cityu appslab. Motivate students to contribute in RISC-V development. Cityu Appslab CPU special interest group is the place to unite everyone on system coding. We hope we can use our code to have solid contribution in RISC-V. Powerpoint in here.

A good RISC-V talk hold in Cityu appslab. Motivate students to contribute in RISC-V development. Cityu Appslab CPU special interest group is the place to unite everyone on system coding. We hope we can use our code to have solid contribution in RISC-V. Powerpoint in here.

			
/home/quantr.foundation/www/wp-content/plugins/quantr-foundation-wordpress-widgets/blog_shortcode_html.php:8:
object(WP_Post)[2683]
  public 'ID' => int 2248
  public 'post_author' => string '1' (length=1)
  public 'post_date' => string '2022-08-26 12:42:42' (length=19)
  public 'post_date_gmt' => string '2022-08-26 04:42:42' (length=19)
  public 'post_content' => string '<!-- wp:paragraph -->
<p>Step 1.  Add "QEMUOPTS += -singlestep -d cpu,nochain -D peter.log" to XV6 Makefile</p>
<!-- /wp:paragraph -->

<!-- wp:image {"id":2249,"sizeSlug":"large","linkDestination":"media"} -->
<figure class="wp-block-image size-large"><a href="https://www.quantr.foundation/wp-content/uploads/2022/08/image-3.png"><img src="https://www.quantr.foundation/wp-content/uploads/2022/08/image-3-1024x578.png" alt="" class="wp-image-2249"/></a></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>St'... (length=1762)
  public 'post_title' => string 'How to record qemu into our simulator workbench' (length=47)
  public 'post_excerpt' => string '' (length=0)
  public 'post_status' => string 'publish' (length=7)
  public 'comment_status' => string 'open' (length=4)
  public 'ping_status' => string 'open' (length=4)
  public 'post_password' => string '' (length=0)
  public 'post_name' => string 'how-to-record-qemu-into-our-simulator-workbench' (length=47)
  public 'to_ping' => string '' (length=0)
  public 'pinged' => string '' (length=0)
  public 'post_modified' => string '2022-10-22 12:55:29' (length=19)
  public 'post_modified_gmt' => string '2022-10-22 04:55:29' (length=19)
  public 'post_content_filtered' => string '' (length=0)
  public 'post_parent' => int 0
  public 'guid' => string 'https://www.quantr.foundation/?p=2248' (length=37)
  public 'menu_order' => int 0
  public 'post_type' => string 'post' (length=4)
  public 'post_mime_type' => string '' (length=0)
  public 'comment_count' => string '0' (length=1)
  public 'filter' => string 'raw' (length=3)
How to record qemu into our simulator workbench
Step 1. Add “QEMUOPTS += -singlestep -d cpu,nochain -D peter.log” to XV6 Makefile Step 2. Run qemu in XV6, “make qemu”, then you will have the file “peter.log” Step 3. Clone this project https://gitlab.com/quantr/toolchain/qemu-importer Step 4. Modify these values in red, remember the GUI has to start with your user name to login to https://www.quantr.foundation/simulator-workbench/ […]

Step 1. Add "QEMUOPTS += -singlestep -d cpu,nochain -D peter.log" to XV6 Makefile

Step 2. Run qemu in XV6, "make qemu", then you will have the file "peter.log"

Step 3. Clone this project https://gitlab.com/quantr/toolchain/qemu-importer

Step 4. Modify these values in red, remember the GUI has to start with your user name to login to https://www.quantr.foundation/simulator-workbench/

Step 5. Make sure CPUS := 1 in XV6 Makefile

Step 6. Just run the test case, refresh the workbench, your new record will appear in the drop down box

			
/home/quantr.foundation/www/wp-content/plugins/quantr-foundation-wordpress-widgets/blog_shortcode_html.php:8:
object(WP_Post)[2658]
  public 'ID' => int 2220
  public 'post_author' => string '1' (length=1)
  public 'post_date' => string '2022-08-06 11:22:44' (length=19)
  public 'post_date_gmt' => string '2022-08-06 03:22:44' (length=19)
  public 'post_content' => string '<!-- wp:paragraph -->
<p></p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":2222,"sizeSlug":"full","linkDestination":"none"} -->
<figure class="wp-block-image aligncenter size-full"><img src="https://www.quantr.foundation/wp-content/uploads/2022/08/CHEUNG_Ray_Web.jpg" alt="" class="wp-image-2222"/><figcaption>Dr Ray Cheung</figcaption></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>We thank you Dr Ray for appointing me as a part-time staff of CityU. This is a decisive contribution and '... (length=911)
  public 'post_title' => string 'Dr Ray's decisive contribution' (length=30)
  public 'post_excerpt' => string '' (length=0)
  public 'post_status' => string 'publish' (length=7)
  public 'comment_status' => string 'open' (length=4)
  public 'ping_status' => string 'open' (length=4)
  public 'post_password' => string '' (length=0)
  public 'post_name' => string 'dr-rays-decisive-contribution' (length=29)
  public 'to_ping' => string '' (length=0)
  public 'pinged' => string '' (length=0)
  public 'post_modified' => string '2022-08-29 13:23:25' (length=19)
  public 'post_modified_gmt' => string '2022-08-29 05:23:25' (length=19)
  public 'post_content_filtered' => string '' (length=0)
  public 'post_parent' => int 0
  public 'guid' => string 'https://www.quantr.foundation/?p=2220' (length=37)
  public 'menu_order' => int 0
  public 'post_type' => string 'post' (length=4)
  public 'post_mime_type' => string '' (length=0)
  public 'comment_count' => string '0' (length=1)
  public 'filter' => string 'raw' (length=3)
Dr Ray's decisive contribution
We thank you Dr Ray for appointing me as a part-time staff of CityU. This is a decisive contribution and will record in our history, because of this, we can promote University and Industry collaborations, and have closer mentorship and advising to CityU students. We can sharpen our skills there and make our CPU development […]

Dr Ray Cheung

We thank you Dr Ray for appointing me as a part-time staff of CityU. This is a decisive contribution and will record in our history, because of this, we can promote University and Industry collaborations, and have closer mentorship and advising to CityU students. We can sharpen our skills there and make our CPU development process faster and easier. Society cannot progress without enthusiastic people, and Dr Ray just confirms this fact, and cultivate our students together.

			
/home/quantr.foundation/www/wp-content/plugins/quantr-foundation-wordpress-widgets/blog_shortcode_html.php:8:
object(WP_Post)[2586]
  public 'ID' => int 2202
  public 'post_author' => string '1' (length=1)
  public 'post_date' => string '2022-08-01 16:26:16' (length=19)
  public 'post_date_gmt' => string '2022-08-01 08:26:16' (length=19)
  public 'post_content' => string '<!-- wp:paragraph {"style":{"typography":{"fontSize":"18px"}}} -->
<p style="font-size:18px">We are implementing a brand new executable format, .QR (quantr riscv format), which is specially designed for maximizing the efficacy of RISC-V assembled files during execution. The following will be the walkthrough of our concept and design.</p>
<!-- /wp:paragraph -->

<!-- wp:separator -->
<hr class="wp-block-separator has-alpha-channel-opacity"/>
<!-- /wp:separator -->

<!-- wp:paragraph {"fontSize":"large"} -->
'... (length=4850)
  public 'post_title' => string 'Quantr RISC-V executable file format (.QR)' (length=42)
  public 'post_excerpt' => string '' (length=0)
  public 'post_status' => string 'publish' (length=7)
  public 'comment_status' => string 'open' (length=4)
  public 'ping_status' => string 'open' (length=4)
  public 'post_password' => string '' (length=0)
  public 'post_name' => string 'quantr-risc-v-executable-format-designs' (length=39)
  public 'to_ping' => string '' (length=0)
  public 'pinged' => string '' (length=0)
  public 'post_modified' => string '2022-08-18 14:35:00' (length=19)
  public 'post_modified_gmt' => string '2022-08-18 06:35:00' (length=19)
  public 'post_content_filtered' => string '' (length=0)
  public 'post_parent' => int 0
  public 'guid' => string 'https://www.quantr.foundation/?p=2202' (length=37)
  public 'menu_order' => int 0
  public 'post_type' => string 'post' (length=4)
  public 'post_mime_type' => string '' (length=0)
  public 'comment_count' => string '0' (length=1)
  public 'filter' => string 'raw' (length=3)
Quantr RISC-V executable file format (.QR)
We are implementing a brand new executable format, .QR (quantr riscv format), which is specially designed for maximizing the efficacy of RISC-V assembled files during execution. The following will be the walkthrough of our concept and design. Background We all know that the most commonly used executable file formats are PE (on Microsoft Windows), ELF […]

We are implementing a brand new executable format, .QR (quantr riscv format), which is specially designed for maximizing the efficacy of RISC-V assembled files during execution. The following will be the walkthrough of our concept and design.


Background

We all know that the most commonly used executable file formats are PE (on Microsoft Windows), ELF (on Linux and most other versions of Unix), Mach-O (on mac OS and iOS), and MZ (on DOS). All these executable file formats have a particular time of development, and there is no doubt about their accessibility and efficiency.

However, when it comes to dealing with RISC-V assembled files, although there are no significant defects with these formats, they failed to take advantage of the CPU to compile the files.

Another notable point is that currently all executable file formats are written in binary format, and the main advantage of this format is that the data can be read and written more efficiently. However, due to the rapid development of CPU technologies, the speed of CPU has been increasing a lot, and the benefits gained from binary format are fainting. Meanwhile, there are two critical defects of it:

  1. Hard to perform partial data transformation.
  2. Hard for human to read and understand, making it extremely difficult to edit and extend.

As a result of all the factors combined, we decided to create our new format, .QR (quantr), which aims to solve the shortcomings of other executable file formats while taking advantage of the CPU to speed up the reading and writing process of RISC-V assembly files.


Unique Features

The following are the key features of the Quantr RISC-V executable file format:

  1. Support custom field: the Quantr RISC-V executable file format has no format constraints and custom fields such as security fields or performance tuning fields, can be added.
  2. Executable transform: allow to sections to change positions in the file.
  3. Executable merge: allow users to merge multiple sections into one section.
  4. Executable trim down: trim down redundant data to free up space, such as '0's used for alignment.
  5. Executable encrypt: encrypt the content in the file to enhance security.
  6. Dynamics PLT & GOT combination and optimization.

QR Library

We have implemented a library for processing the Java Structure of our format, QR.

Since we mainly use Java to develop our toolchain, such as our RISC-V simulator, we will also use it to build our library to reduce the program's complexity.

In our library, we used Jackson to serialize and deserialize the structure of our format and Jsonata as the JSON query language.

			
/home/quantr.foundation/www/wp-content/plugins/quantr-foundation-wordpress-widgets/blog_shortcode_html.php:8:
object(WP_Post)[2587]
  public 'ID' => int 2148
  public 'post_author' => string '1' (length=1)
  public 'post_date' => string '2022-05-22 01:04:09' (length=19)
  public 'post_date_gmt' => string '2022-05-21 17:04:09' (length=19)
  public 'post_content' => string '<!-- wp:paragraph -->
<p>All team members has to use same formatting, otherwise we have to merge useless code</p>
<!-- /wp:paragraph -->

<!-- wp:image {"id":2149,"sizeSlug":"large","linkDestination":"media"} -->
<figure class="wp-block-image size-large"><a href="https://www.quantr.foundation/wp-content/uploads/2022/05/netbeans-formatting.png"><img src="https://www.quantr.foundation/wp-content/uploads/2022/05/netbeans-formatting-1024x628.png" alt="" class="wp-image-2149"/></a></figure>
<!-- /wp:image -->

<'... (length=1769)
  public 'post_title' => string 'Netbeans formatting' (length=19)
  public 'post_excerpt' => string '' (length=0)
  public 'post_status' => string 'publish' (length=7)
  public 'comment_status' => string 'open' (length=4)
  public 'ping_status' => string 'open' (length=4)
  public 'post_password' => string '' (length=0)
  public 'post_name' => string 'netbeans-formatting' (length=19)
  public 'to_ping' => string '' (length=0)
  public 'pinged' => string '' (length=0)
  public 'post_modified' => string '2022-09-19 01:49:40' (length=19)
  public 'post_modified_gmt' => string '2022-09-18 17:49:40' (length=19)
  public 'post_content_filtered' => string '' (length=0)
  public 'post_parent' => int 0
  public 'guid' => string 'https://www.quantr.foundation/?p=2148' (length=37)
  public 'menu_order' => int 0
  public 'post_type' => string 'post' (length=4)
  public 'post_mime_type' => string '' (length=0)
  public 'comment_count' => string '0' (length=1)
  public 'filter' => string 'raw' (length=3)
Netbeans formatting
All team members has to use same formatting, otherwise we have to merge useless code Set the author

All team members has to use same formatting, otherwise we have to merge useless code

Set the author

			
/home/quantr.foundation/www/wp-content/plugins/quantr-foundation-wordpress-widgets/blog_shortcode_html.php:8:
object(WP_Post)[2588]
  public 'ID' => int 2120
  public 'post_author' => string '1' (length=1)
  public 'post_date' => string '2022-04-25 18:04:27' (length=19)
  public 'post_date_gmt' => string '2022-04-25 10:04:27' (length=19)
  public 'post_content' => string '<!-- wp:paragraph -->
<p>This post will describe the skill you need to join the development, I separate it into different sections by the project.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><strong>Assembler</strong></p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><!-- wp:list-item -->
<li>Java coding skill<!-- wp:list {"ordered":true} -->
<ol><!-- wp:list-item -->
<li>Object oriented programming</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>Maven <a rel="noreferrer noop'... (length=13215)
  public 'post_title' => string 'Skill you need' (length=14)
  public 'post_excerpt' => string '' (length=0)
  public 'post_status' => string 'publish' (length=7)
  public 'comment_status' => string 'open' (length=4)
  public 'ping_status' => string 'open' (length=4)
  public 'post_password' => string '' (length=0)
  public 'post_name' => string 'skill-you-need' (length=14)
  public 'to_ping' => string '' (length=0)
  public 'pinged' => string '' (length=0)
  public 'post_modified' => string '2023-03-20 15:45:12' (length=19)
  public 'post_modified_gmt' => string '2023-03-20 07:45:12' (length=19)
  public 'post_content_filtered' => string '' (length=0)
  public 'post_parent' => int 0
  public 'guid' => string 'https://www.quantr.foundation/?p=2120' (length=37)
  public 'menu_order' => int 0
  public 'post_type' => string 'post' (length=4)
  public 'post_mime_type' => string '' (length=0)
  public 'comment_count' => string '0' (length=1)
  public 'filter' => string 'raw' (length=3)
Skill you need
This post will describe the skill you need to join the development, I separate it into different sections by the project. Assembler Simulator Operating System CPU

This post will describe the skill you need to join the development, I separate it into different sections by the project.

Assembler

  1. Java coding skill
    1. Object oriented programming
    2. Maven https://maven.apache.org/guides/getting-started/maven-in-five-minutes.html
    3. How pom.xml work
    4. How maven.quantr.hk work
    5. How gitlab CI/CD publish to maven.quantr.hk
  2. Netbeans https://docs.oracle.com/javase/tutorial/getStarted/cupojava/netbeans.html
    1. Package project into an executable jar and run it by "java -jar xxx.jar"
    2. Learn how to use Apache Commons Library
      1. Common-cli https://commons.apache.org/proper/commons-cli/
      2. Common-io https://commons.apache.org/proper/commons-io/
      3. Checkout all libraries in https://gitlab.com/quantr/toolchain/Assembler/-/blob/master/pom.xml and try to understand what are they
  3. Git https://www.atlassian.com/git
    1. Know how to clone/commit/add/push
    2. Try to create a project in GitLab, clone it, add some files, and push them back. https://www.tutorialspoint.com/gitlab/index.htm
    3. If fork another project, how to get update from original repo
  4. Gitlab https://www.youtube.com/watch?v=mX7lKoabmDw
    1. Learn basic usage, such as view commit, checkout older version
    2. Learn how our CI/CD work
  5. Antlr https://www.antlr.org/ and https://pragprog.com/titles/tpantlr2/the-definitive-antlr-4-reference/
    1. Run the examples in the first few chapters
    2. Create a maven project and let it compile the grammar for you
    3. Learn how to use our antlr plugin https://www.quantr.hk/netbeans/ and https://peter.quantr.hk/2017/09/2475/ and https://peter.quantr.hk/2017/09/netbeans-antlr-plugin-great-enhancement/
  6. RISC-V computer architecture
    1. Understand what is it https://en.wikipedia.org/wiki/RISC-V
    2. Try to write some assembly code https://www.youtube.com/watch?v=XVU_RNiz09A and https://www.youtube.com/watch?v=PMzbRMsGpwU
    3. Build RISC-V toolchain
    4. Run it https://github.com/TheThirdOne/rars
      1. Do simple maths calculations, addition and subtraction
      2. Jump https://github.com/riscv-collab/riscv-gnu-toolchain , use below commands to compile program
        1. GCC
        2. GAS
          1. Understand RISC-V official syntax and AT&T syntax https://docs.opentitan.org/doc/rm/asm_coding_style/
          2. Inline assembly https://stackoverflow.com/questions/69034346/riscv-inline-assembly-in-gcc-atomic-load-store
        3. LD
          1. Learn how linker script work
      3. Conditional branch
      4. Understand stack https://ithelp.ithome.com.tw/m/articles/10267662
      5. Call and return, understand frame pointer https://twilco.github.io/riscv-from-scratch/2019/07/28/riscv-from-scratch-4.html , write a simple program that main() -> func1() -> func2() , tell me show RISC-V distinguish the frame area among func1() and func2()
      6. Load and Store, write a simple program that sum all bytes in memory
      7. RISC-V interrupt and exception, make sure know what registers controlling the interrupt
      8. RISC-V paging and memory protection https://gitlab.com/quantr/toolchain/riscv-simulator/-/tree/master/src/test/resources/hk/quantr/riscv_simulator/elf , do address translate by hand
      9. Floating Point
        1. IEEE 754, learn how to encode and decode by hand
        2. What RISC-V instruction can do floating point operations, write some examples
      10. Virtio https://juejin.cn/post/6891922292075397127
    5. Read the Unprivileged spec https://riscv.org/technical/specifications/
    6. Try to read the Privileged Spec, as an undergraduate student, you won't be able to practice it, just read as much as you can

Simulator

  1. Prepare all the above skillsets
  2. Learn how to encode and decode RISC-V instruction by hand https://www.youtube.com/watch?v=VNy-J0u7-jY
    1. Understand how many different types of instruction https://www.cl.cam.ac.uk/teaching/1617/ECAD+Arch/files/docs/RISCVGreenCardv8-20151013.pdf
    2. Handwriting encode and decode instructions
  3. Learn how to write Makefile https://makefiletutorial.com/
    1. Create a simple Makefile yourself
    2. Understand our Makefile https://gitlab.com/quantr/toolchain/cpu/quantr-i/-/blob/main/Makefile and https://gitlab.com/quantr/toolchain/cpu/quantr-i/-/blob/main/testcase/ex/Makefile
  4. Learn GCC toolchain
    1. GCC
    2. LD
    3. Objdump
    4. Readelf
    5. Autotools

Operating System

  1. Bootloader
  2. ABI
  3. Standard C library, newlib
  4. Linker script
  5. Executable Format
  6. Dwarf
  7. Interrupt
  8. File System
  9. Kernel Structure
    1. Paging
    2. Task state structure
    3. Memory protection
    4. I/O

CPU

  1. Verilog
  2. Pipeline design
			
/home/quantr.foundation/www/wp-content/plugins/quantr-foundation-wordpress-widgets/blog_shortcode_html.php:8:
object(WP_Post)[2589]
  public 'ID' => int 2056
  public 'post_author' => string '1' (length=1)
  public 'post_date' => string '2021-07-17 18:10:21' (length=19)
  public 'post_date_gmt' => string '2021-07-17 10:10:21' (length=19)
  public 'post_content' => string '<!-- wp:paragraph -->
<p>We need to make these changes to qemu, to make our simulator workbench to capture all data we need, including all instruction disassemble lines and memory access records<br>1. git clone https://github.com/qemu/qemu.git<br>2. since latest qemu not work with xv6, so switch to v5.2.0 by git checkout tags/v5.2.0<br>3. modify <strong>accel/tcg/translate-all.c</strong>, infunction tb_gen_code, change this</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>    if'... (length=1530)
  public 'post_title' => string 'Modify Qemu to support our RISC-V simulator dev' (length=47)
  public 'post_excerpt' => string '' (length=0)
  public 'post_status' => string 'publish' (length=7)
  public 'comment_status' => string 'open' (length=4)
  public 'ping_status' => string 'open' (length=4)
  public 'post_password' => string '' (length=0)
  public 'post_name' => string 'modify-qemu-to-support-our-risc-v-simulator-dev' (length=47)
  public 'to_ping' => string '' (length=0)
  public 'pinged' => string '' (length=0)
  public 'post_modified' => string '2021-07-18 17:13:58' (length=19)
  public 'post_modified_gmt' => string '2021-07-18 09:13:58' (length=19)
  public 'post_content_filtered' => string '' (length=0)
  public 'post_parent' => int 0
  public 'guid' => string 'https://www.quantr.foundation/?p=2056' (length=37)
  public 'menu_order' => int 0
  public 'post_type' => string 'post' (length=4)
  public 'post_mime_type' => string '' (length=0)
  public 'comment_count' => string '0' (length=1)
  public 'filter' => string 'raw' (length=3)
Modify Qemu to support our RISC-V simulator dev
We need to make these changes to qemu, to make our simulator workbench to capture all data we need, including all instruction disassemble lines and memory access records1. git clone https://github.com/qemu/qemu.git2. since latest qemu not work with xv6, so switch to v5.2.0 by git checkout tags/v5.2.03. modify accel/tcg/translate-all.c, infunction tb_gen_code, change this To 4. Edit […]

We need to make these changes to qemu, to make our simulator workbench to capture all data we need, including all instruction disassemble lines and memory access records
1. git clone https://github.com/qemu/qemu.git
2. since latest qemu not work with xv6, so switch to v5.2.0 by git checkout tags/v5.2.0
3. modify accel/tcg/translate-all.c, infunction tb_gen_code, change this

    if (phys_pc == -1) {
        /* Generate a temporary TB with 1 insn in it */
        cflags &= ~CF_COUNT_MASK;
        cflags |= CF_NOCACHE | 1;
    }

To

    if (phys_pc == -1 || true) {
        /* Generate a temporary TB with 1 insn in it */
        cflags &= ~CF_COUNT_MASK;
        cflags |= CF_NOCACHE | 1;
    }

4. Edit target/riscv/cpu.c, add "tlb_flush(cs);" at the end of function "riscv_cpu_dump_state", to let use capture all memory r/w operations, we have to keep flushing the tlb, since TLB operations are not record in trace.
5. Compile Qemu

./configure --target-list=riscv64-softmmu --enable-plugins
make -j8
sudo make install
			
/home/quantr.foundation/www/wp-content/plugins/quantr-foundation-wordpress-widgets/blog_shortcode_html.php:8:
object(WP_Post)[2709]
  public 'ID' => int 2025
  public 'post_author' => string '1' (length=1)
  public 'post_date' => string '2021-07-01 00:10:17' (length=19)
  public 'post_date_gmt' => string '2021-06-30 16:10:17' (length=19)
  public 'post_content' => string '<!-- wp:paragraph -->
<p>These are the OUHK FYP projects, student co-work with us on RISC-V topics. One of the project listed on OUHK website <a href="https://www.hkmu.edu.hk/st/engsc/fyp/2021-22/risc-v-simd-simulation/" target="_blank" rel="noreferrer noopener">https://www.hkmu.edu.hk/st/engsc/fyp/2021-22/risc-v-simd-simulation/</a></p>
<!-- /wp:paragraph -->

<!-- wp:file {"id":2026,"href":"https://www.quantr.foundation/wp-content/uploads/2021/07/A01-s1241911-project-final-report.pdf"} -->
<div class="wp-'... (length=2414)
  public 'post_title' => string 'OUHK students finished their fyp about RISC-V with us' (length=53)
  public 'post_excerpt' => string '' (length=0)
  public 'post_status' => string 'publish' (length=7)
  public 'comment_status' => string 'open' (length=4)
  public 'ping_status' => string 'open' (length=4)
  public 'post_password' => string '' (length=0)
  public 'post_name' => string 'ouhk-students-finished-their-fyp-about-risc-v-with-us' (length=53)
  public 'to_ping' => string '' (length=0)
  public 'pinged' => string '' (length=0)
  public 'post_modified' => string '2023-07-18 10:33:32' (length=19)
  public 'post_modified_gmt' => string '2023-07-18 02:33:32' (length=19)
  public 'post_content_filtered' => string '' (length=0)
  public 'post_parent' => int 0
  public 'guid' => string 'https://www.quantr.foundation/?p=2025' (length=37)
  public 'menu_order' => int 0
  public 'post_type' => string 'post' (length=4)
  public 'post_mime_type' => string '' (length=0)
  public 'comment_count' => string '0' (length=1)
  public 'filter' => string 'raw' (length=3)
OUHK students finished their fyp about RISC-V with us
These are the OUHK FYP projects, student co-work with us on RISC-V topics. One of the project listed on OUHK website https://www.hkmu.edu.hk/st/engsc/fyp/2021-22/risc-v-simd-simulation/

These are the OUHK FYP projects, student co-work with us on RISC-V topics. One of the project listed on OUHK website https://www.hkmu.edu.hk/st/engsc/fyp/2021-22/risc-v-simd-simulation/