Basic Modeling Constructs - Computer-Aided Circuit Design - Lecture Slides, Slides of Computer Science

These are the Lecture Slides of Aided Circuit Design which includes Vhdl Model, Aliases for Data Objects, Alias Declaration, Type Register, Arguments of Different Length, Aliases for Non-Data Items, Type Alias, Literal Alias, Procedure Alias etc.Key important points are: Basic Modeling Constructs, Entity Declaration, Entity Adder, Default Values, Architecture Bodies, Internal Operations, Concurrent Statements, Process Statements, Signal Declarations

Typology: Slides

2012/2013

Uploaded on 03/27/2013

agarkar
agarkar 🇮🇳

4.3

(26)

372 documents

1 / 84

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Basic Modeling Constructs
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54

Partial preview of the text

Download Basic Modeling Constructs - Computer-Aided Circuit Design - Lecture Slides and more Slides Computer Science in PDF only on Docsity!

Basic Modeling Constructs

Entity Declaration

• EBNF: see page 108

• Example:

entity adder is port ( a : in word; b : in word; sum : out word ); end entity adder; entity adder is port ( a, b : in word; sum : out word ); end entity adder;

library ieee; use ieee.std_logic_1164.all; entity program_ROM is port ( address : in std_ulogic_vector(14 downto 0); data : out std_ulogic_vector(7 downto 0); enable : in std_ulogic ); subtype instruction_byte is bit_vector(7 downto 0); type program_array is array (0 to 2**14 - 1) of instruction_byte; constant program : program_array := ( X"32", X"3F", X"03", -- LDA $3F X"71", X"23", -- BLT $ others => X"00" --... ); end entity program_ROM;

Architecture Bodies

  • Architecture bodies describe the internal operations of modules
  • EBNF: see 110
  • Example: architecture abstract of adder is begin add_a_b : process (a, b) is begin sum <= a + b; end process add_a_b; end architecture abstract;

Signal Declarations

• EBNF: see page 111

• Example: next page

architecture primitive of and_or_inv is signal and_a, and_b : bit; signal or_a_b : bit; begin and_gate_a : process (a1, a2) is begin and_a <= a1 and a2; end process and_gate_a; and_gate_b : process (b1, b2) is begin and_b <= b1 and b2; end process and_gate_b; or_gate : process (and_a, and_b) is begin or_a_b <= and_a or and_b; end process or_gate; inv : process (or_a_b) is begin y <= not or_a_b; end process inv; end architecture primitive;

Signal Assignment

• Clock generator:

clock_gen : process (clk) is

begin

if clk = '0' then

clk <= '1' after T_pw, '0' after 2*T_pw;

end if;

end process clock_gen;

Signal Assignment

  • Two-input multiplexer

mux : process (a, b, sel) is begin case sel is when '0' => z <= a after prop_delay; when '1' => z <= b after prop_delay; end case; end process mux;

Signal Attributes

• Given a signal S and a value T of type time

  • S’event: true if there is an event on S in the

current simulation cycle

  • S’active: true if there is a transaction on S in the

current simulation cycle

  • S’last_event: the time interval since the last event

on S

  • S’last_active: the time interval since the last

transaction on S

  • S’last_value: the value of S just before the last

event on S

Signal Attributes

• Example: check setup time requirement

if clk'event and (clk = '1' or clk = 'H') and (clk'last_value = '0' or clk'last_value = 'L') then assert d'last_event >= Tsu report "Timing error: d changed within setup time of clk"; end if;

Wait Statements

• EBNF: see page 118

• Wait statement causes the process to suspend

execution

• Sensitivity clause: on signal_names

• Condition clause: until boolean_expression

• Timeout clause: for time_expression

Wait Statements

• Example:

half_add : process is

begin

sum <= a xor b after T_pd;

carry <= a and b after T_pd;

wait on a, b;

end process half_add Docsity.com

entity mux2 is

port ( a, b, sel : in bit; z : out bit );

end entity mux2;


architecture behavioral of mux2 is

constant prop_delay : time := 2 ns;

begin

slick_mux : process is begin case sel is when '0' => z <= a after prop_delay; wait on sel, a; when '1' => z <= b after prop_delay; wait on sel, b; end case; end process slick_mux;

end architecture behavioral; Docsity.com

Wait Statements

• Example

wait until clk = ‘1’;

Cause the executing process to suspend until the

value of the signal clk changes to ‘1’

  • Note that if the wait statement does not include a

sensitivity clause, the condition is tested

whenever an event occurs on any of the signals

mentioned in the condition

  • wait on clk until reset=‘0’; reset is tested when clk

change