source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Queue/src/Queue_vhdl_body.cpp @ 67

Last change on this file since 67 was 67, checked in by rosiere, 17 years ago

Ajout d'un nouveau composant : fifo generic (un port lecture et un port ecriture).

File size: 4.6 KB
Line 
1#ifdef VHDL
2/*
3 * $Id$
4 *
5 * [ Description ]
6 *
7 */
8
9#include "Behavioural/Generic/Queue/include/Queue.h"
10
11namespace morpheo                    {
12namespace behavioural {
13namespace generic {
14namespace queue {
15
16
17#undef  FUNCTION
18#define FUNCTION "Queue::vhdl_body"
19  void Queue::vhdl_body (Vhdl * & vhdl)
20  {
21    log_printf(FUNC,Queue,FUNCTION,"Begin");
22    vhdl->set_body ("-----------------------------------------------------------------------------");
23    vhdl->set_body ("-- Output");
24    vhdl->set_body ("-----------------------------------------------------------------------------");
25    vhdl->set_body ("out_INSERT_ACK        <= not reg_FULL;");
26    vhdl->set_body ("out_RETIRE_VAL        <= not reg_EMPTY;");
27       
28    if (_param->_size_queue > 1)
29      vhdl->set_body ("out_RETIRE_DATA       <= reg_DATA(conv_integer(reg_PTR_READ));");
30    else
31      vhdl->set_body ("out_RETIRE_DATA       <= reg_DATA(0);");
32
33    vhdl->set_body ("");
34    vhdl->set_body ("-----------------------------------------------------------------------------");
35    vhdl->set_body ("-- Signal");
36    vhdl->set_body ("-----------------------------------------------------------------------------");
37    vhdl->set_body ("");
38    vhdl->set_body ("signal_PTR_EQUAL      <=");
39    if (_param->_size_queue > 1)
40      {
41        vhdl->set_body ("\t'1' when signal_NEXT_PTR_READ = signal_NEXT_PTR_WRITE else");
42        vhdl->set_body ("\t'0';");
43      }
44    else
45      vhdl->set_body ("\t'1';");
46    vhdl->set_body ("signal_NEXT_FULL      <=");
47    vhdl->set_body ("\t'1' when signal_WRITE='1' and signal_PTR_EQUAL='1' else");
48    vhdl->set_body ("\t'0' when signal_READ ='1'                          else");
49    vhdl->set_body ("\treg_FULL ;");
50    vhdl->set_body ("signal_NEXT_EMPTY     <=");
51    vhdl->set_body ("\t'1' when signal_READ ='1' and signal_PTR_EQUAL='1' else");
52    vhdl->set_body ("\t'0' when signal_WRITE='1'                          else");
53    vhdl->set_body ("\treg_EMPTY;");
54    vhdl->set_body ("");
55    vhdl->set_body ("-- read");
56    vhdl->set_body ("signal_READ           <= (not reg_EMPTY) and in_RETIRE_ACK;");
57
58    if (_param->_size_queue > 1)
59      { 
60        vhdl->set_body ("signal_NEXT_PTR_READ  <= ");
61        vhdl->set_body ("\treg_PTR_READ   when signal_READ='0' else");
62        if (is_log2(_param->_size_queue) == false)
63          vhdl->set_body ("\tconst_PTR_INIT when reg_PTR_READ  = const_PTR_MAX else");
64        vhdl->set_body ("\treg_PTR_READ +'1';");
65      }
66    vhdl->set_body ("");
67    vhdl->set_body ("-- write");
68    vhdl->set_body ("signal_WRITE          <= (not reg_FULL ) and in_INSERT_VAL;");
69    if (_param->_size_queue > 1)
70      {
71        vhdl->set_body ("signal_NEXT_PTR_WRITE <= ");
72        vhdl->set_body ("\treg_PTR_WRITE  when signal_WRITE='0' else");
73        if (is_log2(_param->_size_queue) == false)
74          vhdl->set_body ("\tconst_PTR_INIT when reg_PTR_WRITE = const_PTR_MAX else");
75        vhdl->set_body ("\treg_PTR_WRITE+'1';");
76      }
77    vhdl->set_body ("");
78    vhdl->set_body ("-----------------------------------------------------------------------------");
79    vhdl->set_body ("-- Registers");
80    vhdl->set_body ("-----------------------------------------------------------------------------");
81    vhdl->set_body ("");
82    vhdl->set_body ("queue_write: process (in_CLOCK)");
83    vhdl->set_body ("begin  -- process queue_write");
84    vhdl->set_body ("\tif in_CLOCK'event and in_CLOCK = '1' then");
85    vhdl->set_body ("");
86    vhdl->set_body ("\t\tif (in_NRESET = '0') then");   
87    if (_param->_size_queue > 1)
88      {
89        vhdl->set_body ("\t\t\treg_PTR_READ  <= const_PTR_INIT;");
90        vhdl->set_body ("\t\t\treg_PTR_WRITE <= const_PTR_INIT;");
91      }
92    vhdl->set_body ("\t\t\treg_FULL      <= '0';");
93    vhdl->set_body ("\t\t\treg_EMPTY     <= '1';");
94    vhdl->set_body ("\t\telse");
95    if (_param->_size_queue > 1)
96      {
97        vhdl->set_body ("\t\t\treg_PTR_READ  <= signal_NEXT_PTR_READ ;");
98        vhdl->set_body ("\t\t\treg_PTR_WRITE <= signal_NEXT_PTR_WRITE;");
99      }
100    vhdl->set_body ("\t\t\treg_FULL      <= signal_NEXT_FULL ;");
101    vhdl->set_body ("\t\t\treg_EMPTY     <= signal_NEXT_EMPTY;");
102    vhdl->set_body ("");
103    vhdl->set_body ("\t\t\tif (signal_WRITE = '1') then");   
104    if (_param->_size_queue > 1)
105      vhdl->set_body ("\t\t\t\treg_DATA(conv_integer(reg_PTR_WRITE)) <= in_INSERT_DATA;");
106    else
107      vhdl->set_body ("\t\t\t\treg_DATA(0) <= in_INSERT_DATA;");
108    vhdl->set_body ("\t\t\tend if;");
109    vhdl->set_body ("\t\tend if;");
110    vhdl->set_body ("");
111    vhdl->set_body ("\tend if;");
112    vhdl->set_body ("end process queue_write;");
113
114    log_printf(FUNC,Queue,FUNCTION,"End");
115  };
116
117}; // end namespace queue
118}; // end namespace generic
119
120}; // end namespace behavioural
121}; // end namespace morpheo             
122#endif
Note: See TracBrowser for help on using the repository browser.