hey everyone I'm
going to show you my
first experiences with the Altera de 1
board this is an fpga board that i
bought and i have no experience with
programming FPGA so I thought I would
take you through kind of like what how
my first day went so I've already gone
through it because the video would be
really painful if I was doing is the
first time anyway I installed all the
software that came with the de 1 and the
main piece here is Quartus 2 which is
all Tara's development environment and
it's a pretty big you know that the
software is like multiple gigabytes
worth and after it was done I realized
that version 7.2 is already out of date
so you can download version 8 I think
for free off the web or waste your time
installing 7.2 like I did anyway so I'm
going to start a new project right now
the board is just running that standard
stock you know program that it comes
with and the LEDs are flashing and I've
got it connected up to the computer with
the USB cable and it's powered on so
that's all I've done with the hardware
side it's totally out of the box so I'm
going to start a new project and choose
a working directory sure I'm going to
call this counter test3
okay oops
yep
we'll create the directory it's asking
me if I want to add design files that I
already have but we don't have anything
yet so we'll just leave that blank now
it's asking what kind of board we want
to program this on to so you have to get
down there and squint and read the
little number off the chip you know it's
cyclone 2 isn't good enough you actually
have to pick the exact number of the
chip so we've got that set okay
EDA tools who knows something more
advanced and there's a summary so we'll
finish that and start it now a lot of
tutorials get right into the the code
you know either very log or VHDL which
is how you actually program this thing
but I again I always kind of approach it
more from a practical standpoint and so
the first thing that I think of is the
pin assignments so a lot of people start
worrying about oh well geez you know you
got to start programming these modules
and this and that but from my point of
view I need to know what we're
controlling first before I can start
thinking about the modules at least so
what I like to do is go to assignments
pins and notice there's nothing in here
so the development environment doesn't
know what this chip is connected to how
can it you know we all have done so far
select this cyclone to the specific
thing but what we want to do is set up
the development environment so it knows
that we're using the de1 board so in
here we can say assignments import
assignments and it's going to ask for a
file and the file is in it's on the de 1
cd-rom which I copied to my hard drive
de 1 cd-rom and it's under tutorials
design files de 1 pin assignments and
it's a comma separated file so we'll
import that and look what it did so it
gave us
no names these are actually the friendly
names believe it or not that reference
the pins on the FPGA chip so you can
scroll down it's got all kinds of stuff
we got switches general purpose i/o the
hex displays those are the seven segment
displays LED red we'll be using these
today clocks VGA ports DRAM ports all
kinds of stuff so the benefit here is
that in your program now you can use
these friendly names without worrying
about what was at pin T 6 pin you know u
1 u 2 you can just say DRM data clock or
whatever whatever the thing is so that's
saved so we can close that and now we
want to come in with a new programming
file so I'm going to use vera log
because it looks better to my eyes
people debate this thing up and down
VHDL vs. vera log and that's probably a
topic for another video
but so far as a real rank beginner I'm
really gravitating towards Vera log so
that's what I'm going to use today and
here we are now it's time to start so
instead of going with one of their
examples and kind of piecing it apart
I'm going to write one from scratch kind
of quickly today just so you can see
what what's starting from scratch looks
like it's really a very different
experience than sort of picking apart
one of the examples I think so I am not
at all a you know a good coder or even
experienced coder in any language one
moment okay sorry about that so the
first trick here is to name the
top-level module these vera log files
are all broken down into modules the
name of this module has to be the same
as the file name I think I'm still kind
of figuring this out so it very log one
dot V is a name that it gave us what
we're going to do is save file save as
and call it counter test three dot V I
don't know for some reason it doesn't
get to the right directory so we're
going to put it in
right directory counter test 3v so this
as far as I know this would be a valid
module it just doesn't do anything and
what I've added here is key and LED red
are the connections that this module is
going to have so let's define what those
connections are going to do first one is
going to be an input and it's going to
be just a two position vector and that
will be the key and the output will be a
seven position vector and that's going
to be LED are okay and then we're going
to instantiate a counter which we're
going to define later I'm going to call
that counter one I realize I should have
probably coded this from inside out
instead of top down but alright like you
say I'm not much of a coder so you get
to learn with me and of course I'm
reading this off of a sheet that's on
the side on the side of the computer
because I wouldn't be able to pull this
up for memory quite so well so we're
saying here is we want to have a counter
and the inputs are going to be key 0 and
key 1 and the output is going to be LED
are and the fact that we use those pin
assignments that we set up from the CSV
file means that these keys and LED RS
are going to map exactly to the correct
hardware on the de1 board so since we
we're talking about this counter counter
is something that we haven't defined yet
so we're going to define it right down
here module counter and counter is going
to have a clock or a count a clear and
in a queue
so in here the inputs will be the count
and clear and the output will be a seven
position vector q then we're also going
to have an internal piece of this module
that doesn't get passed in or out of
this module a register also seven
positions and we'll just call that temp
so this seven : 0 just means you know
seven it's basically an 8-bit set of
data and we could have done 0 : 7 and
that would have meant a big-endian
little-endian I don't know which way it
is but depending whether you put 0 : 7
or 7 : zero means that the most
significant bit will be stored on the
left side or the right side and it's a
convention so you can do your entire
program either way as long as you're
consistent so in this case we're always
doing the big number first ok so we're
going to say always on the positive edge
of C or the positive edge this keyboard
is really lousy too since I've been
using it in the garage and there's all
kinds of little wire pieces and stuff
stuck in there and like I say this is
not really meant to be a tutorial in
Bera log I'm just going to kind of get
through this just to show you the the
download process and how to actually get
started with this board the always means
that when the positive edge when this
module detects a positive edge on C or
clear the stuff in this block will be
run and we need to use up again because
it's expecting like one statement or one
one thing here so the begin allows us to
put a whole block of code inside this
always
so if the clear pin is a one then set
ten to that has some strange-looking
notation here this just means it's an
8-bit binary zero I think I might have
just been able to say zero there I'm not
sure but they say this is totally new to
me too so Ellis temple equal ten plus
one just one binary one and I'll end our
if there and then we're going to assign
Q equal to temp at the end of all this
so I've been I've been reading and
watching some you know very log
tutorials and there's kind of a couple
ways to do assignments one of them is
like this which is a non-blocking
assignment and what happens with these
kinds of assignments is that all the
code in the block runs and then at the
end of the block the assignment is made
when you have just a sign like this the
code is is sort of running sequentially
in the hardware and I don't fully
understand this but it basically means
that it's it's a little bit like a
procedural language where it's actually
executing these statements in sequence
as opposed to just doing them all at
once so in this in this really simple
example I don't think it really matters
but in more complex cases I think it
matters quite a lot so let's take a look
at what we've got here we've got our top
level module and it instantiates a
counter and we call it counter one and
it passes these two key values key is
keys are just the buttons on that de1
board the push buttons and it gets back
led are which are the red LEDs on the
board and then our module our counter is
defined like this pretty simple so we
can go up to processing and start
compilation
and yes we want to save the changes so
we'll let it run compilation is actually
quite slow now this is a terribly old
computer so I can't really fault it too
much but even on newer computers simple
designs can take a surprisingly long
amount of time so we'll give that about
a minute or two even okay full
compilation was successful 433 warnings
you might figure that's pretty terrible
and maybe it is I don't know but I've
heard that getting warnings with them
with these hardware description
languages is pretty common and some of
the warnings are like you know the high
temperature limit wasn't set or
something I don't know but it apparently
it's normal to get lots of warnings or
at least more than with them normal
procedural coding okay so it's compiled
now what now we actually have to
download it to the chip so we'll go to
tools and say programmer and it's it's
already loaded the correct file here but
let's pretend it didn't so let's just
say that wasn't there the hardware setup
it's the USB blaster it auto detected
that USB blaster is the USB interface
that this Altair IDE one board has so
it's already set up with that that's
good and we're going to add a file the
one that was their counter test3 sof
picked that one and the start button
lights up letting us know we can do it
the mode is set to JTAG meaning that
we're going to program this without
actually storing the the program to the
EEPROM on the on the board so the switch
on the board is in run not program and
I'm going to leave this set to JTAG so
when we program this it's just going to
be temporary if power is removed from
the board the program will disappear
fresh start and this is all happy now
the board even though you can't see it
stopped running its stock firmware so
let's let's take a look at the board now
okay so this is what it looks like now
key one and key zero are here they're
even labeled right on the board and led
are zero one two so that's our our eight
position vector here and our two
position vector here so ki-10 and LED
are zero seven here so the way this
works is that the switches I think bring
our pull downs so I have to do is hold
down key one and then when I press key
zero we have some binary counting going
on just like we would expect now if I
let key one up it clears just like that
so we could have added some inversion to
the to the to the program so that I
wouldn't have to hold this button down
but there it is it works and the code is
downloaded and you know the board isn't
crashing so I consider that a success so
today I'm going to work on you know more
advanced era log stuff and try to use
some of the other hardware on the board
I'd like to get started with the SRAM
since that's going to be critical for
for all the projects that I have planned
for it so I hope that was helpful it
took me a while to chew through the
manual and maybe this video will give
you a bit of a head start okay
see you next time bye best way to earn money online, make money from home, make money online free, money making sites, earn from home, real ways to make money from home, online income ideas, make real money online, top online earning websites, earn money online fast, top 10 money earning websites, earn money without investment, earn money online for students, best sites to earn money, make money online 2019, earn easy money online, earn money online instantly, real money earning sites, make money from home online, make money online fast, earn dollar online free, online earning ways, best online money earning, earn money online with surejob, make money online, online money making sites, best sites to make money online, earn money online paypal, online earn money by typing, best survey sites, ways to earn money online, ways to earn money from home, make money online without investment, make money online surveys,
s
No comments:
Post a Comment