Entropy Out Loud

Keep your ears open :)

Hittin’ the Books

| Comments

Progress on the 7-segment display driver has stalled a little.

VHDL is proving to be a very different experience for me coming from a software engineering background. Not only am I learning VHDL ‘the language’ but intricately tied to that is that what I’m actually doing is hardware design.

So I’ve been reading up on stuff like RTL and trying to wrap my head around the fact that I’m not writing a piece of software but am in fact designing hardware using a methodology that I’m only just starting to scratch the surface of.

(it’s also not helping that I’m getting distracted setting up my electronics workbench, but I digress….)

So now I’m working my way through the awesome book ‘VHDL for Logic Synthesis’; search it out on Amazon (need to figure out how to get a short link to it and I’ll upadte / put it in the next post). It really seems like the kind of concise overview that I’ve been looking for. I atleast now understand the design workflow much better and am getting more familiar with VHDL’s types. So that 7-segment display should be rocking in no time.

I’ve also picked up ‘Circuit Design and Simulation with VHDL, second edition’; it was actually the one I picked up first but the other VHDL book seemed highly recommended and more specific to exactly what I want to dig into right now.

Looking forward to going through the Circuit Design book’s examples once I get the 7-seg out of the way.

There is a big plan for this. More details on that soon :)

The Best Soldering Tutorial Videos I’ve Ever Seen

| Comments

Found these absolutely AWESOME soldering tutorial videos. If you haven’t seen them before, definitely check them out. I love how they give a close view of the soldering process.

PART 2: http://www.youtube.com/watch?v=fYz5nIHH0iY PART 3: http://www.youtube.com/watch?v=b9FC9fAlfQE Dave takes you through everything you need to know to do good quality soldering. Part 1 is all about the tools you might need. A lot of this was already covered in my general lab tools video.
PART 1: http://www.youtube.com/watch?v=J5Sb21qbpEQ PART 3: http://www.youtube.com/watch?v=b9FC9fAlfQE A beginners guide to learning how to hand solder. Remember to watch the first part, which is all about the tools: http://www.youtube.com/watch?v=J5Sb21qbpEQ
PART 1: http://www.youtube.com/watch?v=J5Sb21qbpEQ PART 2: http://www.youtube.com/watch?v=fYz5nIHH0iY Part 3 of the hand soldering tutorial. This time Dave shows you how to drag solder and tack & reflow SMD components, and in particular 0.5mm fine pitch IC’s. Including solder paste and hot air.

I’ve always tried to do the ‘touch the iron on one side, feed the solder in on the other’ and thought I was just really really crap at it, but turns out I’ve always been using one of those conical tips. Definitely gonna give the chisel tips a go now.

Bouncin’ LEDs

| Comments

I present to you…. Bouncin’ LEDs! Xbox One/PS4, eat your heart out!! :)

My second FPGA circuit is a little LED bouncer with selectable speed.

So this circuit was a bit more challenging than the last one and my software instincts lead me astray, something that I’ve heard happens alot to us software devs when starting out in hardware.

Specifically, my first attempt at specifying the state machine that bounces the LEDs was wrong. Even when trying not to, I assumed that it worked like a program with code kind of like this:

process (CLKIN, RESET)
begin
    if (led(0) = '1' or led(15) = '1') then
        bounce_dir <= not bounce_dir;
    end if;

    if (bounce_dir = '0') then
        led_out <= led_out rol 1;
    else
        led_out <= led_out ror 1;
    end if;
    LED <= std_logic_vector(led_out);
end process;

So, the code looks pretty simple right? If the lit up LED is at either edge of the strip, reverse the bounce direction. Then just shift the LED output value in the appropriate direction (it’s a binary output that looks like “0000000000000001”).

Except, not.

The LEDs would get stuck oscillating between either edge. See, there’s an implicit assumption of sequence in that code; assigning to bounce_dir and then assuming that the value the next if-block would see is the new one.

However these are signal flows, this isn’t a program executed by a CPU and everything is concurrent. I’m still wrapping my head around it, to the point where my explanation here is probably a little off. In the case above, bounce_dir is a register which doesn’t get the new value until the next clock edge. Connections, not statements (or something, I’m happy to be corrected!).

My final code looked like this, FYI:

process (CLKIN, RESET)
begin
    if rising_edge(CLKIN) then
        if (RESET = '1') then
            led_out <= "0000000000000010";
            bounce_dir <= '0';
            bouncing <= '0';
        elsif (led_out(0) = '1') then
            bounce_dir <= not bounce_dir;
            led_out <= led_out rol 1;
        elsif (led_out(15) = '1') then
            bounce_dir <= not bounce_dir;
            led_out <= led_out ror 1;
        else
            if (bounce_dir = '0') then
                led_out <= led_out rol 1;
            else
                led_out <= led_out ror 1;
            end if;
        end if;
    end if;
    LED <= std_logic_vector(led_out);
end process;

So, in the code above, the circuit lives in one of four states: reset, changing direction to the right, changing direction to the left or moving in whatever direction is specified by bounce_dir.

(oh; I see now I never use that ‘bouncing’ variable, it was a leftover from an earlier attempt at something).

So there you have it. Need to keep practicing and should probably read some more language focused stuff on VHDL now that I atleast have my bearings enough.

Next step: Get a BCD value entered in with the switches displaying on the 7-segment display, then extend that circuit to get a binary value from the switches displaying on the 7-segment display.

Oh; my post on the tools and thoughts and stuff is coming, probably in a few days. I need to get iSim working first.

New Beginnings in FPGA-land!

| Comments

So…. haven’t updated this blog in awhile. Now however, I have lots more free time :)

So with this time, I’ve decided to do something I’ve been wanting to do for awhile; dig into hardware and FPGAs. I got myself a nice Digilent Nexys4 development board with the goal of creating my own 16-bit-style videogame console (think Super NES on steroids…. hopefully).

Of course, there’s a long way to go – until a few days ago I’d only read some VHDL (I’m going with VHDL) and never actually written it.

However we now have…. LEDs! They even respond to a switch and everything! Check it out:

My first VHDL on a Nexys4 board. This after a day of wrestling with the tools to get them to work on Windows 8.1. Using Vivado 2013.4, seems like a nice UI so far and I’m getting the hang of things. Had to use IMPACT to program the board as the built-in Vivado hardware server refused to see the board (even though the release notes/docs say that it should be supported). Oh well. Pretty excited to get into this stuff. My hope is to build a 16-bit classic game console :)

Can’t be far from there to a full game console, can it?? ;)

Will post more soon with some initial thoughts on the tools and some more LED action.

Why I’m Getting Back Into Comp Sci

| Comments

I love solving problems.

Awhile ago (actually, in my last post) I mentioned that I was doing a Programming Languages course on Coursera. It’s continued to go great. We’ve moved on from using Standard ML of New Jersey to using Racket, which I particularly like since the Lisp-y family of languages really appeals to me;
partly because they’re just different from what I use day-to-day.

This week’s homework is about building a programming language. We’re just building the syntax tree interpreter, skipping past all the parsing stuff.
So you just take an AST and run through it with a nice recursive definition. It’s pleasingly elegant. It’s so much more intellectually fun than what I’m doing in my “day job” at the moment.

(here comes the normal ‘enterprise’ rant haha)

It’s the difference between solving problems and gluing things together. When I’m tinkering around with my programming languages, or writing generative music in ChucK (soon to be Extempore when I get around to it), I feel like I’m creating something new to explore. Something will happen that I haven’t seen before. You wouldn’t think that writing an interpreter and generating music would have a lot in common, but somehow they do. There’s a satisfaction to writing your own little piece of code that does it’s own little thing. You start off with an unsolved puzzle and then it’s solved in a neat package.
You’ve taken thoughts from your head and made them real in the machine. You create something.

Particularly when generating music, there’s a great feedback loop that you often get into where something that your code does surprises you. That’s when you go from “writing out steps to solve a problem” to “creating something that almost has a life of it’s own”.

So what made me think of all this? I really don’t know :) I’ve been tasked to write a plugin-type thing at work. It’s one of those big enterprise-y software things where you write a lot of boilerplate code to solve a problem that’s been solved a million times before and you wonder why you need all this boilerplate. For a split second it reminded me of a time when I thought that the software profession wasn’t for me, that it just wasn’t stimulating anymore.

Luckily it doesn’t take much more than a music scale, or a game, or even an abstract syntax-tree interpreter to remind me why I love doing what I do so much.

Coursera So Far….

| Comments

I’m currently taking the Programming Languages course on Coursera. It’s a great course for anyone that wants to learn functional programming. Dan Grossman is an amazing lecturer and the course materials are fantastic. You can’t go wrong with this course and it’s unbelievable that it’s free.

Having said that, it does need quite a time commitment. We’re approaching our midterm exam and have already had three assignments due (one a week). I managed to get the first one in past the hard deadline, which earned me a 30% penalty. Was kind of disappointed with that. I didn’t get the second one in at all.

Just got the third one in on time and man is it satisfying! I didn’t do the last two questions of the assignment or the challenge problems and made a simple mess up on my first submission (forgot to catch an exception I was throwing) but still managed an 83% score. Definitely better to submit on time even if you have one or two questions to go than turn it in late!

One of the other great things is the peer assessment. Having other students review your code is IMHO a great idea and I got some excellent feedback for my first assignment from others. Looking forward to the same from the one I just submitted. Professionally it helps me too, since at work we’re now doing code reviews on everything (more on that in a future post) so it’s great that I can get some extra practice in with this.

We’ve covered a great deal of ML in the course and it’s put me on a good path to pick up F# and Haskell again. I’m liking the ideas of F# the more I read about it and since it’s an ML variant it should be an easy transition now. I really want to get into Haskell and do something practical with it as well; for some reason the language really appeals to me.

Oh well, off to work now I guess! I’ll leave you with the obligatory video link. Something a bit different this time :)

The motorcycle with a drum kit built a Moscow biker Alexander Ishutin. Meanwhile in Russia. Join Us On Facebook http://www.facebook.com/MeanwhileRussia Follow us on Twitter http://twitter.com/MeanwhileRussia Google+ http://plus.google.com/u/0/b/102989365667842116369/102989365667842116369/posts Мы ВКонтакте http://vk.com/meanwhilerussia Vote for us on King of the Web http://kingofweb.com/users/meanwhilerussia If you like our YouTube channel, and want to help us, vote for us here http://kingofweb.com/users/meanwhilerussia and simply give us a minute of your time to log in with your Facebook and vote! You can vote ten times per day till the end of the election (just click on the vote button 10 times). We love posting videos for all of you, and now we need your help to take the crown! :) We upload only those videos for which we have obtained permission from the copyright holder/owner. If you have any interesting or funny video and you want it to be published in this channel, please contact us. We welcome video suggestions from our viewers, and if you have any questions feel free to ask. If you own the copyright to any video, posted on this channel and this video was mistakenly posted without your permission, please contact us. E-mail:: meanwhilerussia@gmail.com Мы загружаем только те видео, на которые мы получили разрешение от правообладателя / владельца. Если у вас есть интересное или смешное видео и вы хотите, чтобы оно было опубликовано на этом канале, свяжитесь с нами. Мы приветствуем любые предложения и пожелания от наших зрителей и если у вас есть какие-то вопросы, не стесняйтесь спрашивать. Если вы обладаете авторскими правами на какое-либо видео, размещенное на этом канале и это видео было по ошибке размещено без вашего согласия, пожалуйста, свяжитесь с нами. E-mail: meanwhilerussia@gmail.com

Like a boss indeed!

Self and Self: Whys and Wherefores

| Comments

Just came across an amazing talk by David Unger about his experiences in computer science and about the Self programming language.

Every time I see something like this, it amazes me that what we often consider as ‘new software technology’ actually, well, isn’t that new.

Enjoy!

(September 30, 2009) David Unger, from IBM Research, discusses how his experience in computer science has led him to the conclusion that even if your ideas succeed, the real legacy is the people. Stanford University: http://www.stanford.edu/ Stanford Engineering Everywhere: http://see.stanford.edu/ Stanford University Channel on YouTube: http://www.youtube.com/stanford

A quick note: my tutorials are still on the way, as are more blog posts! Been having a hectic time at work, but stay tuned :)

Stunning Recursion

| Comments

The first tutorial series I’d like to do on Cinder involves making a Conway’s Game of Life simulation. For those that don’t know, it’s a cellular automaton with a set of very simple rules. The fascinating thing about GoL is the sheer amount of complexity that can arise from these simple rules.

The wikipedia page is here. There’s a nice animation on that page, along with the rules of the game (we’ll be following it in the tutorials, but more on that later).

Now what’s really amazing about the Game of Life is that it’s Turing Complete, which in a nutshell means that it’s powerful enough to perform any computation that a regular computer can do.

Including, as this jaw-dropping video I found on YouTube shows, implementing itself:

Make sure your volume IS NOT cranked before running this – it contains a loud Shephard tone (more on that in a moment!)

A video of Conway’s Game of Life, emulated in Conway’s Game of Life. The Life pattern is the OTCA Metapixel: http://www.conwaylife.com/wiki/OTCA_metapixel - for more information, see http://otcametapixel.blogspot.com.au/ The life simulator used is Golly - http://golly.sourceforge.net/ which has a built-in script to generate these metapixel grids (select a pattern, and choose “metafier.py” from the scripts list). Inspired by this video: http://www.youtube.com/watch?v=QtJ77qsLrpw but with the speed and scale varying smoothly over time, rather than in discrete jumps as the original video did. The actual video is exported from Golly using a custom Python script: http://pastebin.com/8vVGCgKE (since Golly built-in only supports rendering the view with a scale which is a power of 2, for performance reasons - this is not a particularly well-optimised or fast script to run). The audio track is a Shepard Tone: http://en.wikipedia.org/wiki/Shepard_tone This is also generated by a Python script: http://pastebin.com/vxVeNtWc I understand it’s not the most pleasing sound to listen to, but I thought it was appropriate. The YouTube player has a mute button, if you insist, or see this response: http://www.youtube.com/watch?v=D6aP9S9rEQk which has an edited video and a much nicer soundtrack.

Amazing, ain’t it? I recommend you go to the YouTube page and read the video description.

That tone you can hear in the background that keeps rising is called a Shephard tone. It doesn’t actually keep going up as far as you might think it does.

All around, extremely awesome!

Welcome to My Blog

| Comments

Well, what to write here? I guess I should introduce myself.

I’m Matt and I…. tend to spam my workmates with random links all day!

I’m also a coder who’s been getting into the Cinder framework and couldn’t find many video tutorials on the framework. I like coding and I’d like to teach, so…. Stuff will be happening :) In particular, expect some games-related and audio-related coding tutorials. As well as a good dose of other software-dev related stuff.

So, stay tuned :) I’m looking forward to this, it’s gonna be fun!