Professional Documents
Culture Documents
VHDL Synthesis
VHDL Synthesis
TISU-Group
JV
Misc 1
Buffer ports
Buffer ports can be used to model designs where output
signals are also used internally in driving component
inout-port may have different value read than written, if the
actual signal associated with the port is resolved
Example:
entity counter is
port (clk, reset : in bit; count : buffer integer range 0 to 1023);
end counter;
architecture rtl of counter is
begin
countp: process(clk, reset)
begin
if (reset = '1') then
count <= 0;
elsif (clk'event and clk='1') then
count <= (count+1) mod 1024;
end if;
end process;
end rtl;
JV
Page 1
Misc 2
Buffer ports
Avoid using BUFFER ports. They cause easily type
conflicts in large projects (between OUT and BUFFER
types)
Better solution: internal signal
entity counter is
port (clk, reset : in bit; count : out integer range 0 to 1023);
end counter;
architecture rtl of counter is
signal count_i : integer range 0 to 1023;
-- internal count signal
begin
count <= count_i; -- internal signal associated to out port
countp: process(clk, reset)
begin
if (reset = '1') then
count_i <= 0;
elsif (clk'event and clk='1') then
count_i <= (count_I+1) mod 1024;
end if;
end process;
end rtl;
JV
Misc 3
Linkage port
Linkage ports are used to connect signal to foreign (non-VHDL)
design entities
Foreign language interface is simulator dependent (for example with
Modelsim linkage ports are not needed)
See simulator documentation if foreign language interface is needed
JV
Page 2
Misc 4
JV
Misc 5
Postponed processes
Postponed processes are triggered after all non-postponed
processes at the same simulation time are executed.
Example set-reset flipflop with output verification:
entity SR_flipflop is
port (s_n, r_n : in bit; q, q_n : inout bit);
begin
postponed process (q, q_n) is
begin
assert (now = 0 fs or q = not q_n)
report "implementation error: q != q_n";
end postponed process;
end SR_flipflop;
architecture dataflow of SR_flipflop is
begin
gate_1 : q <= s_n nand q_n;
gate_2 : q_n <= r_n nand q;
end dataflow;
JV
Page 3
Misc 6
Postponed processes
The condition that triggers a postponed process may not obtain when the
process is finally executed
because some other process may execute and remove that condition
JV
Misc 7
Shared variables
Normal variables are defined in processes, functions or procedures.
Shared variables are visible for multiple processes
signals are also, but they represent a part of the structure of a design (serves to
interconnect modules in the design)
variables are artifacts of simulation only
Language specification does not define the behavior of concurrent reads and
writes to shared variable in the the same simulation cycle
shared variables consept is still in the development stage
Page 4
Misc 8
Synthesis issues
JV
Misc 9
Logic synthesis
RTL-level
code
Constraints
Logic
synthesis
Gate level
netlist
Technology
libraries
JV
Page 5
Misc 10
JV
Misc 11
Partitioning
Register all outputs
clock
reset
process (clock, reset)
begin
if (reset = '1') then
output <= reset_value;
elsif (clock'event and clock = '1') then
output <= f(input);
end if;
end process;
JV
Page 6
Misc 12
Misc 13
comb
Bad:
comb
Good:
comb
comb
comb
comb
JV
Page 7
Misc 14
process (a)
begin
c <= a or b
end
a
c
b
b
c
a
b
Synthesized
netlist
Post-synthesis
simulation
waveform
RTL simulation
waveform
Misc 15
Bad:
type ample is (red, yellow, green);
Good:
type ample is (red, yellow, green, dummy);
JV
Page 8
Misc 16
Incomplete IF-statement
Entity adder is
port(a, b: in integer range 0 to 127;
ena : in boolean;
c : out integer range 0 to 255
);
end adder;
architecture bad_code of adder is
begin
add: process(a, b, ena)
begin
if (ena=true) then
c <= a + b;
end if;
end process;
end bad_code;
Misc 17
JV
Page 9
Misc 18
JV
Misc 19
JV
Page 10
Misc 20
JV
Misc 21
uP
core
User
logic
memory
JV
Std
interface
User logic
DSP
core
Page 11
3rd
party
IP
Misc 22
Hardware
Software
Co-Design
Implement
Co-Verify
Verify
JV
Code
Reuse
IP
Reuse
IP
SW Code
Implement
Design
HW Design
Reusable
IP
Integration
Implement
System
to
RTL
RTL
to
GDSII
Verify
Verify
Misc 23
SystemC
SystemC is C++ -based system level design language
C++ unifies hardware and software design
JV
Page 12
Misc 24
JV
Misc 25
Design exploration
Performance analysis
TF
HW/SW partition
Multitasking
Abstract RTOS
Inter process comm.
Scheduling / priority
Target RTOS
JV
Abstr.
RTOS
BCA
Abstr.
RTOS
CA
(RTL)
Page 13
Misc 26
P1
(master)
P2
(slave)
Misc 27
System C
Fixed point types
suitable for e.g. signal processing applications
C++ streams
Tools from EDA vendors
JV
Page 14
Misc 28
signal_in;
signal_out;
ex_module ex1("Our_DUT");
// DUT(synthesizable part)
ex1 << main_clk << signal_in << signal_out;
sink sink1("Test_bench_sink");
sink1 << main_clk << signal_out;
JV
Misc 29
local_variable;
array[16];
void ex_process();
//Constructor
SC_CTOR(ex_module) {
SC_CTHREAD(ex_process, CLK.pos());
}
//Destructor
~ ex_module() { }
};
JV
Page 15
Misc 30
JV
Page 16
Misc 31