1. 3

    I have been working on a Tower Defence game for iOS using SpriteKit. I started this game using web tech but I decided to go native and get used to Obj-C along the way. A tower defence game has been on my bucket list for a while :) Now that I have graduated I finally have the time.

    I got the majority of the features implemented and I open sourced everything today.

    Source: https://github.com/viperfx/AlienDefence-iOS

    1. 2

      Having been accepted into UC Berkeley’s Ph.D. program, I’ve decided it’s high time to start learning Chisel. I’m working on writing a vector processor in the language. So far, I’ve implemented pipelined floating point units and a bi-directional crossbar switch.

      1. 2

        Congrats on being accepted!

        1. 1

          Gratz! You did not like the 9 to 5 job job ehh? What made you go for a phd?

          1. 1

            I was actually planning on going to grad school even before taking the full-time position at Amazon. Since I got my undergraduate degree a semester early, I decided to work for the 8 months prior to starting grad school so that I could get experience and save up some money.

            I decided to go for the Ph.D. because I find computer architecture really interesting, but a Ph.D. is more or less a basic requirement for being a computer architect.

        1. 4

          I’m working on Sourcegraph, code search for open source. It provides good usage examples and docs for you when you’re coding. This week, I’m focused on improving the snappiness of search and fixing outstanding errors that have popped up (let me know if you find any more!)

          https://sourcegraph.com/

          1. 2

            Nice project! I like how methods are linked in the source code to their method pages.

            What search backend are you using?

            1. 1

              Sourcegraph uses a combination of PostgreSQL and Elasticsearch for searching. We’ll write up a tech stack post one of these days, but ask away if you have any other questions.

          1. 3

            Holy crap, nice work man!

            I think it would useful to know why you did certain intermediate steps. Would be good if you commented some Verilog code, or showed us how the whole system is connected together and how it works. A big picture would be useful for this type of project as its not immediately obvious.

            Some questions:

            You have two org statements in led_switch.asm… normally there is only one in PIC?

            How is the compiled hex file used in the fpga?

            Why did you choose those megafunctions? What is their purpose?

            Why is OCaml used here for the assembler? could something else have been used?

            Anyways, I will download and try the steps and give it a shot on my DE1 soon.

            Thanks for open sourcing it! Good source for learning.

            1. 2
              1. The first .org statement is not really necessary, since the assembler starts at 0 anyway.
              2. The Altera megafunction for the instruction memory uses the .hex file as it’s initialization.
              3. I’m more familiar with ocamllex and ocamlyacc than any other language processing tools. I could have done it in any language, but I decided to stick to what I know (not that OCaml isn’t awesome).
              1. 2

                Just realized I missed a question. The two megafunctions are for the instruction memory and data memory. They are necessary in order to use the block RAM on the CPU.

                1. 1

                  Thanks!

                  Re 3: When you say any other language - what about python? or is there something OCaml offers for this task?

                  1. 1

                    OCaml has pretty awesome tooling for writing compilers and other language processors IMO. When you are creating a compiler, you want a good lexer generator and parser generator. OCaml comes with a lexer and parser generator included, called ocamllex and ocamlyacc, respectively. For this project I used menhir instead of ocamlyacc because it has better warnings and error messages. The syntax that menhir uses is compatible with ocamlyacc though, so you don’t have to change any code if you want to switch.

                    Another benefit of using OCaml for compilers is that you have algebraic data types, which are very good for creating intermediate representations such as an abstract syntax tree (or in the case of my assembler, a list of instructions). OCaml also has pattern matching, which lets you describe traversals of your intermediate representation very easily.

                    If you are interested in writing a compiler or interpreter, I highly recommend learning OCaml. However, most other languages have similar tools. For C, there is the original lex and yacc programs. For Python there is PLY (Python Lex/Yacc). I chose OCaml because I’m most familiar with writing compilers in OCaml since that’s what I learned in school.

            1. 1

              Agreed. The tutorial is really great at introducing the basic concepts of assembly. Feel good after finishing that tutorial :)

              1. 4

                Starting work on the next part of my FPGA series. I’m looking at implementing real-time FIR audio filters on the FPGA. Right now I’m poring through the datasheet for the audio codec to see how to get that working.

                Also, I’ll be moving to Seattle on Friday and will be starting work at Amazon on Monday.

                1. 1

                  I would be interested in a post about your interview experiences and especially with amazon and likes - if you can.

                  1. 2

                    I don’t think there’s that much to say. I got a return offer after my internship last summer. I got the internship through the normal interview process. I suppose I would summarize my experience as follows

                    During the Interview Process

                    • Study up on data structures and algorithms. Interview questions generally focus on this subject.
                    • First round interviews will most likely be over the phone. Make sure you take the call in an area with good reception.
                    • If the call drops during the interview, don’t panic. You will probably be using a shared code editor for the interview. Type a message in the editor telling them to call you up again. (This trick really saved my bacon during the Amazon phone interview).

                    During the Internship

                    • Don’t worry if you get stuck. This is bound to happen. Often it’s because of circumstances outside of your control, like some information being missing or another team not responding. When this happens, make sure to tell your mentors and managers that you are stuck. They want to know if this happens. It is there job to help you get unstuck.
                    • If you do have a clear goal set and no roadblocks, work efficiently to get it done quickly, but don’t sacrifice quality. This will greatly impress your manager and coworkers.
                    • Builds and integration tests will take a long time. Plan accordingly.
                    • Code reviews will drag out. Plan accordingly.
                    • Don’t be afraid to ask questions. Your co-workers have been doing this much longer than you have. Chances are they have an answer.
                    • This is so important that it bears repeating. Keep your mentor and manager informed. Make sure they know what you are working on and what you are stuck on. My team had daily stand-up, so it was natural for me to do this.

                    Most importantly in this whole process: don’t stress about it. If you are a good programmer and are on top of things, you will end up with a good job. It may not be the one you had your heart set on. Amazon was not my first choice. If you get a rejection, don’t sweat it, there are plenty of good tech companies out there. Apply somewhere else. Eventually you’ll find a company that sees your value.

                1. 1

                  Great series. Please continue to do more. I am doing a module starting in a few weeks to do with fpga’s so this is nice to read up on what I am getting myself into :)

                  1. 1

                    What’s a module? Is it some sort of class? I should warn you that I am making things seem a lot easier than they actually are in these posts. It is hard to convey the frustration of debugging embedded systems in words (well, at least not in words acceptable in polite conversation). Plus, I haven’t even gotten to interfacing with peripherals yet and that’s the hardest part. I’ll be talking about the audio codec in my next post, so that will hopefully give you a sense of the complexities inherent in interfacing with external systems.

                    1. 1

                      Yes its a class. I am attending university at the moment. Yes, people have told me FPGA is difficult but worth the effort sometimes. Anyways, I hope you get the time to go into the details for us newbies. Think of it like educating the rest of us on how you would have wanted your FPGA class to be like :) I believe I will be doing a project with the FPGA too, so I will be looking around for inspiration on what to do.

                      1. 1

                        For some final project ideas, you may want to look at the projects from our embedded systems class. http://www.cs.columbia.edu/~sedwards/classes/2013/4840/index.html

                        And yeah, it’s definitely worth it, even though it’s quite challenging.