Tuesday, September 29, 2009
Microprocessors 9-28-09
The updated and working LED program Dr. Pollard wrote is located here: the only difference is nop's
The link to the in class exercise is here:
Basically what we reviewed was receiving data in the RX FIFO, as well as spitting that data back out in the TX FIFO
Friday, September 25, 2009
Microprocessors 9-24-2009
Things to remember:
a 1 written to the offset of 4 to the memory location of the LED's tells the DDR it's in "input mode" a 0 written tells it its in output mode.
Writing to the DREG will turn the LED's On or Off once you put the register in output mode.
Note: the above program wasn't working in class, I'll be posting an updated version tonight that works (somewhat different then the version we did in class)
Here is the updated file that works, here:
One thing to note is that you'll want to copy and paste the contents of these files into a new file, I had issues getting it to compile until I just copied over.
DDR means Data Direction Register.
DREG means Data Register.
Sunday, September 20, 2009
Microprocessors 9-17-2009
The example below takes a list of 1000 numbers generated from a random number generator from 0-10,000, then in groups of 0-999, 1000,-1999, 2000....
# in class 9_17
# work on comparison and branch commands
.org 0x100
# clear out registers
li r1, 0
li r2, 0
li r3, 0
li r4, 0
li r5, 0
li r6, 0
li r7, 0
li r8, 0
li r9, 0
li r10, 0
li r11, 0x200
li r12, 1000
mtctr r12
loop: lhz r13, 0(r11)
cmpi 3, 0, r13, 999 # P303 for cmpi
bt 13, chk2 # bit 12 is less then, 13 is greater then, bit 14 is equal, 15 summary overflow
addi r1, r1, 1
b nextv
chk2: cmpi 3, 0, r13, 1999
bt 13, chk3 # bit 12 is less then, 13 is greater then, bit 14 is equal, 15 summary overflow
addi r2, r2, 1
b nextv
chk3: cmpi 3, 0, r13, 2999
bt 13, chk4 # bit 12 is less then, 13 is greater then, bit 14 is equal, 15 summary overflow
addi r3, r3, 1
b nextv
chk4: cmpi 3, 0, r13, 3999
bt 13, chk5 # bit 12 is less then, 13 is greater then, bit 14 is equal, 15 summary overflow
addi r4, r4, 1
b nextv
chk5: cmpi 3, 0, r13, 4999
bt 13, chk6 # bit 12 is less then, 13 is greater then, bit 14 is equal, 15 summary overflow
addi r5, r5, 1
b nextv
chk6: cmpi 3, 0, r13, 5999
bt 13, chk7 # bit 12 is less then, 13 is greater then, bit 14 is equal, 15 summary overflow
addi r6, r6, 1
b nextv
chk7: cmpi 3, 0, r13, 6999
bt 13, chk8 # bit 12 is less then, 13 is greater then, bit 14 is equal, 15 summary overflow
addi r7, r7, 1
b nextv
chk8: cmpi 3, 0, r13, 7999
bt 13, chk9 # bit 12 is less then, 13 is greater then, bit 14 is equal, 15 summary overflow
addi r8, r8, 1
b nextv
chk9: cmpi 3, 0, r13, 8999
bt 13, chk10 # bit 12 is less then, 13 is greater then, bit 14 is equal, 15 summary overflow
addi r9, r9, 1
b nextv
chk10: addi r10, r10, 1
b nextv
nextv: addi r11, 0x2
bdnz loop
nop
here: b here
Oddly enough, the spacing on the blog doesn't take so all the lines are left aligned, sorry.
Wednesday, September 16, 2009
Speeding things up
For example, let's say you want to add a list of files to a filebox, that down the line the user will be using to open the files and use. There are a couple of things to think about here, we can load the files in the filebox and just let the user have at them, this can pose a potential problem if the file doesn't exist when you try to open it, rather then check each file as you add it to the file box, and make sure it exists first. You can do the check on each file as you attempt to open it, this way if the user only ends up using 5 files out of the entire box for this duration you only check to see that 5 files exist, rather then say the 100 other ones that they didn't use.
Another thing to do is let the user attempt to do certain actions if the action succeeds then continue on your way, but if the action fails rather then posting an error and stopping the program essentially, you just notify the user hey that action didn't work but here is what we're doing to recover from it, this thought alone can save you boatloads of time as well, rather then having to check each corner case, allow the user/program to do something that might cause an error, and simply know how to recover.
Aside from optimizing your code to reduce the number of checks how are you speeding things up for the end user?
Wednesday, September 9, 2009
IT lockdown
Check out the below link
http://portableapps.com/
I'm using notepad++ rather then notepad and vim!!!
Also I installed Firefox, winmerge and putty.
So why the collection of files?
Working out of my pendrive and compiling and doing other work is rather slow and doesn't work well in these labs.
Using WinMerge makes sure that and changes I make to the local copy can be verified and merged into the ones on my pen drive (So what I like to keep my old files)
Using Notepad++ is just nicer then using regular old notepad, and well you cant actually install notepad++ on the local machines so this gets around it.
Of course firefox, because I'm not an IE fan at all
and putty incase I have my server at home on and i want to SSH into it (not sure if SSH is blocked on these machines yet.
I can't even us the windows key and R to run the calculator... it just says that that has been locked down, want to know what day it will be on the 24th of december, no such luck looking at the calendar is locked down as well....terrible!!!
I'll update this post as I come up with more "workarounds" for this lab,
Friday, September 4, 2009
Alien Language
If you don't want to see the solution (in perl) don't look at my code, but here it is I'll explain it below.
Quick overview of the problem:
The first line of input contains 3 integers, L, D and N separated by a space. D lines follow, each containing one word of length L. These are the words that are known to exist in the alien language. N test cases then follow, each on its own line and each consisting of a pattern as described above. You may assume that all known words provided are unique.My solution:
while (chomp($read_line = <>))
{
@settings = split(/\s/, $read_line);
for ($i = 0; $i < $settings[1]; $i++)
{
chomp($item = <>);
push(@items, $item);
}
for ($i = 0; $i < $settings[2]; $i++)
{
chomp($testCase = <>);
$counter = 0;
foreach $word (@items)
{
$testCase =~ s/\(/\[/g;
$testCase =~ s/\)/\]/g;
if ($word =~ m/$testCase/i)
{
$counter++;
}
}
$caseNumber = $i + 1;
print "Case #$caseNumber: $counter\n";
}
}
Basically we grab the first line, and look for the 3 numbers, grab the second one to determine the number of lines we drop down for our test cases, then the 3rd number to grab the actual tests, then we just make it a regular expression, worked pretty quick, I know at least on the large dataset I had over 3:41 remaining, (maybe more) from when I downloaded it, to when I completed the upload. Worked pretty quick
Wednesday, September 2, 2009
Google Books
Which led me to finding a particular example of a site using javascript to generate a little table of books, after looking at it, I can simply use that java scripting to generate the link to books, I decided to try the book we're using in class and what do you know, there is a limited preview here:
That's kinda neat, so basically a guy could write a script that grabs all the isbns from a particular csv file and format a page that looks something like this.
Test Page
Take a look at the source and see what you can do with it.
Source Pulled from this site: Google Example Dynamic Links
Tuesday, September 1, 2009
ECE 321 Electronics
Analysis and Design of Digital Integrated Circuits
ECE 344: Microprocessors
The example below takes a list of 1000 numbers generated from a random number generator from 0-10,000, then in groups of 0-999, 1000,-1999, 2000....Microprocessors 9/24
Things to remember:Microprocessors 9/28
a 1 written to the offset of 4 to the memory location of the LED's tells the DDR it's in "input mode" a 0 written tells it its in output mode.
In class today we reviewed the LED problem from last class, then we moved on to rs232 programming.Microprocessors 10/1-10/7
Here are the in class examples that we've covered in class since the 28thHow to Microprocessor
For someone that walks into this lab unprepared it can look like a lot, but for some that's a challenge and for other's that's an active barrier, rather then choosing to be prepared for it, you just walk through and hope for the best.Design and Programming..a Love affair
If you design your project well, looking at all possibilities up front without coding a single thing you can catch some problems up front that you may run into. One of those may cause messy or unneeded code! That's again the beauty of the artist they can choose whether they want to keep repainting the exact same thing or really go out there and paint something new!Concepts, the Leonardo of Programming
If you don't understand "what" you're trying to do, it's going to be very difficult to write code and/or tests for it.Syntax
Syntax doesn't require a whole lot of explaining. Mainly get a good source of information that you can understandTroubleshooting
In comes typical troubleshooting without a debugger, normally you stick some print statements in there and wait for the print fest to begin.