Posts

SPO600 Lab 6

#include <stdio.h> #include <stdbool.h> #include <arm_sve.h> #include "vol.h" int main () {     int x ;     int ttl = 0 ;     // ---- Create in[] and out[] arrays     int64_t * in ;     int64_t * out ;     in = ( int64_t * ) calloc ( SAMPLES , sizeof ( int64_t ));     out = ( int64_t * ) calloc ( SAMPLES , sizeof ( int64_t ));     // ---- Create dummy samples in in[]     vol_createsample ( in , SAMPLES );     // ---- This is the part we're interested in!     // ---- Scale the samples from in[], placing results in out[]     /*for (x = 0; x < SAMPLES; x++) {         out[x]=(int64_t) ((float) (VOLUME/100.0) * (float) in[x]);     }*/     svbool_t pg ; // [1]     svint64_t svin ; // [1]     svfloat64_t svv ; // [1]     const float64_t division = ( float )( VOLUME ...

SPO600 Lab 5

  In lab 5, I handed on an experiment where I benchmarked c programs that simulate the process of scaling volumes using different algorithms. The programs are separated, and this would cause inconsistent results because, for each run time, programs would create different random data of samples. Thus, I combine them into one to have a more reliable result for using mutual samples. Furthermore, I also set the number of samples to 300000, and the number of benchmark tests is 10000. For each test, I store the timer for each algorithm. In the end, I print the average time each algorithm takes. Here is my repository on GitHub: https://github.com/willvuong168/SPO600-Lab-5 Taking the advantage of a C++ course that I am taking, where I already had a timer program. All I have to do is put the timer before and after each scaling function. Before making an all-in-one program, each algorithm sums the sample's output and prints it out to the screen because each algorithm may produce a differ...

SPO600 Project Stage 1

For the final project in the SPO600 course, I have to find an open-source project to implement it with the new ARM SVE2 instructions. Regarding open source projects, the first place that appears in my mind is GitHub, so I decided to look for one on GitHub. In Lab 6, I have implemented a C program from Lab 5 using SVE2 instructions, and this affects my decision to find similar open-source projects on GitHub. As recommended, I should look for an open-source project that is at library level and do processing on large data sets. To start with researching for a project, I went to the trending tab on GitHub, and it showed a huge list (100 pages) of C repositories. I filtered out the list by sorting it by its popularity, and I thought I should choose a project that does not have too many stars because if I choose a project that has many stars, there is less work to do with it because there are already many people have involved in the project. Thus, I went to the last pages of the list to fi...

SPO600 Lab 4

Image
In lab 4, I have to do a simple program to print numbers from 0 to 30 with X86_64 and AArch64 Assembly. It was my bad to forget the passphrase of my SSH key, so I could not log in to the server to do the lab. Fortunately, I found a package on Ubuntu APT-GET library that simulates AArch64 architecture, which is QEMU . The command to install it: sudo apt-get install qemu-user gcc-aarch64-linux-gnu. With the program, I was able to compile and run AArch64 Assembly without ARM hardware like a Raspberry Pi 4. Back to the main program, this is my code to print from 0 to 9: .text .globl     main min = 0 max = 10   main:         mov      x19, min                         loop:         adr      x1, msg      ...

SPO600 Lab 3

Image
  For lab 3, my task is to write a simple program using the output screen and to make use of math operation in 6502 assembly. Even though it is a simple program with basic tasks, it is not that easy to write the program in assembly language, while we can do this easily in modern language. Especially we just learned a whole new concept for several classes. Luckily, the lab says: I decided to write a subtraction calculator. Inspired by the adding calculator from my professor’s Github:  (https://github.com/ctyler/6502js-code/blob/master/adding-calculator.6502) I made an investigation to understand how the code works, so later I can modify it to become a subtraction calculator. With a limited amount of time learning 6502 assembly and not many resources on the internet, I could only understand the main part of the program, but it was enough for me to make an incomplete subtraction calculator. My input process is identical to the source code. The only difference is instead of ...

SPO600 Lab 2

Image
 Lab 2, where I have a given 6502 assembly code: lda #$00 ; set a pointer at $40 to point to $0200 sta $40 lda #$02 sta $41 lda #$07 ; colour number ldy #$00 ; set index to 0 loop: sta ($40),y ; set pixel at the address (pointer)+Y iny ; increment index bne loop ; continue until done the page inc $41 ; increment the page ldx $41 ; get the current page number cpx #$06 ; compare with 6 bne loop ; continue until done all pages My job is to play around with the code, calculate the performance of the given code, and try to optimize the code to have a better performance. First, starting to run the code on  http://6502.cdot.systems/  - a website that stimulates a 6502 emulator, I got a result of a yellow screen, which consists of 4 pages.  Let's look at the performance by calculating the number of cycles and cycle count. We will do this on Microsoft Excel to have a clear perspective. After doing some calculations on Excel, I got a result of 0.012 seconds...

SPO600 Lab 1

Image
 In the first lab of SPO600 course, my work is to explore two open-source software projects. As an Android user, who like to root my phone (I have a Pixel 6, and I saw you are having one too), I am using several applications that take advantage of root permissions. One of those apps is Adaway – an application that blocks ads system-wide. Source: https://adaway.org/ Looking at its source code on Github, I found the software is distributed under GNU GENERAL PUBLIC LICENSE - Version 3. In short, PGLv3 is a copyleft license, which requires copies or modifications of the source must also be released under the same license. Everyone can make contributions to the project by reporting bugs, suggesting enhancements, or translating to languages. For example, look at the most commented pull request – pull request number 784: Source: https://github.com/AdAway/AdAway/pull Source: https://github.com/AdAway/AdAway/pull/784 There were 21 commits and months needed in total to resolve the i...