Skip to content

Proof of Concept

As an illustration, two simple simulations are presented as a proof of concept for the operation of the main components: hsid_main and hsid_x_top. Both tests were executed using the xsim simulator.

There is a bash script to execute these basic proof of concepts. It is based on FuseSoC, and you can change some parameters of the test. To learn more about this script, you can run the following command in the terminal bash:

hsid-simple-sim.sh -h

Proof of Concept for hsid_main

This test is very basic and is only intended to visualize, via waveform, what is happening inside the hsid_main module. This process is not a verification test; it is solely illustrative. The test is called hsid_main_simple_tb.sv, and it can be found in the tb folder of the hsid_main module.

The FuseSoC module for hsid_main includes a section prepared with all the necessary components to simulate this test. To execute this proof of concept, run the following command in a Bash shell:

hsid-simple-sim.sh hsid_main

The result of this command is a textual output containing a summary of the simulated captured HSP and two reference signatures. It also checks the expected minimum and maximum computed Mean Squared Error (MSE).

Time resolution is 1 ps
run -all
Case 1: Simple operation
 - Captured HSP: '{62,31,5,51,78,57,11,6,22,51,58,100,75,3,7,64,54,32,32,96,69,73,27,23,5,59,87,42,66,13,99,4,6,52,80,72,32,46,77,5,31,57,44,31,3,21,70,68,79,82,66,15,3,36,84,83,18,50,31,21,20,15,37,72,32,69,26,19,51,64,24,17,67,51}
 - Library HSP 0: '{37,85,15,62,69,15,13,74,34,63,69,70,11,49,77,79,79,46,83,24,63,93,36,75,39,86,32,35,79,36,77,18,55,43,88,34,80,31,53,68,75,74,70,88,73,56,56,81,64,26,2,70,49,59,51,80,85,87,50,34,12,69,14,64,89,65,99,1,100,13,66,90,79,65}
 - Library HSP 1: '{92,80,79,58,70,58,91,62,38,2,20,42,61,44,37,66,81,24,75,75,36,79,75,16,37,16,92,6,29,33,57,67,84,82,7,47,49,64,47,67,46,55,13,62,19,61,96,99,49,76,28,1,37,57,100,53,33,62,55,37,19,23,24,53,18,80,91,38,36,15,92,89,63,50}
 - Accumulated int for library vector 0: '{625,3541,3641,3762,3843,5607,5611,10235,10379,10523,10644,11544,15640,17756,22656,22881,23506,23702,26303,31487,31523,31923,32004,34708,35864,36593,39618,39667,39836,40365,40849,41045,43446,43527,43591,45035,47339,47564,48140,52109,54045,54334,55010,58259,63159,64384,64580,64749,64974,68110,72206,75231,77347,77876,78965,78974,83463,84832,85193,85362,85426,88342,88871,88935,92184,92200,97529,97853,100254,102855,104619,109948,110092,110288}
 - Accumulated int for library vector 1: '{900,3301,8777,8826,8890,8891,15291,18427,18683,21084,22528,25892,26088,27769,28669,28673,29402,29466,31315,31756,32845,32881,35185,35234,36258,38107,38132,39428,40797,41197,42961,46930,53014,53914,59243,59868,60157,60481,61381,65225,65450,65454,66415,67376,67632,69232,69908,70869,71769,71805,73249,73445,74601,75042,75298,76198,76423,76567,77143,77399,77400,77464,77633,77994,78190,78311,82536,82897,83122,85523,90147,95331,95347,95348}
 - Expected min MSE: 1288, ref: 1
 - Expected max MSE: 1490, ref: 0
 - Sending captured vector...
 - Sending library vectors...
 - Waiting 8 + Divider cycles to finish processing (2 to write and read fifo, 4 (diff, mult, acc, sum) + 1 Start Divider + K+1 Divider Latency, 1 change state)...
$finish called at time : 1588 ns

You can also view a waveform using GTKWave, with all signals configured, by executing the following command:

hsid-simple-sim.sh -w hsid_main

The figure below presents the complete waveform generated by this test, with several highlighted segments to describe each step of the process:

Proof of Concept of hsid_main

The following image offers a clearer explanation of the final steps involved in computing the last MSE. All these computations are pipelined, except for the division. Therefore, the HSP and signature reference vectors must be longer than the number of steps required to complete the MSE computation.

Ending pipeline hsid_main

As shown, the entire spectral library is read continuously without interruption, and the computation of the MSE is performed as soon as a full signature reference is received.

You can change some parameters of this proof of concept. To learn more about it, you can execute the following command:

hsid-simple-sim.sh hsid_main --help

Proof of concept for hsid_x_top

Similarly, there is a small test designed to visualize, via waveform, what is happening inside the top module hsid_x_top. This is not a verification test; rather, it serves as an illustrative example.

To execute this test, run the following command in the Bash terminal:

hsid-sim-simple.sh -w hsid_x_top

The output of this command will be something similar to this example:

Time resolution is 1 ps
run -all
Case 1: Simple operation
Captured Pixel Address: 0x43218765, Library Address: 0x32422342, HSP Bands: 74, Library size: 2
 - Expected min MSE: 36, ref: 1
 - Expected max MSE: 52, ref: 0
PASS: BUS read addr: 0x0 (HSID_X_CTRL_STATUS) passed: got 2 (0x00000002)
PASS: BUS read addr: 0x4 (HSID_X_CTRL_LIBRARY_SIZE) passed: got 2 (0x00000002)
PASS: BUS read addr: 0x8 (HSID_X_CTRL_PIXEL_BANDS) passed: got 74 (0x0000004a)
PASS: BUS read addr: 0xc (HSID_X_CTRL_CAPTURED_PIXEL_ADDR) passed: got 1126270821 (0x43218765)
PASS: BUS read addr: 0x10 (HSID_X_CTRL_LIBRARY_PIXEL_ADDR) passed: got 843195202 (0x32422342)
PASS: BUS read addr: 0x0 (HSID_X_CTRL_STATUS) passed: got 8 (0x00000008)
PASS: BUS read addr: 0x0 (HSID_X_CTRL_STATUS) passed: got 10 (0x0000000a)
PASS: BUS read addr: 0x14 (HSID_X_CTRL_MSE_MIN_REF) passed: got 1 (0x00000001)
PASS: BUS read addr: 0x1c (HSID_X_CTRL_MSE_MIN_VALUE) passed: got 36 (0x00000024)
PASS: BUS read addr: 0x18 (HSID_X_CTRL_MSE_MAX_REF) passed: got 0 (0x00000000)

The figure below shows the waveform produced by this simulation, with some highlighted areas that describe the sequence of operations performed by the accelerator.

Proof of concept waveform for hsid_x_top

In the FuseSoC module definition (hsid_x_top.core), several parameters for this test are defined, allowing you to modify their values. You can learn more about them by running the following command:

hsid-sim-simple.sh -w hsid_x_top --help

For example, you can simulate a random transmission from memory to emulate a congested OBI bus for HSP of 126 bands and a spectral library of 63 signatures:

hsid-sim-simple.sh -w hsid_x_top --TEST_RND_GNT 1 --TEST_HSP_BANDS 126 --TEST_HSP_LIBRARY_SIZE 63

Keep in mind that if you want to use bigger HSP or a greater number of reference signatures, you must update the HSP_BANDS_WIDTH and HSP_LIBRARY_WIDTH parameters, as well as the corresponding registers in data/hsid_x_ctrl.hjson (PIXEL_BANDS and LIBRARY_SIZE). You can learn more in the hardware configuration.