Showing posts with label Hardware. Show all posts
Showing posts with label Hardware. Show all posts

Friday, May 30, 2008

Everything Back to Normal

All of the issues from last weekend have been resolved...as of last weekend. I've still been out of it, so this post is late:

  • Paladin: With the PSU replaced, it runs just fine with the 8800 GS, albeit more loudly than before. I finally got around to setting up the 32-bit chroot for compiling libraries needed for 32-bit programs in x86 mode.
  • Blueflash: I can't even remember if I mentioned this, but a world upgrade on Blueflash brought in OpenRC. This caused the init system to fail spectacularly, to the point where I had to start all services manually with an Awk script, and have the system shut down without stopping them. I did ask for help at the Gentoo forums, but ended up just reinstalling the entire system. Thankfully, I keep /home mounted in a separate partition and managed to save nearly all of my settings. The install took 3 days to compile everything, and fixed an issue where my system HW clock woludn't get set on shutdown: it was a kernel config change. Now, it's as though nothing has changed, except everything's up-to-date.

It's good to have things back to normal.

Friday, May 23, 2008

eVGA GeForce 8800 GS Kills Paladin

My father gave me a GeForce 8800 GS video card today. I was overjoyed, since that meant that both of my primary desktops gets a discrete card. Unfortunately, things didn't work out so well.

First off, I put the card into Superflex, the primary desktop with an Athlon X2, and found out the card prevents it from POSTing. After discussing it with my father, I decided to put the 8600 back into the machine. Fortunately, it went back to the way it was before.

Paladin, the secondary desktop with a Phenom X4, wasn't so lucky. At first, I put the 8600 from Superflex in there, and it worked just fine without a hiccup. After I put the 8600 back into Superflex, I put the 8800 GS in there. It booted okay, and got to loading the kernel and starting init. However, when it came to udev's probing devices, the machine powered off, leaving the power light on. Even after taking the card out and switching it back to integrated (GeForce 6150) graphics, it still does the same, leaving me without Paladin.

I'm not sure what to do about this, but I suspect the power supply. Until I go out and buy one, there's nothing I can do.

Friday, May 9, 2008

iPod Video Back/粉雪は忘れ薬 - 中島みゆき

My iPod Video is back, and I've already put RockBox and my songs back on it. Unfortunately, I've lost a few scripts I'll have to rewrite, but it likely won't be too much of a pain. If I recall, I've already put some of them up here. The new default RockBox theme is pretty nice, but it needs some work before I can use it without being a bit annoyed. I'll likely fix it tonight.

I've noticed that I haven't posted much lately, and this is mainly because it's the week of midterms and because of the rut my life is in right now. Here's a song (粉雪は忘れ薬: こなゆきはわすれぐるし, konayuki wa wasuregusuri, "Powdered Snow is Forgetting Medicine") that I've been listening to a lot on my 4G iPod while the Video's been out of service:

忘れなけりゃならないことを
忘れながら人は生きるよ
無理して笑っても 無理してふざけても
意地悪な風 意地悪な雨
忘れさせて優しい日々を
忘れさせて楽しい人を
足音? 車の停まる音?
間違えながら待ってしまうから
粉雪は忘れ薬
すべての悲しみ消してくれるよ
粉雪は忘れ薬
すべての心の上に積もるよ

遠い町を訪ねてみても
1人きりで暮らしてみても
忘れるための無理は どこかに隙がある
よみがえる風 よみがえる雨
忘れさせて 古い約束
忘れさせて 古い口癖
覚えておこうとしないのに
何かのはずみ 思い出して泣ける
粉雪は忘れ薬
すべての心の上に積もるよ
粉雪は忘れ薬
些細なことほど効き目が悪い

粉雪は忘れ薬
寂しい心の上に積もるよ
粉雪は忘れ薬
すべての心の上に積もるよ
粉雪は忘れ薬
すべての心の上に積もるよ
すべての心の上に積もるよ

Monday, May 5, 2008

iPod 4G Lives Again!

As it turns out, the old RockBox on my iPod 4G was dead, but with some work I was able to install the newest one, get rid of the iPodLinux bootloader (which couldn't find RockBox except via the old method which doesn't work anymore), and install a new RockBox loader. It's more convenient this way, anyway. What's more, I'm glad to have my old iPod up and running, without any loss of data.

Now time to wait for the repairs on my new one.

Friday, May 2, 2008

Indeed it is Down

Well, it looks like the Video is actually down. I accidentally went through the online service procedure, and I'll have to do it via mail rather than the nearby Apple Store. At least I know my 4G is still operating just fine.

iPod Video Down

Well, it looks like my iPod Video is dead. It died in even less time than my old 4G iPod did, and the 4G was a refurbished model. Unfortunately, I'll have to send it in and will have to recreate all of the Perl scripts and playlists on it, other than the scripts posted here. I was thinking about backing it up yesterday too, but never got around to it. Oh, the irony. What's really strange is that my 4G iPod did the same thing (very often) before I installed RockBox on it, and the Video does it even with RockBox.

It wouldn't be so bad if my 4G iPod weren't full (it still runs, I know that), and if my iPod Touch would stop corrupting files on transfer (and weren't so small). Hopefully I'll get a replacement soon, if I can't figure out how to awaken it from its death.

Maybe that's Apple's business model: sell things that break often and regularly and make up for it with decent technical support and warranties.

Saturday, April 26, 2008

Linuxfest Northwest!

Icy Tux

I just got back from LinuxFest Northwest today, and boy was it a blast. I took the Pogo Express (this year an articulated Gray Lines bus) to BTC, and even the bus ride was a lot of fun. I've never found myself so social. I attended talks on networking protocols, natural language processing, and Jabber. For the last session, I even got to explore the OLPC XO-1 with friends, using its mesh networking features.

Icy Tux

While there, I also picked up large amounts of mainly free things, but a few things that cost money. For $30, I also bought this at a used parts section of the meet, and it looks like it turns on, but I can't do much with this until I get the proper adapters.

I can say I had fun, and I can't wait until next year.

Sunday, April 20, 2008

New PC Continued

As it turns out, the machine isn't overheating at all; it's staying below 40 C consistently. However, rebuilding GCC fixed the segfaults in the compiler, but the machine still hardlocks when faced with too much processing stress. Maybe this has to do with the infamous TLB bug present in the CPUs, but it's hard to say.

At the moment, I'm upgrading to GCC 4.3 on the machine, which has some Phenom-specific flags that can be used.

Saturday, April 19, 2008

New PC: Phenom

My father gave me a brand new computer today, with a Phenom 9500 in it. It's a great machine, and I'm very happy to receive it. The case is pretty cool, too: the entire front is a grille, even the covers to the drive bays.

Although I'm happy with it, things started to turn bad when I began compiling a Gentoo install. It seemed to run well at first, until I got to larger packages, such as Perl and Glibc. Packages began to fail with "internal compiler error: segmentation fault" and mentioning that these errors aren't reproducible, and that they're likely hardware issues (I've had experience like this before, with both overclocking and overheating, but this CPU isn't overclocked to my knowledge). I found out that these problems are reduced by setting the number of parallel Make jobs to one or two, but that increases build time. Hopefully I'll find out the problem if I can ever get a system running.

Sunday, March 23, 2008

Laptop's Down Again

Well, it looks like my laptop decided to stop working again. Since the last time it worked, I only put it in its case; nothing more. That thing's been extremely unreliable, with an MTBF of mere months. Because it keeps going down, I'm seriously considering buying a new one this Summer.

This would've potentially ruined my plans tomorrow, if my dad were right about the time the repair place opened. My parents weren't fazed by the potential of it ruining my plans, either.

Saturday, March 15, 2008

processor.py

In my Digital Design course, we did quite a bit involving the MIPS2000 CPU, such as designing its controller. It seemed interesting, so I decided to implement a pseudo-processor using Python and its higher-level data types.

processor.py

from copy import deepcopy
from math import pow
from sys import stdin, stdout, stderr, argv
BITS = 9;
class processor(object):
class executor(object):
def __init__(self, cache, memories):
self.cache = cache
self.memories = memories
self.pc = 0
self.initial = 16
self.halt = False
self.instructions = {
'stoi' : self.stoi,
'sto' : self.sto,
'or' : self.lor,
'and' : self.land,
'add' : self.add,
'addi' : self.addi,
'sub' : self.sub,
'lw' : self.lw,
'lwi' : self.lwi,
'sw' : self.sw,
'swi' : self.swi,
'jump' : self.jump,
'jumpo' : self.jumpo,
'cjump' : self.cjump,
'cjumpi' : self.cjumpi,
'cjumpo' : self.cjumpo,
'imc' : self.imc,
'pass' : self.ps,
'halt' : self.haltp
}
self.errstring = 'Invalid Instruction at 0x%%.%dx\n' % int(BITS / 4);
def run(self, instruction):
if isinstance(instruction, tuple) and (instruction[0] in self.instructions):
name = instruction[0]
args = instruction[1:len(instruction)]
self.instructions[name](args)
else:
stderr.write(self.errstring % self.pc)
self.pc += 1
def stoi(self, args):
"stoi val out"
self.cache[args[1]] = args[0]
self.pc += 1
def sto(self, args):
"sto in out"
self.cache[args[1]] = self.cache[args[0]]
self.pc += 1
def lor(self, args):
"or in1 in2 out"
self.cache[args[2]] = self.cache[args[0]] | self.cache[args[1]]
self.pc += 1
def land(self, args):
"and in1 in2 out"
self.cache[args[2]] = self.cache[args[0]] & self.cache[args[1]]
self.pc += 1
def add(self, args):
"add in1 in2 out"
self.cache[args[2]] = self.cache[args[0]] + self.cache[args[1]]
self.pc += 1
def addi(self, args):
"addi in1 imm out"
self.cache[args[2]] = self.cache[args[0]] + args[1]
self.pc += 1
def sub(self, args):
"sub in1 in2 out"
self.cache[args[2]] = self.cache[args[0]] - self.cache[args[1]]
self.pc += 1
def lw(self, args):
"lw memlocreg out"
memloc = args[0]
out = args[1]
if isinstance(self.memories[self.cache[memloc]], list) and len(self.memories[self.cache[memloc]]) == 2:
self.cache[out] = deepcopy(self.memories[self.cache[memloc]][0])
self.memories[self.cache[memloc]][1] = True
else:
self.cache[out] = deepcopy(self.memories[self.cache[memloc]])
self.pc += 1
def lwi(self, args):
"lwi memloc out"
memloc = args[0]
out = args[1]
if isinstance(self.memories[memloc], list) and len(self.memories[memloc]) == 2:
self.cache[out] = deepcopy(self.memories[memloc][0])
self.memories[memloc][1] = True
else:
self.cache[out] = deepcopy(self.memories[memloc])
self.pc += 1
def sw(self, args):
"sw in memlocreg"
inp = args[0]
memloc = args[1]
if isinstance(self.memories[self.cache[memloc]], list) and len(self.memories[self.cache[memloc]]) == 2:
self.memories[self.cache[memloc]][0] = deepcopy(self.cache[inp])
self.memories[self.cache[memloc]][1] = True
else:
self.memories[self.cache[memloc]] = deepcopy(self.cache[inp])
self.pc += 1
def swi(self, args):
"sw in memlocreg"
inp = args[0]
memloc = args[1]
if isinstance(self.memories[memloc], list) and len(self.memories[memloc]) == 2:
self.memories[memloc][0] = deepcopy(self.cache[inp])
self.memories[memloc][1] = True
else:
self.memories[memloc] = deepcopy(self.cache[inp])
self.pc += 1
def jump(self, args):
"jump address"
self.pc = args[0]
def jumpo(self, args):
"jump addressoffsetreg"
self.pc += args[0]
def cjump(self, args):
"cjump cond addressreg, will jump when condition is FALSE"
if not self.cache[args[0]]:
self.pc = self.cache[args[1]]
else:
self.pc += 1
def cjumpi(self, args):
"cjump cond address, will jump when condition is FALSE"
if not self.cache[args[0]]:
self.pc = args[1]
else:
self.pc += 1
def cjumpo(self, args):
"cjumpo cond address, will jump when condition is FALSE"
if not self.cache[args[0]]:
self.pc += self.cache[args[1]]
else:
self.pc += 1
def imc(self, args):
"pass"
self.initial = self.cache[args[0]]
def ps(self, args):
"pass"
self.pc += 1
def haltp(self, args):
"halt"
self.halt = True
def __init__(self):
self.pc = 0
self.cache = [0] * 16
self.memories = [0] * int(pow(2, BITS))
self.asiptr = 0
self.initial = 16 # defaults to loading at 16
self.io = {
'pread' : (int(pow(2, BITS) - 5), 'r'), # Reads instruction file
'fread' : (int(pow(2, BITS) - 4), 'r'), # Reads byte of any file as integer
'read' : (int(pow(2, BITS) - 3), 'r'),
'write' : (int(pow(2, BITS) - 2), 'w'), # Writes integer value with spaces
'cwrite' : (int(pow(2, BITS) - 1), 'w') # Writes character
}
for i in self.io.values():
self.memories[i[0]] = [0, False]
self.file = None
if len(argv) >= 2:
self.file = open(argv[1], 'rb')
self.asmd = self.asi(self.file.readlines())
self.file.seek(0)
for i in ['pread', 'fread']:
#print 'INIT: %s: %s' % (i, str(self.io[i]))
#print 'INIT:', self.memories[self.io[i][0]]
self.memories[self.io[i][0]][0] = self.handler(i)
#print "\t-> %d: %s" % (self.io[i][0], self.memories[self.io[i][0]])
self.memories[self.io[i][0]][1] = False
else:
self.asmd, self.file = None, None
self.boot()
def boot(self):
asm = [
('stoi', 0, 0), # Gives us a workable zero
('stoi', 16, 1), # Gives us the initial address for program execution
('sto', 1, 2), # Initializes the counter for loading the program
('pass',), # A label to go to
('lwi', self.io['pread'][0], 3), # Loads instruction word from I/O
('cjump', 3, 1), # Jumps to beginning of program when no operator returned, will start program
('sw', 3, 2), # Loads instruction word into memory
('addi', 2, 1, 2), # Increments the address to copy to
('jump', 3), # Jumps to the label address
('halt',) # Halt at failure
]
self.memories[0:len(asm)] = asm
#for i in range(508, 512):
#print '%d: %s' % (i, self.memories[i])
self.execute = self.executor(self.cache, self.memories)
#for i in range(508, 512):
#print '%d: %s' % (i, self.memories[i])
#print "BOOT:", self.memories
while not self.execute.halt:
if self.pc < len(self.memories):
self.execute.run(self.memories[self.pc])
self.pc = self.execute.pc
#print self.cache
#print '%d, %s' % (self.pc, str(self.memories))
self.initial = self.execute.initial
self.check()
else:
self.execute.run(('halt',))
print '\n',self.cache
print '%d, %s' % (self.pc, str(self.memories))
def check(self):
#for i in range(508, 512):
#print '%d: %s' % (i, self.memories[i])
for i in self.io.keys():
#print "CHECK:", self.memories
#print '%s: %s' % (i, str(self.io[i]))
#print self.memories[self.io[i][0]]
if self.io[i][1] == 'r' and self.memories[self.io[i][0]][1]:
#print "\tBEFORE:", self.memories[self.io[i][0]]
self.memories[self.io[i][0]][0] = self.handler(i)
self.memories[self.io[i][0]][1] = False
#print "\tAFTER:", self.memories[self.io[i][0]]
elif self.io[i][1] == 'w' and self.memories[self.io[i][0]][1]:
self.handler(i, self.memories[self.io[i][0]][0])
self.memories[self.io[i][0]][0] = 0
self.memories[self.io[i][0]][1] = False
#print '%s: %s' % (i, str(self.io[i]))
#print self.memories[self.io[i][0]]

def handler(self, handle, value = ''):
if handle == 'read':
return ord(stdin.read(1))
elif handle == 'write':
stdout.write('%d ' % value)
elif handle == 'cwrite':
stdout.write(chr(value))
elif handle == 'fread':
if self.file:
ret = self.file.read(1)
if ret:
return ord(ret)
else:
return 0
else:
stderr.write('No file open!')
return 0
elif handle == 'pread':
#print 'LOADING FROM PROGRAM'
if self.asmd and self.asiptr < len(self.asmd):
ret = self.asmd[self.asiptr]
self.asiptr += 1
else:
ret = 0
return ret
def asi(self, lines):
vars = {}
outlines = []
ctr = 1
linectr = self.initial
print 'INITIAL:', linectr
for i in lines:
if len(i) and i[0:1] != '#' :
if i[len(i) - 2] == ':':
print '%s -> %d' % (i[0:len(i) - 2], linectr)
vars[i[0:len(i) - 2]] = linectr
linectr += 1
elif len(i.split()):
linectr += 1
linctr = self.initial
for i in lines:
if len(i) and i[0:1] != '#':
if i[len(i) - 2] == ':':
#print '%s -> %d' % (i[0:len(i) - 2], linectr)
#vars[i[0:len(i) - 2]] = linectr
#outlines += [('pass',)]
outlines += [('pass',)]
linectr += 1
else:
data = i.split()
inst = False
tmp = ()
for d in data:
if len(d):
if not inst:
tmp = (d,)
inst = True
else:
if not(d[0] == '(' and d[-1] == ')'):
if not d in vars:
vars[d] = ctr
ctr += 1
tmp += (vars[d],)
else:
tmp += (int(d[1:len(d) - 1]),)
if len(tmp):
outlines += (tmp,)
linectr += 1
print outlines
return outlines
test = processor()

asm.test

A test assembly file.

#stoi (10) A
#stoi (20) B
#stoi (50) D
#add A B C
#sub C D Q
#swi Q (510)

stoi (55) B
foo:
lwi (508) A
cjumpi A end1
swi A (511)
sw A B
addi B (1) B
jump foo
end1:
lwi (508) A
cjumpi A end2
swi A (511)
sw A B
addi B (1) B
jump end1
end2:

halt

Sample run

% python processor.py test.asm
INITIAL: 16
foo -> 17
end1 -> 24
end2 -> 31
[('stoi', 55, 1), ('pass',), ('lwi', 508, 2), ('cjumpi', 2, 24), ('swi', 2, 511), ('sw', 2, 1), ('addi', 1, 1, 1), ('jump', 17), ('pass',), ('lwi', 508, 2), ('cjumpi', 2, 31), ('swi', 2, 511), ('sw', 2, 1), ('addi', 1, 1, 1), ('jump', 24), ('pass',), ('halt',)]
#stoi (10) A
#stoi (20) B
#stoi (50) D
#add A B C
#sub C D Q
#swi Q (510)

stoi (55) B
foo:
lwi (508) A
cjumpi A end1
swi A (511)
sw A B
addi B (1) B
jump foo
end1:
lwi (508) A
cjumpi A end2
swi A (511)
sw A B
addi B (1) B
jump end1
end2:

halt

[0, 300, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
32, [('stoi', 0, 0), ('stoi', 16, 1), ('sto', 1, 2), ('pass',), ('lwi', 507, 3), ('cjump', 3, 1), ('sw', 3, 2), ('addi', 2, 1, 2), ('jump', 3), ('halt',), 0, 0, 0, 0, 0, 0, ('stoi', 55, 1), ('pass',), ('lwi', 508, 2), ('cjumpi', 2, 24), ('swi', 2, 511), ('sw', 2, 1), ('addi', 1, 1, 1), ('jump', 17), ('pass',), ('lwi', 508, 2), ('cjumpi', 2, 31), ('swi', 2, 511), ('sw', 2, 1), ('addi', 1, 1, 1), ('jump', 24), ('pass',), ('halt',), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 35, 115, 116, 111, 105, 32, 40, 49, 48, 41, 32, 65, 10, 35, 115, 116, 111, 105, 32, 40, 50, 48, 41, 32, 66, 10, 35, 115, 116, 111, 105, 32, 40, 53, 48, 41, 32, 68, 10, 35, 97, 100, 100, 32, 65, 32, 66, 32, 67, 10, 35, 115, 117, 98, 32, 67, 32, 68, 32, 81, 10, 35, 115, 119, 105, 32, 81, 32, 40, 53, 49, 48, 41, 10, 10, 115, 116, 111, 105, 32, 40, 53, 53, 41, 32, 66, 10, 102, 111, 111, 58, 10, 108, 119, 105, 32, 40, 53, 48, 56, 41, 32, 65, 10, 99, 106, 117, 109, 112, 105, 32, 65, 32, 101, 110, 100, 49, 10, 115, 119, 105, 32, 65, 32, 40, 53, 49, 49, 41, 10, 115, 119, 32, 65, 32, 66, 10, 97, 100, 100, 105, 32, 66, 32, 40, 49, 41, 32, 66, 10, 106, 117, 109, 112, 32, 102, 111, 111, 10, 101, 110, 100, 49, 58, 10, 108, 119, 105, 32, 40, 53, 48, 56, 41, 32, 65, 10, 99, 106, 117, 109, 112, 105, 32, 65, 32, 101, 110, 100, 50, 10, 115, 119, 105, 32, 65, 32, 40, 53, 49, 49, 41, 10, 115, 119, 32, 65, 32, 66, 10, 97, 100, 100, 105, 32, 66, 32, 40, 49, 41, 32, 66, 10, 106, 117, 109, 112, 32, 101, 110, 100, 49, 10, 101, 110, 100, 50, 58, 10, 10, 104, 97, 108, 116, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, [0, False], [0, False], [0, False], [0, False], [0, False]]