































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!
































array_type <= array ( discrete_range { , … } ) of element_subtype_indication ;
discrete_range <= discrete_subtype_indication | expr (to |downto ) expr discrete_subtype_indication <= type_mark [ range expr ( to |downto ) expr ]
**entity coeff_ram is port ( rd, wr : in bit; addr : in coeff_ram_address; d_in : in real; d_out : out real ); end entity coeff_ram;
architecture abstract of coeff_ram is begin**
memory : process is type coeff_array is array (coeff_ram_address) of real; variable coeff : coeff_array; begin -- see next page end process memory;
end architecture abstract;
memory : process is type coeff_array is array (coeff_ram_address) of real; variable coeff : coeff_array; begin for index in coeff_ram_address loop coeff(index) := 0.0; end loop; loop wait on rd, wr, addr, d_in; if rd = '1' then d_out <= coeff(addr); end if; if wr = '1' then coeff(addr) := d_in; end if; end loop; end process memory;
type point is array (1 to 3) of real; type matrix is array (1 to 3, 1 to 3) of real;
variable p, q : point; variable transform : matrix;
for i in 1 to 3 loop q(i) := 0.0; for j in 1 to 3 loop q(i) := q(i) + transform(i, j) * p(j); end loop; end loop; Docsity.com
type point is array (1 to 3) of real;
constant origin : point := (0.0, 0.0, 0.0); variable view_point : point := (10.0, 20.0, 0.0);
variable view_point : point := (1=>10.0, 2=>20.0, 3=>0.0); variable coeff : coeff_array := (0=>1.6, 1=>2.3, 2=>1.6, 3 to 63 => 0.0); variable coeff : coeff_array := (0=>1.6,1=>2.3, 2=>1.6, others => 0.0); Docsity.com
modem_controller : process is -- Fig 4-3 on page 91
type symbol is ('a', 't', 'd', 'h', digit, cr, other); type symbol_string is array (1 to 20) of symbol; type state is range 0 to 6; type transition_matrix is array (state, symbol) of state; constant next_state : transition_matrix := ( 0 => ('a' => 1, others => 6), 1 => ('t' => 2, others => 6), 2 => ('d' => 3, 'h' => 5, others => 6), 3 => (digit => 4, others => 6), 4 => (digit => 4, cr => 0, others => 6), 5 => (cr => 0, others => 6), 6 => (cr => 0, others => 6) ); variable command : symbol_string; variable current_state : state := 0;
modem_controller : process is -- previous page begin --... for index in 1 to 20 loop current_state := next_state( current_state, command(index) ); case current_state is --... end case;
end process modem_controller;
entity byte_swap is -- useful example 2
port (input : in halfword; output : out halfword);
end entity byte_swap;
architecture behavior of byte_swap is
begin
swap : process (input) begin output(8 to 15) <= input(0 to 7); output(0 to 7) <= input(8 to 15); end process swap;
end architecture behavior;
-- free_map is an array of bits count := 0; for index in free_map'range loop if free_map(index) = '1' then count := count + 1; end if; end loop;
type string is array (positive range<>) of character;
constant LCD_DISPLAY_LEN: positive :=20; subtype LCD_display_string is string(1 to LCD_DISPLAY_LEN); variable LCD_display: LCD_display_string := (others => ‘ ‘); constant ready_message : string := "Ready ";
type bit_vector is array (natural range <>) of bit;
subtype byte is bit_vector(7 downto 0);
variable channel_busy_register : bit_vector(1 to 4);