OpenCores
URL https://opencores.org/ocsvn/avuc/avuc/trunk

Subversion Repositories avuc

[/] [avuc/] [trunk/] [example/] [max_mem.usm] - Blame information for rev 3

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 fblanco
&$clock clk
2
&$data_bus_min_width 0
3
&$entity max_mem
4
&$header
5
---------------------------------------------------------------------------------------
6
-- Copyright 2008 by USM
7
-- Description: Search for the maximum number in a memory.
8
---------------------------------------------------------------------------------------
9
 
10
 
11
&$include
12
   library ieee;
13
   use ieee.std_logic_1164.all;
14
   use ieee.std_logic_unsigned.all;
15
 
16
   library work;
17
   use work.usm_pkg.all;
18
 
19
&$generic
20
&$port
21
   -- Main clock:
22
   clk: in std_logic;
23
   -- Memory data bus:
24
   mem_data: in std_logic_vector(7 downto 0);
25
   -- Memory address bus:
26
   mem_addr: out std_logic_vector(6 downto 0);
27
 
28
&$sig_declaration
29
 
30
   -- Temporary maximum number
31
   signal max_number: std_logic_vector(mem_data'range);
32
   -- Copy of output:
33
   signal mem_addr_s: std_logic_vector(mem_addr'range);
34
 
35
&$opcode_def mem_addr_s
36
   &$mem_addr_ini
37
      &$cycle_def 1
38
         mem_addr_s <= (others => '0');
39
   &$mem_addr_inc
40
      &$cycle_def 1
41
         mem_addr_s <= mem_addr_s + 1;
42
&$end_opcode_def
43
 
44
&$opcode_def max_number
45
   &$max_number_ini
46
      &$cycle_def 1
47
         max_number <= (others => '0');
48
   &$max_number_assign
49
      &$cycle_def 1
50
         max_number <= mem_data;
51
&$end_opcode_def
52
 
53
 
54
&$jump_opcode_def
55
   &$condition jump_if_mem_addr_eq_last
56
      mem_addr_s = (mem_addr_s'range => '1')
57
   &$condition jump_if_mem_data_lt_max
58
      mem_data < max_number
59
 
60
 
61
&$prog_code
62
   mem_addr_ini
63
   max_number_ini
64
   loop1: jump_if_mem_data_lt_max next1
65
      max_number_assign
66
      next1: jump_if_mem_addr_eq_last end
67
      mem_addr_inc
68
   jump loop1
69
 
70
&$extra_code
71
   mem_addr <= mem_addr_s;
72
 
73
 
74
&$end_usm
75
 
76
 
77
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.