Professional Documents
Culture Documents
CCE61206
Pemrograman FPGA
Agenda
• Introduction
• Review Sistem Digital
• FPGA design dengan Xilinx
• Rangkaian kombinasional
• Rangkaian Enkoder, Decoder, Multiplekser dll
• Konsep-konsep tambahan dalam pemrograman
• Flip flop
• -----------------------------------UTS-------------------------------------
• Rangkaian Counter
• Materi pengayaan
• Desain project dan presentasi
• -----------------------------------UAS-------------------------------------
Slide 2
26 October 2020
process
Slide 3
26 October 2020
More on process
1. multiple processes interact with each other just like concurrent statements – concurrently.
They can be accessed using sensitivity list
2. A PROCESS without a sensitivity list is defined to be an infinite loop. When the execution
reaches the bottom (end of the process), it automatically starts to execute again from the
begining. It suspends on on WAIT statements.
3. The value of a signal is updated only at the time when the PROCESS suspends!
The one without the sensitivity list suspends when it executes a WAIT statement while the one
with the list suspends at the end of the PROCESS automatically
Slide 4
26 October 2020
Signal and variable
i0 or not i1
i0 and i1
Declared as port
Slide 5
But since p0 and p1 are not ports, it has to be declared as signal or variable
26 October 2020
Signal VS variable
...
signal x,y,z : bit; process (y)
... variable x,z : bit;
process (y) begin
begin x:=y;
x<=y; z:=not x;
z<=not x; end process;
end process;
entity sig_var is
port( d1, d2, d3: in std_logic;
res1, res2: out std_logic);
end sig_var;
begin
var_s1 := d1 and d2;
res1 <= var_s1 xor d3;
end process;
proc2: process(d1,d2,d3)
begin
sig_s1 <= d1 and d2;
res2 <= sig_s1 xor d3;
end process;
end behv;
WAIT STATEMENT (1)
WAIT FOR ;
This causes the process to re-execute after a specific amount of time has
passed.
As we have used earlier, this can be useful in writing test benches to create
stimulus where signals are required to change value over time.
Example:
stimulus: PROCESS
BEGIN
sel <= '0';
bus_a <= "1111";
bus_b <= "0000";
WAIT FOR 10 ns;
sel <= '1';
WAIT FOR 10 ns;
-- .....
END PROCESS stimulus;
WAIT STATEMENT (2)
WAIT ON ;
The WAIT ON statement waits for an event on one or more of the signals in
a list specified before re-executing.
PROCESS
BEGIN
IF (a='1' OR b='1') THEN z <= '1';
ELSE z <= '0';
END IF;
WAIT ON a, b;
END PROCESS;
WAIT STATEMENT (3)
WAIT UNTIL ;
The WAIT UNTIL statement has a condition which returns either TRUE or
FALSE.
The statement waits for an event on one of the signals in the condition, and
if as a result of the event the condition has become true, then the process
re-executes.
PROCESS
BEGIN
WAIT UNTIL clk='1';
q <= d;
END PROCESS;
WAIT STATEMENT (4)
WAIT;
Lastly, it is possible to just use WAIT to suspend a process forever. You may
ask, what is the usage of this structure? Well, it can be used in a test bench to
make sure your infinite loop feature of the processes from causing your
stimulus to repeat once complete.
stimulus: PROCESS
BEGIN
sel <= '0';
bus_a <= "1111";
bus_b <= "0000";
WAIT FOR 10 ns;
sel <= '1';
WAIT;
END PROCESS stimulus;
CONCATENATION
The & operator is a built-in VHDL operator that performs the concatenation
of bit_vectors. For example, with the following declarations:
The following statement would connect a to the right half of b and make the
left half of b constant “0000”'.
a<=“1010”
b<="0000" & a;
The & appends the a to the end of the "0000" to form a result that contains
8 bits.
b value is = 00001010
Std_logic_vector
(7 downto 0)
11010011
MSB LSB
a(7) a(0)
Slide 13
26 October 2020
LOOPING
Slide 15
26 October 2020
Component (2)
Example:
Slide 16
26 October 2020
Component (3)
Mux 2 to 1, in: (x,y) selector:(s) out:(z)
Slide 17
26 October 2020
Component (4)
Slide 18
26 October 2020
Constant and generic
Slide 19
26 October 2020
Data type and Operator
Slide 20
Type casting
26 October 2020
PlanAhead
drive strength (output) dan pull type (input) untuk seluruh port input dan output yang terdefinisi
Slide 21
▪ Secara default, I/O std adalah LVCMOS25 dengan SLOW slewrate dan output
drive 12 mA
26 October 2020