AHDL Vs Graphical Programming
AHDL Vs Graphical Programming
AHDL Vs Graphical Programming
SUBDESIGN designname
(
list of inputs : INPUT;
list of outputs : OUTPUT;
)
VARIABLE
List of variables required;
BEGIN
Description in the form of “C” like code;
END;
AHDL Example 8-bit counter
SUBDESIGN time_cnt
(
enable, clk : INPUT;
time[7..0] : OUTPUT; List of I/O
)
VARIABLE
count[7..0] : DFF; Variable declaration
BEGIN
count[].clk = clk;
time[] = count[].q;
If enable THEN
count[].d = count[].q + 1; Logic
ELSE
count[].d = count[].q;
END IF;
END;
AHDL Example 8-bit counter
The name of the text file must
SUBDESIGN time_cnt be the same as the subdesign
( name ie. time_cnt.TXT
enable, clk : INPUT; Two single bit inputs
time[7..0] : OUTPUT; One 8 bit output. This is an
) 8 bit register
VARIABLE
count[7..0] : DFF; One 8 bit variable, formed
by 8 D-type flip-flops
The overall functionality is that when the enable input is HIGH the binary number in count[ ]
increments on every clock pulse. If enable is LOW nothing changes.
AHDL Example 8-bit counter
1 is not added to every q
count[].d = count[].q + 1; output. The [ ] denotes all
devices in range, Ie. count[7] to
count [0]
All the q outputs are treated as
an 8-bit binary number and 1
is added to the number.
Subdesign DLatch
(
D, Enable : input; % Declaration of inputs %
Q, NOTQ : output; % Declaration of outputs %
)
AHDL Example – The D-latch
Quartus Version
There have been issues with using the latest version of Quartus
(v12.1 Service Pack) making it unnecessarily difficult to simulate
our AHDL designs
Quartus Version
Aside from preventing us from pulling our hair out simulating our
AHDL designs, version 9.1 allows you to use the ‘MAX+PLUS II’
look which can be useful to those familiar with MAX+PLUS II or
are referring to the study guides
Simulating our designs in Quartus
SUBDESIGN DflipFlop
(
D, Clk : INPUT;
Q, NOTQ : OUTPUT;
)
VARIABLE
DFLIPFLOP : DFF;
BEGIN
DFLIPFLOP.clk = Clk;
DFLIPFLOP.d = D;
Q = DFLIPFLOP.q;
NOTQ = !DFLIPFLOP.q;
END;
D flip-flop - AHDL design and simulation
Enter the AHDL for the Dflipflop and save the file to the project
directory
Click ‘>’ to bring the selected inputs and outputs into the
simulation and then press OK and OK again
D flip-flop - AHDL design and simulation
The selected I/O are now in the vector waveform file and we are
close to being able to simulate
D flip-flop - AHDL design and simulation
We can now see the simulated output for the inputs we specified!
Now that we know how to simulate lets look at more AHDL design
SUBDESIGN and_gate
(
a,b : INPUT;
y : OUTPUT;
)
BEGIN
y = a & b;
END;
AHDL design and simulation
SUBDESIGN shift_reg
(
clk, ser_in : INPUT;
q[7..0] : OUTPUT;
)
VARIABLE
ff[7..0] : DFF;
BEGIN
ff[].clk=clk;
ff[7..0].d=(ser_in, ff[7..1].q);
q[]=ff[];
END;