Jump to content

  • Log In with Google      Sign In   
  • Create Account

Inane Ravings of a Mad Engineer

Counting LEDs like Sheep

Posted by , 18 May 2010 - - - - - - · 222 views

Yea! I finally found the tutorial on how to use Xilinx's ISE program to turn VHDL into bitfiles that can run on the avnet Spartan 3A Evaluation Kit[1]. I followed the included tutorial that sets up a counter and sets the LEDs to display the top bits of the count, except I made some simple changes to make sure I understood everything. The only material change I made was to use a clock multiplier to increase the frequency from the 16 MHz oscillator to a much nicer 100 MHz. I'm so used to python and C++ that it took me a while to get used to the pascal-like syntax of VHDL, but aside from that (and the fact that the ISE software is not netbook friendly - way too much HD access and the UI doesn't fit on the 600-pixel-high screen), the process and results were pretty cool.
Ok, there is one more annoyance - that I can't find any drafts (or other legally free versions) of the 2008 VHDL standard. I like having the standard for a language I'm working in, but I don't quite like VHDL enough yet to spend nearly $300 as IEEE, ANSI, et al are asking for the pdf.

I've forgotten pretty much everything I knew about digital logic design, but I located my college text on the subject (one of the very few good books from my classes) and have been reading through it. I also picked up an interesting-looking book on processor design in a brick-and-mortar store, and then found out it was one of the best-rated books on the subject on amazon, which is nice to know. I need to start reading it sometime soon.

I think I've decided on my first big project to do on the FPGA in order to really familiarize myself with the hardware design and development process - Core War! I've already done a lot of software work with the game, so I'm pretty familiar with the instruction set and mechanics. I'm thinking I'll make a CPU that runs a game of Core Wars using the 'nanohill' rules - mainly because the board I'm using doesn't have SRAM so I need to make the whole game state fit into the BRAM in the FPGA. While almost any rule set would fit into the BRAM once, I'd really like to make a large array of Core Wars CPUs running simultaneously. Once I get that, I can load some known warriors from nano hills into the flash ram, and compete my creations against a full match (with all 142 starting positions against every opponent), which gives me a good way to benchmark a given warrior. Finally, with that capability, I should be able to make an evolver that can (by rough calculations) go through as many as a billion evaluations a day. If I'm lucky, I'll rule the nano hills a few days after I finish the project =-)

[1] It is the least expensive FPGA board I've ever seen. It's missing the fun things the more expensive kits have, like ports for VGA and audio, but for a mere $50, it's a great way to see if you're interested enough to spend more money on such hardware (and you can always use the pins it exposes to connect your own ports). It also comes with a a programmable-system-on-a-chip and a programmer for it, which is a nice bonus (especially considering that the board just for that PSoC is almost $200).

c is faster

Posted by , 01 May 2010 - - - - - - · 206 views

Lately, work has been satisfying my software development drive, so I've started getting back into another hobby - electronics. I dug out an old 'lots of projects in 1' kit from my closet and sent out a few orders to various places (primarily mouser, amazon, and ebay) to start creating a full kit to work from.

After receiving the first few things I ordered, I started playing around and wired up a 'white noise' generator based on avalanche noise. I built the circuit 5 times, but it never seemed to work for some reason when I made it on the kit's breadboard. I finally got out my separate breadboard and power supply, and lo and behold, it worked wonderfully (apparently when a schematic says you need a voltage source of a certain strength, it might say that because fewer volts will not work properly =-).

Yesterday my oscilloscope arrived, and it was rather awesome to example the white noise wave on it. Since my oscilloscope isn't officially calibrated, I decided I'd like to generate some signals from my sound card and use the oscilloscope's measurement capabilities to check the frequency, and all seems well so far (at least up to 8khz, which isn't far for a 250MHz oscilloscope). Now I'm working on a signal generator program in python that will also give me something awesome to look at on my oscilloscope. After that, maybe I'll start working on some kind of game on the oscilloscope. Analog computers are neat =-)
oscilloscopes can be vector displays

Now that this is a new month (and my "fun money" budget reset), I'm considering buying an FPGA board. I can't decide whether I cant to spend a bit more and get a fully functional board (from diligent) that has RAM etc already built in, or whether I'd like to get a bare bones board (specifically, the $50 "Spartan 3A evaluation board" board from avnet that has a few buttons, a bit of flash memory, and lots of headers). Since I have no soldering experience and SRAM doesn't seem to offer many DIP options, I'll probably go with the more expensive board, but, then again, learning to solder would probably help quite a bit with some of the projects I want to do eventually - breadboards have tons of parasitic problems with high-frequency circuits, and with the FPGA, I have several video projects I'll get around to eventually.

Numbers and Words

Posted by , 07 September 2009 - - - - - - · 217 views

I had my 0th wedding anniversary yesterday (September 6th, 2009).

Things Leading

Posted by , 25 June 2009 - - - - - - · 215 views

Life is good, but busy. The new job is working out great. Working on interesting, challenging problems is much better than tedium.

On June 8, 2008, I met an amazing woman and spent over 4 hours enjoying conversation with her over lunch. On June 18, 2009, I presented her with a ring, and she accepted it. On September 6, 2009, she becomes my wife.

Also, I just recently discovered an awesome programming game titled Core Wars. It is loads of fun, yet frustrating. I'm building my own MARS and an evolver based on it, but MSVC bugs are getting in my way. At least, I believe it is an MSVC bug - g++ and comeau both compile the code just fine in strict standards modes.

Forward the Foundation

Posted by , 26 February 2009 - - - - - - · 173 views

Near the end of last year, I found out that my employer was closing the branch I was working in, and that I could continue on until the office was actually closed in December. After we (the employees of the closing branch) found out, we made an argument for a later date that coincided with a contract deadline, and it was accepted by management. The office still had to close because the lease was up, but they allowed us to take what equipment we required and to continue working from home. I've been doing that since mid December, but the extended deadline is fast approaching.

For that reason, I've been looking on various job listing sites for a while now, and found many jobs I could do but only a few that sounded interesting. I'm more interested in low- and intermediate-level programming, while most jobs were for developing database front-ends and other simple business GUIs in Java or .Net languages. Of the few jobs that sounded interesting, several required high level security clearances that I don't have. Just recently, I found a listing that combined the best of all worlds - a software reverse engineering position that didn't require security clearance. After reading the posting, this posting instantly rose to the top of my list as an interesting, challenging position.

I submitted my resume to this new-found first choice on Feb 2, heard back from them on Feb 4 with a skill assessment test, and returned the test on Feb 6. The next week, I received the response that they would like to fly me half-way across the country to DC for an interview on Feb 19. I was impressed with their interview technique and blown away by the description of the working environment in the office I'd be joining. I also felt I did well and made a good impression on the many people I spoke to. At the end of the interview, I was told I'd hear back within a week one way or another. Yesterday, Feb 25, I got an offer letter that includes a >50% raise from my current position, a week more vacation, and several other improved benefits. Today, I signed the forms and gave my current employer notice of my resignation in 2 weeks.

Life is good. =-)

Fantastic Contraption Challenge

Posted by , 03 February 2009 - - - - - - · 204 views

A while back, there was a big post in the lounge about the fun game Fantastic Contraption. I liked it enough to register and created a rather challenging level titled, creatively, Extrarius 1. The next thing I did was to solve my own level to be sure it could be done. My solution is fairly simple, but I want to see some other solutions (if there are any), and that is where you come in. You have to register to access custom levels, so try out the free levels and find out you like it enough to help me out =-)

Note: I'm not affiliated with the game, it's authors, etc, so the only benefit I get out of you registering is (hopefully) some more solutions for my map =-)

Postscript: If you insist on seeing my design, you can message me here on GDNet. I don't want to publish it because people would then publish copies of the same solution, and that is boring. I might publish it eventually, but not today.

Degree of Freedom

Posted by , 02 January 2008 - - - - - - · 114 views

I realized when making this post that I'd hadn't announced that I graduated here. On Dec 14, 2007, I got my B.Sc. in Computer Science. Well, actually, I don't have the degree yet - an ID was required before they would hand over the degree after the ceremony, and I forgot to bring one, but I did graduate =-)

I'm not really sure why I feel it neccessary to announce, but I do, so I did, and here it is.

P.S. [grin]


Posted by , 10 June 2007 - - - - - - · 131 views

If you've kept up with various threads over the years, you might have noticed that I repeatedly mention a boycott of games, movies, music, etc for various reasons and that the only way I get such things is as gifts.

Well, I finally found an artist awesome enough to buy - the amazing "Weird Al" Yankovic. I noticed some of his videos on YouTube, then I noticed he was coming here on his tour and I liked his stuff so I went to see him. Next day I had to get his latest album and his video collection. His are the only songs I've listened to repeatedly as far back as I can remeber. All the other music I have is classical, and I'm really tired of songs about cliche subjects, but his lyrics are just so amazing that I couldn't help myself.

I am starting a Weird Al collection, but I'm still not buying anything from anybody else.

Domain Reservers Anonymous

Posted by , 20 March 2007 - - - - - - · 195 views

Hello, World. I'm Extrarius, and I'm a domain reserver. That's right - I get a "good idea" for a domain name and then register it, even though I know I'll never have time to work on the project (if I even have a project in mind).

For example, I recently made a joke to a friend about making reviews for movies/games/etc using RPG mechanics to explain the story. That led to me registering RollReviews.com for the purpose of creating such a review site. Then the friend remarked that everybody 'not in the know' would hear the name as "RoleReviews", so I registered RoleReviews.com too and made it redirect to the former site.

Another example came to me after I made a post in a forum (this one?) pointing out that an argument was about "BadWrongFun" - thus, BadWrongFun.com. I have no idea what project would fit with this domain, but there has to be something appropriate.

I also currently own:
Byerly.Name - Hosts a few email addresses
Extrarius.Name - I host a few files under this one
PsychoSanity.com - My first domain has a ton of small stuff all over the place
SkillHack.com - A parody of the "OMG H4X!" craze
InaneRavings.com - To be a 'truly anonymous forum' with light rules
YewDew.com - To be my personal 'Brand Name' should I ever finish anything

Oh, and of all these domains, not a single one uses any space or bandwidth on my web hosting. I'd really feel like my money was wasted if not for a few other sites I host. ClanDV.com doesn't use any more resources than my own domains, but defmacro.org (run by CoffeeMug) actually uses a tiny bit of the resources I'm alloted so my hosting gets a bit of use =-)


Posted by , 29 December 2006 - - - - - - · 133 views

I was just going through some of my old files when I found this gem:

Déjà vu Nostalgia, Déjà vu.

Awesome Progress!!

Posted by , 16 November 2006 - - - - - - · 126 views

I was just going through some old code when I found a 'TrigTest' program I made to benchmark various trig approximations for a thread here a while back. Since I originally compiled it using VS 2003, I now have VS 2005, and I've heard many complaints about VS 2005's optimizer, I decided to recompile it with the same settings and see how much changed.

Before recompiling it, I ran the existing executable that was made with VS 2003, and the timing portion of the program produced the following results:
Average Execution Duration (Seconds)
Sine = 4.805455441962594e-008
Taylor11Sine = 1.659724629806302e-008
HornerTaylor11Sine = 1.049327498327301e-008
CModestGodApprox = 4.527706733677046e-009
WildMagicApprox0 = 6.152818305119786e-009
WildMagicApprox1 = 1.049418850719854e-008
DevMasterApproxFast = 4.826987787554008e-009
DevMasterApproxAccurateA = 9.475673584212519e-009
DevMasterApproxAccurateR = 9.486954347549761e-009
DevMasterApproxAccurateM = 9.478525902035034e-009
While the code does use templates a bit, it doesn't use anything besides simple calculation operations and a few functions from the Windows API for timing (so any new 'security features' should not affect the timing code). Thus, I was quite surprised to find that the results for the VS2005-compiled version were so vastly different:
Average Execution Duration (Seconds)
Sine = 7.725379342905308e-008
Taylor11Sine = 1.023075111501602e-007
HornerTaylor11Sine = 8.747406444115104e-008
CModestGodApprox = 3.964541303433817e-008
WildMagicApprox0 = 1.161219847773948e-007
WildMagicApprox1 = 1.749508694540787e-007
DevMasterApproxFast = 4.910617969602283e-008
DevMasterApproxAccurateA = 7.110438337833444e-008
DevMasterApproxAccurateR = 7.136199153803070e-008
DevMasterApproxAccurateM = 7.109845804424866e-008
The built-in 'sinf' function almost doubled in execution time, but 'WildMagicApprox0' is over 18 times slower!

If anybody is interested, you can find everything related (source, projects, executables, and assembly output for both vs 2003 and vs 2005) using this link. If there is a way to get the VS 2005 version as fast as the VS 2003 version (without modifying the vs 2003 project to make it worse =-), I'd love to know about it. The settings seem to have converted correctly as far as I could tell, but I avoid vs2005 for the most part so there could be something simple that I'm missing.

Catalog /This/

Posted by , 16 October 2006 - - - - - - · 124 views

After buying the Asomiv collection "I, Robot" twice, I decided it'd probably be a good idea to catalogue all the books (and the short stories in those books, where applicable) that I own. I had a few spare minutes this morning, so I went over one shelf and have recorded the title and ISBN (or, for those that lack an ISBN, misc other info that might help you find the book) of each book. They are listed below in order of their position on the shelf from left to right.

Brock's Biology of Microorganisms (0-13-520875-0)
Semantics: A Reader (0-19-513698-5)
"You And The Law"; 1971; Readers' Digest
Abraham Licoln (1-56619-360-5)
New York Times Book of Science (0-8129-1880-0)
A Wider View of the Universe: HENRY THOREAU'S STUDY OF NATURE (0-252-06620-0)
US Army Survival Manual (1-56619-022-3)
Strategy of Process Engineering (0-471-74455-7)
Engineering Graphics (0-02-342620-9)
Software Engineering: A Practitioner's Approach (0-07-365578-3)
Tab Electronics Guide to Understanding Electricity and Electronics (0-07-136057-3)
The Art of Electronics (0-521-37095-7)
"Basic Electronics"; Copyright 1994; Radio Shack / Master Publishing, Inc.; Evans & McWorter
Grob Basic Electronics (0-07-024928-8)
Microsoft Windows Internals (0-7356-1917-4)

There are actually a few more books on the shelf, but I wouldn't have them unless somebody else put them there, so I excluded them because they don't really tell you anything about me (and aren't "my books" so much as "books in my shelf space").

Only 10 more shelves and 3 small floor piles to go (plus 1 additional floor pile per visit to Half-Price books between now and whenever I finish) !


Posted by , 29 June 2006 - - - - - - · 155 views

C++ templates are fun. I hadn't gotten "warning C4503: decorated name length exceeded, name was truncated" in MSVS since I stopped using 6 years ago, but just now I had a project gain 85 such warnings after adding some classes like the following:
template <typename TClassType,
typename TMemberType,
const TMemberType TClassType::*const TMemberPtr,
typename TPredicate = std::less<TMemberType> >
struct TMemberCompare
const TPredicate m_Predicate;
TMemberCompare(const TPredicate& p_Predicate)
bool operator()(const TClassType &p_Left, const TClassType &p_Right) const
return m_Predicate(p_Left.*TMemberPtr, p_Right.*TMemberPtr);
Is there a better way to make such comparison functors? I looked around in MSDN and Boost for such wrapper classes, but I couldn't find them so I created the above, another that derefs it's arguments and compares the result (for iterators), and a third that does a lexicographical_compare on two provided containers.
Of course, in some cases, they are chained, which causes the problem:
typedef TIteratorCompare<TSymbolRef> TSymbolRefCompare;
typedef TContainerCompare<TSymbolRefList, TSymbolRefCompare> TSymbolRefListCompare;
typedef TMemberCompare<TExpression, TSymbolRefList, &TExpression::Symbols, TSymbolRefListCompare> TExpressionCompare;
typedef TIteratorCompare<TExpressionRef, TExpressionCompare> TExpressionRefCompare;
typedef TContainerCompare<TExpressionRefTable, TExpressionRefCompare> TExpressionRefTableCompare;
//TExpressionRefTableCompare is used in a custom comparison functor for TAssertionCompare to make TAssertionTable


Time For Tea

Posted by , 18 June 2006 - - - - - - · 146 views

Please, for the love of all that is well-engineered, do not use QueryPerformanceCounter for timing.

Thank you,
Owner of a Dual-Core CPU

Progression Ho!

Posted by , 14 June 2006 - - - - - - · 139 views

Last night I received and set up my new machine, and even though I don't have much installed, it already seems MUCH faster.
Previously, I had an Athlon 2400+ (2.0 GHz) with 640MB of PC2100 RAM. Now I'm running an Athlon 64 X2 3800+ (2.0 GHz) with 2.0GB (Dual Channel 2x 1GB) of DDR400 RAM and the machine boots in under 5 seconds. Yes, I know that a fresh install of the OS might help, but there isn't anything that autostarts on my old machine that isn't on my new machine also (basically just BitDefender).

It's amazing how much faster things can get when all the buses widen and the cpu gains a 'few' transistors =-)

Heaps and Lists and Leaks

Posted by , 18 April 2006 - - - - - - · 107 views

If you ever decide it'd be a good idea to implement your own memory heap system for whatever reason, make sure you do it correctly, which includes combining multiple small neighboring blocks into a single larger block at least occasionally if you allow blocks to be split. Also, while a linked list is a convenient way to store a 'free list', it's going to end up quite slow if there is a single unordered list that you search for every call to 'MyAlloc' and 'MyFree' (especially if you don't combine blocks but do split them).

Reverse engineering is quite eye-opening =-/

Ah, the Joys of School

Posted by , 05 December 2005 - - - - - - · 176 views

Yay! I finally get to sleep after 48 hours of last-minute-start-and-finish-a-major-school-project.
Over the last 48 hours (during which I had no sleep), I wrote 65KB (counting end file size, which excludes the initial work I did since I started over) of barely commented C++ code that implements the essentials of an intel 8086 assembler to the point that it can generate a correct(as far as I'm aware - I can't look closely as tired as I am) listing file of a test assembly program.

I can see why the average programmer would slow down to only write an average of 3 lines a day. 65Kb of code is too much too manage when you wrote it while half asleep, and I'm still not quite sure how I got it working. I just hope the professor appreciates the work I put into - maybe not much time, but a lot of just about everything else there is to give.

Normally this teacher asks for code in hard copy, but I'm fairly certain she'll make an exception just this once =-)

This concludes my second 'crunch time' session, with the first being for work (see a previous journal entry of mine) and this one lasting much longer (last time I actually slept before I finished!) and produced MUCH more code (byte-size-wise).

Thank you, and good night.

Windows Is Awesome

Posted by , 15 November 2005 - - - - - - · 189 views

Desipite the fact that school computers are underpowered (128MB of RAM isn't enough for a near-default WinXP Pro install) and filled with crap (despite all kinds of 'protective measures' that are instantly nullified by the fact that the 'guest' account is a local admin on every machine), they usually run decently.
Sometimes, however, they come with interesting errors. Windows is great though - a reboot fixed the problem right up (no, they don't boot from any kind of network image) and the computer worked fine afterwards.

I'm just glad I have a dictatorship on my machine.

FlameWarriors: Unite!

Posted by , 19 October 2005 - - - - - - · 181 views

I just had an awesome idea for a website: InaneRavings.Com
Note that it's all just rhetoric meant to gather a 'community' (so much as such a site could)

It will take a lot of work, but I think it will be quite popular once I get it up and running.

I'm wondering if the page looks the same on other browsers, but I'd rather not install them myself because I hate installing programs I don't use (with all the junk they put in the registry etc) so here you can see an image of what it looks like to me in IE6. If it looks different for you in your browser, would you please list browser, version, etc and either describe the difference or post a screencap of what it looks like?

Oh, and what do you think of the idea?

There Be Pirates

Posted by , 10 October 2005 - - - - - - · 178 views

Checking my web logs, I noticed somebody had not only 'stole' some of my art (below), but they had forums linking straight to my site so they were leeching bandwidth too =-( It isn't a lot, but it was kind of a slap in the face to see that kind of thing going on.
It's nice to see that the person liked what little I've done, but they could have at least asked if it was ok to use. If you go to the www subdomain (or leave off a subdomain), you are taken to a forum where you could easily ask such things.

The image they were using is

so I had to write a mod_rewrite rule to change it into:

for the domains the person was using it on.

I wouldn't really have minded if it wasn't the one work of art I use to identify myself (that figure is in every avatar I've made since I created it), but it's kind of like somebody tried to steal my identity =-/

Recent Entries

Recent Comments