Académique Documents
Professionnel Documents
Culture Documents
entity XOR_GATE is
Let us consider again the structural specification for the port(X, Y:in BIT; Z:out BIT);
four bit parity generator: end XOR_GATE;
entity INV is
port(X:in BIT; Z:out BIT);
end INV;
Configuration Specification
Clk
entity DFF is
• The generation_scheme can be for or if. port(D,CLK:in BIT; Q,QB:out BIT);
end Dff;
use Work.all;
entity SHIFT_4 is architecture SHIFT_GENERATE_1 of SHIFT_4 is
port(A,CLK:in BIT; B:out BIT); component DFF
end SHIFT_4; port(D,CLK:in BIT; Q,QB:out BIT);
end component;
use Work.all; signal Z: array(0 to 4) of BIT;
architecture SHIFT_SIMPLE of SHIFT_4 is begin
component DFF Z(0)<=A;
port(D,CLK:in BIT; Q,QB:out BIT); Q1:for I in 0 to 3 generate
end component; DFFx:DFF port map(Z(I),CLK,Z(I+1),open);
signal Z: array(1 to 3) of BIT; end generate;
begin B<=Z(4);
DFF1:DFF port map(A,CLK,Z(1),open); end SHIFT_GENERATE_1;
DFF2:DFF port map(Z(1),CLK,Z(2),open);
DFF3:DFF port map(Z(2),CLK,Z(3),open);
DFF4:DFF port map(Z(3),CLK,B,open);
end SHIFT_SIMPLE;
Irregularities can be handled using a generate statement with A shift register model of configurable length:
an if scheme:
entity SHIFT_N is
generic(LEN:integer);
use Work.all; port(A,CLK:in BIT; B:out BIT);
architecture SHIFT_GENERATE_2 of SHIFT_4 is end SHIFT_4;
component DFF
port(D,CLK:in BIT; Q,QB:out BIT); use Work.all;
end component; architecture SHIFT_N_GENERATE of SHIFT_N is
signal Z: array(1 to 3) of BIT; component DFF
begin port(D,CLK:in BIT; Q,QB:out BIT);
Q1:for I in 0 to 3 generate end component;
Q2:if I=0 generate signal Z: array(1 to LEN-1) of BIT;
DFFfirst:DFF port map(A,CLK,Z(1),open); begin
end generate; Q1:for I in 0 to LEN-1 generate
Q3:if I=3 generate Q2:if I=0 generate
DFFlast:DFF port map(Z(3),CLK,B,open); DFFfirst:DFF port map(A,CLK,Z(1),open);
end generate; end generate;
Q4:if I>0 and I<3 generate Q3:if I=LEN-1 generate
DFFx:DFF port map(Z(I),CLK,Z(I+1),open); DFFlast:DFF port map(Z(LEN-1),CLK,B,open);
end generate; end generate;
end generate; Q4:if I>0 and I<LEN-1 generate
end SHIFT_GENERATE_2; DFFx:DFF port map(Z(I),CLK,Z(I+1),open);
end generate;
end generate;
end SHIFT_N_GENERATE;
Datorstödd Elektronikkonstruktion Fö 4 - 15
Summary