Posts

SPO600(Project 3.2 FInal Post and thoughts on project and course)

Please Read 3.0 and 3.1 post as well!!  Thoughts on the tool and project. I believe that this can be very useful if expanded, what I mean by this is that I limited this tool just taking in C code using Python, That can be incredibly useful in the sense that if I only had an IDE such as Vs code (Made up example) that only was able to execute python that could become an issue if I need to execute a C style file or code bloc. This tool that I made was able to take that C and still give the desired output using Python language and syntax. This could be done in principial with any kind of code coming to the tool such as C++, Java and all other kinds. This tool could also be put onto other soft ware and is very modular in design.  This tool can be used very well to choose specific architecture, for my tool it was for aarch64 SME, SME2 and ASIMD, Proving the tool worked for choosing the methods was done in my 3.0 post and it shows we can choose a function using the tool that I had ma...

SPO600 (Project Part 3.1)

 My tool just incase github wont load. My helpers.py import re def whichOne ( line , dataTypes ):         for i in range ( len (dataTypes)):         if re.search( "^" + dataTypes[i] + "." , line):             return i     return - 1 My test.py (tool) import re import helpers fileName = "function_ifunc.c" f = open ( "function.c" , "r" ) #x = open("function.c", "r") orgLine = "" name = "" dataType = "" topPart = "" bottomPart = "" count = 0 dataTypes = [ 'void' , 'bool' , 'int' , 'double' , 'long' , 'float' ] for line in f:     count = count + 1     a = line.strip()     iDataType = helpers.whichOne(a, dataTypes)     if  iDataType != - 1 :         orgLine = a         dataType = re.split( "\s" , a, 1 )         print (dataType[ 0 ])         name = re.split( "\(" , dataTyp...

SPO600 (Project Part 3.0)

Image
For the final version of the program refer to here  https://github.com/a-martin94/Spo600   If the link is broken go here                                   https://github.com/a-martin94/Spo600 For Project details including test code go to here:  https://wiki.cdot.senecacollege.ca/wiki/Fall_2022_SPO600_Project In Order to run the code:   You can clone my repo at my get hub posted above, just make sure you have VS code preferable to new users or you can use vim if you clone it to a dir in a cmd line in gitbash. I Would just simply get VS code install python got to git hub and just drag and drop the files or copy them its not a huge project so dont really need to do a git clone, any ways after you have it all just go to the file path in the cmd line or what ever your working on and type "python test.py" and it will run the code. Important (For not just void use this example and...

Update to project (Part 2.3) ( revised)

 This is now a much more clean version of the tool I am looking to create, as mentioned in the last blog I was having a hard time learning python and was hard coding a lot to get the result. I have worked on that and now am posting the code here: import re f = open ( "function.c" , "r" ) orgLine = "" name = "" dataType = "" topPart = "" bottomPart = "" count = 0 for line in f:     count = count + 1     a = line.strip()     if re.search( "^void." , a):         orgLine = a         dataType = re.split( "\s" , a, 1 )         print (dataType[ 0 ])         name = re.split( "\(" , dataType[ 1 ], 1 )         #print("Name of func is " + name[0])         nextLine = f.readline()         while not re.search( ".{.?" , nextLine):             orgLine += nextLine.strip() + " "     ...

SPO600(Project Part 2.2)

Incase the code from github wont show up. Its super ghetto and I no I need to clean it up so it does not look like like a train wreck.   import re f = open ( "function.c" , "r" ) count = 0 '''for x in f:     count += 1 print(count) f.seek(0) for line in f:     print(line) ''' orgLine = "" name = "" dataType = "" #topPart ="" for line in f:     count = count + 1     a = line.strip()     if re.search( "^void." , a):         orgLine = a         dataType = re.split( "\s" , a, 1 )         print (dataType[ 0 ])         name = re.split( "\(" , dataType[ 1 ], 1 )         print ( "Name of func is " + name[ 0 ])                                 '''nextLine = f.readline()         orgLine += nextLine         print(orgLine) ...

SPO600(Project Part 2.1)

Image
My code can be found here:  https://github.com/a-martin94/Spo600/blob/main/tool.py As part two of the project I needed to put my plan in action and so that required a bit revision. Instead of writing in the code in C++ or Node I opted to pick python instead as this was a recommendation from our professor if we had used the language before because it is very good at parsing which is essentially what this project needs to do the most in order to get the expected output. I sadly had never used python before so I found myself learning a lot on the fly, luckily python is some what of an easy language to grasp but having to learn some new syntax and and other tools that python offers was some what harder to do. I do like python in the sense that you can just start coding not really to much third party installs required. I found part two of this project to be very hard. I started off with the idea that I was going to take some tester code that our professor has provided for us and dissect...

Project Plan (Part 2)

 After doing some research I have some ideas of how I am thinking to plan and the code. I will put some steps in point form in order to make it easy to follow. github:  https://github.com/a-martin94/Spo600 - As we need to run choose between three different versions at run time I will be making a few functions that are able to tell what system that it the code is about to run on. - the first function will be for sve2 implementation. I am still trying to find the way to approach the logic and reviewing more notes and open source documents.  - The second function will be for the sve implementation, and again trying to find best way to code this and what arguments to pass in. - The third will be for the sve/sve2 implementation again the same comments above. - Next I will need to make a resolver function that will have the logic to choose what implementation will be run depending on the machine its being executed on. I am looking into bit fields and how to properly use them in...

Project Plan

 I don't no why it would not show up (I just came back to blog more) Project Plan This is going to be a break down of my plan for SPO600 final project, for this project we are going to be doing a proof of concept to test i func procedures " The goal for this project is to produce a proof-of-concept tool that will take code that meets specific conditions and automatically build it with ifunc capability to select between multiple, autovectorized versions of a function, to take advantage of the best SIMD implementation available on the CPU on which the code is running. " (Chris Tyler) To test the solution some code has been provided  https://github.com/ctyler/spo600-fall2022-project-test-code For this task I am going to be using JSnode for the code and plan to write it on VS code or Atom. I am using these languages as I am familiar with that set up. We have some limitations to the project which are the following: This tool only operates on aarch64 systems There are three ta...

Lab 5

Image
 For the lab we are tasked with mongering and making a prediction of the relative performance of each scaling algorithm. Using both aarch64 and x86 we first need to unpack the code using tar. I started with aarch64 first.

Lab 4 (x86)

Image
 For this lab we were tasked with doing the same loop problem from the aarch64. How ever me being the genius I am I tried to switch to the x86 well still on the Israel server not even thinking to switch to the Portugal one. So After just getting that sorted out I can now attempt to build the code.  Also unpacking the file was needed again as you can see here:  I have so far got it loop the hello world out but just need to change it to loop for the ascii message and print the number here is my code so far min = 0                         /* starting value for the loop index; note that this is a symbol (constant), not a variable */ max = 10                        /* loop exits when the index hits this number (loop condition is i<max) */ _start:     mov     $min,%r15           /* loop index */ lo...

LAB4 (Aarch64)

Image
 For this lab we are tasked with editing some code provided by the prof Chris Tyler. We needed to create a loop in order for the word loop to be printed 30 times. This lab was extremly hard for me as I had to re learn a lot of the commands and it was very time consuming, but was cool to learn. For starters I did not know that to extract the package and to make files was confusing. One of the most time consuming parts was trying to run the code each time and debug it. 1. Review, build, and run the aarch64 assembly language programs. Take a look at the code using  objdump -d  objectfile  and compare it to the source code. First we had to extract the package  tar zxvf fileNameHere.tgz here is the source code provided for the aarch64 task For the aarch64 part of this lab we had to get the word "loop #" to loop ten times and show the count s it looped. This task was seemed easy but became very hard, trying to understand syntax and how the compiler worked. For a long...

LAB 3 PART 3

 Now that was a lot of code! as you can see I have had to separate the code into three posts. This program works by first executing two sub routines that are going to initialize the memory (init, loop)  which will set the game state and the loop is going to call the subroutines of the program and execute them in order before looping back and and repeating. I like the way this program is broken down into different sub routines like functions it makes it easier to follow. I Changed the controls from the original and also added a way to add a second value called SnakeLengthTwo it increased the size by double but the issue was that when it was added is that from where the last apple was that was eaten the tail value stays at that location in memory and the snake moves but just grows at a rapid rate. updateSnake:   ldx snakeLength   ldx snakeLengthTwo //this will make the snake tail stay at the same spot   dex   txa updateloop:   lda snakeHeadL,x   sta...

LAB 3 PART 2

 loop:   jsr readKeys   jsr checkCollision   jsr updateSnake   jsr drawApple   jsr drawSnake   jsr spinWheels   jmp loop readKeys:   lda sysLastKey   cmp #ASCII_i   beq upKey   cmp #ASCII_l   beq rightKey   cmp #ASCII_k   beq downKey   cmp #ASCII_j   beq leftKey   rts upKey:   lda #movingDown   bit snakeDirection   bne illegalMove   lda #movingUp   sta snakeDirection   rts rightKey:   lda #movingLeft   bit snakeDirection   bne illegalMove   lda #movingRight   sta snakeDirection   rts downKey:   lda #movingUp   bit snakeDirection   bne illegalMove   lda #movingDown   sta snakeDirection   rts leftKey:   lda #movingRight   bit snakeDirection   bne illegalMove   lda #movingLeft   sta snakeDirection   rts illegalMove:   rts checkCollision:   jsr checkAppleCollision   js...

LAB 3 PART 1

 For this lab we were tasked with creating a simple game or using open source code and adding some of our own code to it. The lab is based on the 6502 assembler and is written in assembly language, for this task I found a classic game of snake that is written in assembly and it is a little complex but I was able to follow it and make a few changes.  Green highlight is my code and edits, Blue code is important to user input and movements Source material:  https://skilldrick.github.io/easy6502/#snake THE CODE ;  ___           _        __ ___  __ ___ ; / __|_ _  __ _| |_____ / /| __|/  \_  ) ; \__ \ ' \/ _` | / / -_) _ \__ \ () / / ; |___/_||_\__,_|_\_\___\___/___/\__/___| ; Change direction: W A S D define appleL         $00 ; screen location of apple, low byte define appleH         $01 ; screen location of apple, high byte define snakeHeadL  ...

Lab 2 part 2

Image
  Modifying the Code Change the code to fill the display with a different colour on each page (each "page" will be one-quarter of the bitmapped display). For this part of the Lab we were tasked to change the 4 pages to different colors. The way that i accomplished this was through research and finding and testing a command called "ASL" this means arithmetic shift left. Once this is set after the done the page bne it will shift the color in memory and print the even color. There is another way to perform this task by making individual for loops and changing the color value. I found this way to be easy and cool once understood.       lda #$00 ; set a pointer in memory location $40 to point to $0200 sta $40 ; ... low byte ($00) goes in address $40 lda #$02 sta $41 ; ... high byte ($02) goes into address $41 lda #$05 ; colour number ldy #$00 ; set index to 0 loop: sta ($40),y ; set pixel colour at the address (pointer)+Y iny ; incr...

Lab 2

Image
 For this post I will be discussing lab 2 of SPO600, This is lab is testing and modifying some code based on the 6502 assembler which can be found on this link  http://6502.cdot.systems/ .  I will be testing the performance on the code and seeing how much memory it takes and the total run time. Calculating Performance I used a spread sheet in order to calculate the total time it will take to execute the program in ms and sec. The total time is not to long but it could be cut down. The fastest way I am thinking would be to cut down on the loops but I could not get it to work with out an error. sta $41 ; ... high byte ($02) goes into address $41 lda #$07 ; colour number ldy #$00 ; set index to 0 loop: sta ($40),y ; set pixel colour at the address (pointer)+Y iny ; increment index bne loop ; continue until done the page (256 pixels) inc $41 ; increment the page bne loop ; continue until done all pages I was able to decrease the team by re...

SPO600 Lab1

Image
 Lab 1 for SPO600: I have picked node.js and openSSL, the reason I have picked both of these is that I have had the chance to work with Node in the past and found openSSL to be kind of cool never learned about it till I researched it. 1.) Node.js is an open software package that uses permissive MIT license for the main library. More information can be found here \ https://snyk.io/learn/node-js-licensing-and-security-risks/ . Node.js accepts contributions from developers by using Github, here developers can add patches to the software. This link will redirect to the Github page  https://github.com/nodejs/node . There is a total 3,131 contributors to this software, a user by the name mhdawson  seems to be the lead of the project and others can post and patch as well. There is a link here  https://github.com/nodejs/node/blob/main/CONTRIBUTING.md#pull-requests  that will allow you to apply to become a contributor to the project.     One of the code pa...