ENGR 433 -  HW 8 2024 Spring

Name: Ian Van Horn
Email: imvanhorn1@gmail.com
HW 8

This homework fabricates a microcontroller on the BAYSYS 3. The embedded soft core is PicoBlaze


** Only original assembly code is shown, all code regarding picoblaze, and all code given for tasks is copied directly from the tutorial. Port declarations are needed so these are shown.


Task 1: Turn on and off LEDs corrosponding to switches. (10 points).


Figure 1-1: Port declarations

The brunt work of creating picoblase was copied form the website. All that is needed to add are port declarations for the i/o tools being used.
For the assembly code, inputs are grabbed from the switches and written to s0 then s0 is defined as te output. Then the program jumps and does it again.



Video 1-1: Demonstration of implimentation of  Pico Blaze to turn onn and off lights



Task 2: The square problem (10 points).

Downloaded assambly code was used for this task

Video 2-1: Square problem demonstration


Task 3: Add 0x13 (10 points).

The value from the switches is interprited as binary. 13 is hex is added then the result is displayed


Video 3-1: Demonstration of addind 0x13 to the value on the switches

Task 4: Using a mask (10 points).



Video 4-1: Using a mask to always set lowest 2 bits

Task 5: Right Shift one Bit(10 points).

The input is ored with a mask with 11 in the two LSBs. This means these 2 bits will always be high

Vidoe 5-1: Shift right one bit demonstration

Task 6: Using Jump, return and load(10 points).

First, the jump to TESTING was replaced with a call



Video 6-1: Using a call instead of a return
This works as expected, any time testing is called it returns to the call line after the subroutiene is finished. Immdietly after the call line the output is set to s2 which is 5. For this reason 5 is always displayed.



Video 6-2: Demo with code form tutorial

Now the program never returnes if TESTING is called so the program either displays 5 or 6


Task 7: Multipule subroutines(10 points).


Figure 7-1: Results form website code
Conditional jumps are used. The input number is tested in all bits. If is is  non zero count is incrimented and the number is deincrimented. If it is zero than the output is set to the count.

Task 8: Substitute for compare (10 points).



Figure 8-1: Compare substitution
Test checks certian bits of a register for 0's. Compare directly sees if the register is equal to another number.




Figure 8-2: Same result as 7-1 but with compare

Task 9: display number fo flipped switches in binary (20 points).



Figure 9-1: Code

The LSB is checked. If it is a 1 add 1 to the counter. If is is 0 do nothing. Then shift right. Repeat 8 times then display count


Video 9-1: Demonstration




Conclusion: The softcore implimentation was very interisting. For the most part the code was given and the tutorial was straight forward. But the code for making picoblaze is so much more advanced than other projects even somthing as simple as port declarations was confusing.