

Your Very First Microprocessor - PieSquared
http://gibiansky.com/2012/12/your-very-first-microprocessor.html

======
tcas
Didn't expect to see Verilog on the front page of HN.

1 nit pick, I think wherever you use a wire assignment you need the assign
keyword. e.g

    
    
      wire [1:0] command = mem_out[7:6];
      wire [2:0] destination_addr = mem_out[6:3];
      wire [2:0] source_addr = mem_out[2:0];
    

should be

    
    
      assign wire [1:0] command = mem_out[7:6];
      assign wire [2:0] destination_addr = mem_out[6:3];
      assign wire [2:0] source_addr = mem_out[2:0];
    

Or maybe it's wire assign. I usually first declare the wire in a single
statement then use assign on a new line.

~~~
PieSquared
Could this be dependent on the Verilog version? At the very least, the wire
assignments without the 'assign' keyword seem to work in the iverilog
simulator as well as Altera's Quartus suite synthesis tools. I have seen both
conventions (wire declaration and assignment separately or together), but I
believe the assign keyword is only required for the former.

~~~
PieSquared
For future reference (since I can't edit): I spent a while researching and
couldn't find any definitive answer, but found some places which supported the
implicit assignment ([0], [1]). However, these aren't anything official, so I
think ultimately it just depends on what your particular implementation
supports...

[0] <http://www.verilogtutorial.info/chapter_2.htm> [1]
[http://www.doulos.com/knowhow/verilog_designers_guide/wire_a...](http://www.doulos.com/knowhow/verilog_designers_guide/wire_assignments/)

~~~
tcas
You're right. I just tested it in Xilinx ISE 13.4 and it seemed to work
without using any assign as both a single wire and a bus. I just recall seeing
an error message at some point in the past which was about something similar.

------
compumike
Hi Andrew, great overview looking at the foundations of programmable logic. I
recognize the look of the schematics from CircuitLab! Noticed that you went
out of your way to take screenshots -- is there something we can do to make it
easier to use our image export, or alternatively some sort of embeddable
widget like you use for the Verilog gists?

~~~
PieSquared
Hey Mike! Cool to see circuitlab developer(s?) on HN! It's an awesome tool.

When writing these blog posts, I usually create a single circuit with a bunch
of disparate parts - I don't need the circuit to be functional for any
simulation purposes, I just need the diagrams and rendering. Part of the
reason that I only use a single circuit is that I need to copy and paste
different parts, and I'm not sure if copying/pasting between different
circuits is possible. Also, copy/paste rather often dies on me, especially
when selecting multiple components, which makes workflow a bit more
complicated. (This happens to me rather often and is really annoying, because
the only way to fix it is to close the tab and restart. Symptoms after
breakage include inability to copy/paste or move any circuit elements around.
If there's any way to submit debug logs for when this happens, feel free to
let me know and I'll be sure to try next time it happens. You have my email.)

Exporting via the export tool produces a single PNG file for the entire
circuit, where I often need just a bit of the entire diagram. Screenshots let
me select a small portion of the circuit.

I'm not entirely sure how this could be fixed. If there were gist-like
embeddable widgets, I think the convenience of those would outweigh the
disadvantages of a slightly different workflow. Circuit "gists" would be
awesome. Another thing that would be great is if I could select a bunch of
elements on a circuit, click on some button, and have a new circuit created
with only those elements in it. (Note that I'm just brainstorming what would
help _me_ specifically, so I don't know how all this might fit into your
product.)

Anyway, CircuitLab is awesome! Thanks for making it.

~~~
compumike
Excellent -- we've been thinking about this a lot on our end, and we'll be in
touch via e-mail. Copy/paste between browser tabs/windows does work (uses
HTML5 localStorage), but it sounds like you might be having a different issue
and we'll follow up. Thanks!

~~~
vasco
Hey, another user here that would love to be able to just export parts of the
circuit. I usually just use circuitlab for the rendering because SPICE is ugly
and bloated and when in need of good looking schematics for reports circuitlab
is great.

Maybe have a tool that allows you to select just a part of the schematic like
some print screen tools have when you just want to save a part of the screen,
and export just that. I never experienced the crashes that the other poster
talks about though.

Thanks for a great product by the way!

------
columbo
A good resource on this same subject is the book 'Code' by Charles Petzold. It
is also a bottom up approach to understanding computers.

------
anilkaty
A very good introduction to how a computer works from the inside, but you need
to know the syntax of Verilog to really understand the code you wrote, any way
it gives a general feel to people outside the VHDL domain, like me who is a
systems integrator and designer I work at a 30,000 feet view on assembly upto
C, C++, PHP and DotNet.

------
pjmlp
My first processor was a Z80! :)

~~~
kator
I did z80 on TRS-80 Model 1's and 6809 on the TRS-80 Color Computer.

They were not very complicated machines and thus made it easier to create
assembly language programs that actually did stuff you could observe quickly.
I think the fast feedback loop between coding in assembly and having
observable results (i.e. graphics etc.) made for a nice learning platform.

<http://en.wikipedia.org/wiki/TRS-80_Color_Computer>
<http://en.wikipedia.org/wiki/TRS-80#The_Model_I>

I think today's processors are very cool but trying to teach someone assembly
on a monster like the modern processors and having to do all sorts of things
to try and flip a single bit on the screen via GPU's etc. makes for a rough
learning experience. I notice very few college programs are doing low level
courses and I think it impacts the students in very subtle but real ways that
creep into code because of their lack of the low-level details of how
computers work.

