Docsity

VHDL: Understanding Concurrent and Sequential Data Processing and Assignments, Slides of Computer Science

Partial preview of the text

Download VHDL: Understanding Concurrent and Sequential Data Processing and Assignments and more Slides Computer Science in PDF only on Docsity!

Sequential VHDL

  • Concurrent and sequential data processing
  • Signal and variable assignment
  • Process statement
    • Combinational process
    • Clocked process
  • If statement
  • Case statement
  • Multiple statement
  • Null statement
  • Wait statement

Concurrent and sequential data

processing

  • Designing sequential processes presents a new design dimension to hardware designers who have worked at gate level
  • First we look at concurrent and sequential data processing
  • The difference between sequential and concurrent assignment is important to understand
  • Electronics are parallel by nature
  • In practice, all the gates in a circuit diagram can be seen as concurrently “executing” units
  • In VHDL there are language constructions which can handle both concurrent and sequential data processing
  • Many of the VHDL commands are only valid in the concurrent or sequential part of VHDL

Sequential VHDL constructions

  • If-then-else statement
  • Case statement
  • Variable statement
  • Variable assignment
  • Loop statement
  • Return statement
  • Null statement
  • Wait statement

VHDL commands being valid in both the concurrent

and the sequential parts

  • Signal assignment
  • Declaration of type s and constant s
  • Function and procedure calls
  • Assert statement
  • After delay
  • Signal assignment

Comparison of signal and variable

assignment

  • Signal s and variable s are used frequently in VHDL code, but they represent completely different implementations.
  • Variable s are used for sequential execution like other algorithmic programs, while signal s are used for concurrent execution.
  • Variable and signal assignment are differentiated using the symbols “:=“ and “<=“
  • A variable can only be declared and used in the sequential part of VHDL.
  • Signal s can only be declared in the concurrent part of VHDL but can be used in both the sequential and concurrent parts.
  • A variable can be declared for exactly the same data types as a signal.
  • It is also permissible to assign a variable the value of a signal and vice versa, provided that they have the same data type.
  • The big difference between a signal and a variable is that the signal is only assigned its value after a delta delay, while the variable is given its value immediately.

Variable assignment statement

variable_assignment_statement ::=

[ label : ] target := expression ;

  • Examples:
    • var := 0;
var receives the value 0.
  • a := b;
a receives the current value of b.
  • a := my_function ( data, 4 );
a receives the result of the function my_function as a new value.

Differences between signal and

variable processing

  • The lines in the sequential VHDL

code are executed line by line

  • That is why it is called sequential VHDL
  • In concurrent VHDL code, the lines

are only executed when an event on

the sensitivity list occurs

  • This sensitivity list is explicit in case of

process

Differences between signals and variables

  • Sum1 and sum

are signals

p0: process

begin

wait for 10 ns;

sum1<=sum1+1;

sum2<=sum1+1;

end process ;

Time Sum1 Sum2 Sum1 Sum
10 + ∆^1 1 1
30 + ∆^3 3 3

 Sum1 and sum2 are variables p1: process variable sum1, sum2: integer; begin wait for 10 ns; sum1:=sum1+1; sum2:=sum1+1; end process ;

Global variables

  • Shared

variable s are

not accessible

in the

concurrent

part of VHDL

code, but only

inside other

process es.

  • Nor can a

shared

Architecture bhv of ex is

shared variable v: std_logic_vector(3 downto 0);

begin

p0: process (a, b) begin v:=a & b; end process ; p1: process (d) begin if v=“0110” then c<=d; else c<=( others =>‘0’); end if ; end process ;

end ;

Docsity.com

Process statement

  • The process concept comes from software and can

be compared to a sequential program.

  • If there are several processes in an architecture,

they are executed concurrently.

  • A process can be in Waiting or Executing state.
Executing Waiting
start

 If the state is Waiting, a condition must be satisfied, e.g. wait until clk=‘1’;.

 This means that the process will start when clk has a rising edge.

 Then the process will be Executing.

 Once it has executed the code, it will wait for the next rising edge.

 The condition after the until means not only the necessity of the value ‘1’, but

also the necessity of changing the value to ‘1’.

Example to test the “wait until”

command - stimulus generator

entity stm is

port (a,clk: out bit; y:

in bit);

end;

architecture dtf of stm

is

begin

a<='1' after 20 ns, Docsity.com

Example to test the “wait until”

command - test bench I

entity bnc is

end;

use std.textio.all;

Architecture str of bnc is

Component cir port (a,clk:in bit;y:out bit); end

Component;

Component stm port (a,clk:out bit;y:in bit); end

Component;

Example to test the “wait until”

command - test bench III

data_monitoring:process

(a,clk,y)

variable dline:line;

begin

write

(dline,now,right,7);

write (dline,a,right,6);

write

(dline,clk,right,4); Docsity.com

Example to test the “wait until”

command - simulation result

# Loading

c:_vhdl\bin\lib\std.stan

dard

# Loading

c:_vhdl\bin\lib\std.texti

o

# Loading

c:_vhdl\bin\lib\work.bn