2.2 Structdes
2.2 Structdes
2.2 Structdes
Jiri Gaisler
q
Comb
d q = f(d,qr)
DFF
qr
Clk
Implementing the abstracted view in VHDL:
The two-process scheme
A VHDL entity is made to contain only two processes: one
sequential and one combinational
Two local signals are declared:
register-in (r i n ) and register-out (r )
The full algorithm (q = f(d,r ))is performed in the
combinational process
The combinational process is sensitive to all input ports and
the register outputs r
The sequential process is only sensitive to the clock
Two-process VHDL entity
qc Out-port
In-ports Comb.
d Process
qcn = f(d,r) r in Seq.
Process
r
Clk
Two-process scheme: data types
end architecture;
Hierarchical design
use work.interface.all;
Grouping of signals makes
entity cpu is port (
code readable and shows the clk : in std_logic;
direction of the dataflow rst : in std_logic;
mem_in : in mem_in_type;
mem_out : out mem_out_type);
end;
Clk, rst
Proc architecture rtl of cpu is
signal cache_out : cache_type;
signal proc_out : proc_type;
signal mctrl_out : mctrl_type;
begin
Cache
u0 : proc port map
(clk, rst, cache_out, proc_out);
end architecture;
Memory
Benefits
1 entity, 2 processes
44 sub-programs
13 signal assignments
Reverse-engineered from
verilog: 87 entities, ~800
processes, ~2500 signals
Sequential code and synthesis
rin <= v;
Avoid recursion, division, access irqo.irq <= r.irq;
types, text/file IO. end process;
Comparison MEC/LEON
Benefits Problems
Easier to understand the Keep the code synthesisable
underlying algorithm
Synthesis tool might choose
Easier to modify/maintain wrong gate-level structure
Faster simulation Problems to understand
algorithm for less skilled
Use built-in module engineers
generators (synthesis)
Using records
variable v : regtype;
v.reg1.f3 := “0011001100”;
Using ieee.std_logic_arith.all;