SpeakHDL utilizes a
'teach by example'
approach to FPGA programming. Each of the tutorials are given as series of examples are are intended to be self explanatory and self contained. Each example is broken down into two short videos.
The two videos will appear as clickable items similar to the items below and should be 'double clicked' and played in full screen mode.
Each example is intended to familiarize the user with a particular procedural operation that can be performed. The user is encouraged to watch the video try reproduce the simulation on their own results before moving on to the next example.
Speak HDL utilizes native VHDL as the hardware description language. However, SpeakHDL
does
not
assume that the user is familiar with VHDL
in any way
. However, for uses that are familiar with VHDL and those interested in the architecture that is used to make procedural programming to work one should see:
The general purpose counter is probably the most utilized
framework
component that can be configured by an API call. In order to request usage of a counter, an
application module
makes a call to the VHDL procedure CONFIGURE_COUNTER by speaking the commands "
configure counter
". Counters are enabled by default, and can be configured to operate on different clock domains extremely easily by voice commands.
Counters can be configured to count clock cycles or count signal edges simply by changing the type of the enable signal. In addition, counters can also be configured to trigger state machine transitions when they rollover
Tutorial lessons to be learned
Counters can be placed on different clock domains. There can be a number of counters on a single clock domain or they can be separated onto different clock domains. The user is free to assign any unused index to any counter. However, it is suggested that contiguous indexes are utilized to index counters.
Reviewing the Commands
This sequence of commands will generate a counter operating on the default system clock domain
(100MHz)
. The counter will increment from 0 to 19 on every clock cycle then rollover and repeat. The counter will asserting a done strobe every time it reaches 19.
Now we wish to add a second counter operating on a different clock domain. This sequence of commands will generate a counter (with counter index one) operating operating on a fifty-megahertz clock domain. That counter will count from 0 to 10 on ever clock cycle and rollover and repeat. The counter will asserting a done strobe every time it reaches 9.
When the command "ok" is spoken, SpeakHDL does calculations related to the number of resources that the application modules will be using.
The simulation shows the two counters behave as expected. This example chose 50MHz because it was exactly half of the system clock. With that being the case, counter zero increments twice a fast as counter one on the slower clock domain. As shown in the graphic, the done strobe of counter zero is half the pulse width of the done done strobe of counter 1.
The time counter is composed of two counters chained together specifically used for counting time. The time counter can be used to create a hardware timeout, or pattern of output strobes at a specified time interval. As opposed to the general purpose counter, the time counter cannot be 'suspended' when the enable signal is '0'.Instead, the time counter is either running (counting time) when the enable signal is true or logic '1' or both counters are reset to zero when the enable is '0' or false.
An
application module
request requests the use of a time counter from the
framework module
when the user speaks the command
"time counter"
. This voice command creates the VHDL procedure call
TIME_COUNTER
which configures a time counter in its default configuration.
Note: The total time delay would before the DELAY_COUNTER repeats would be 12 us (5 x 2.4 us).
Tutorial lessons to be learned
When used specifically for counting time periods, the time counter is more easily setup than two general purpose counters. Both the DELAY_COUNTER and the DIVIDE_COUNTER can be configured to count individually, however, the typical use case is setting up the DIVIDE_COUNTER to strobe at a specified time interval (us, ms, or seconds), while the DELAY_COUNTER is set to an integer number of counts.
Reviewing the Commands
The "
time count"
command creates the procedure call TIME_COUNT. Once the procedure is created, the "
delay
" command to used to select the delay parameter, and "divide" command command to select the divide parameter of the procedure call. The delay and divide command, can be performed in any order. After the parameter is selected, then the next words specify the argument to the parameter. The delay parameter being five, and divide parameter 2.4us.
In the same manner, the command "
signal output
" is used to select a pin number. The next words "
delay done
" means to wire the delay done signal to the selected pin number (in this case output pin zero). The next commands "signal output one" selects pin one, then the "
assign divide done
", wires the divide done signal to output pin one.
"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.
The competed counter example is shown in file XXX
_example.vhd
.
For API syntax see < ref>
State machine time transitions or waiting for a signal transition are very useful when triggering a transition from within the application module. Another use case arises when attempting to trigger a state machine transition in a different application module. Registering and firing events are useful for this purpose.
State Integer | State Name | Action |
---|---|---|
0 | st_init | transition to st_start after 3.5 us |
1 | st_start |
set output pin 0 to logic '1' and wait for 1us
then transition to st_wait |
2 | st_wait |
set output pin 0 back to logic '0' and wait
wait for a signal named ' trigger ' to become logic 1 then transition to st_done |
3 | state_done | wait for 2 us then return back to st_init |
State Integer | State Name | Action |
---|---|---|
0 | - |
set the 'trigger signal to logic '0'
transition to state 1 after 10 us |
1 | - |
set the 'trigger' signal to logic '1'
transition back to state 0 after another 10 us |
Note 1: The 'trigger' signal will be used to trigger the other state machine out of the st_wait state.
Note 2: The counter can trigger a state machine transition as long as the state machine is not scheduled to transition on that same clock cycle
Tutorial lessons to be learned
Creating a state machine should be always
Reviewing the Commands
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
State machine usage is extremely important in FPGA design in order to facilitate sequential operation. All of the procedure calls that SpeakHDL provides operate in parallels unless they are explicitly placed inside a state machine state. SpeakHDL makes it extremely easy to create state machines on any clock domain. States in SpeakHDL are of integer type. By using integer literal types, we can build state machine structures without needing a VHDL declaration statement.
There are three ways to trigger state machine state transitions:
Note: Time transitions and signal change transitions are used when programming within the same application module, whereas transitions based on an event can be triggered from between different application modules.
State Integer | State Name | Action |
---|---|---|
0 | st_init | transition to st_start after 3.5 us |
1 | st_start |
set output pin 0 to logic '1' and wait for 1us
then transition to st_wait |
2 | st_wait |
set output pin 0 back to logic '0' and wait
wait for a signal named ' trigger ' to become logic 1 then transition to st_done |
3 | state_done | wait for 2 us then return back to st_init |
State Integer | State Name | Action |
---|---|---|
0 | - |
set the 'trigger signal to logic '0'
transition to state 1 after 10 us |
1 | - |
set the 'trigger' signal to logic '1'
transition back to state 0 after another 10 us |
State Integer | State Name | Action |
---|---|---|
0 | - |
set the 'trigger signal to logic '0'
transition to state 1 after 10 us |
1 | - |
set the 'trigger' signal to logic '1'
fire a event 0 and transition to state 0 when the event is acknowledged |
Tutorial lessons to be learned
Creating a state machine should be always
Reviewing the Commands
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.