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

Last change on this file since 68 was 68, checked in by rosiere, 16 years ago

read_queue : systemC et vhdl ok !
queue : quelques petits modif pour avoir une queue de taille 1
nettoyage des fichiers *mkf*

File size: 4.8 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
65        if (_param->_size_queue > 2)
66          vhdl->set_body ("\treg_PTR_READ +'1';");
67        else
68          vhdl->set_body ("\tnot reg_PTR_READ;");
69      }
70    vhdl->set_body ("");
71    vhdl->set_body ("-- write");
72    vhdl->set_body ("signal_WRITE          <= (not reg_FULL ) and in_INSERT_VAL;");
73    if (_param->_size_queue > 1)
74      {
75        vhdl->set_body ("signal_NEXT_PTR_WRITE <= ");
76        vhdl->set_body ("\treg_PTR_WRITE  when signal_WRITE='0' else");
77        if (is_log2(_param->_size_queue) == false)
78          vhdl->set_body ("\tconst_PTR_INIT when reg_PTR_WRITE = const_PTR_MAX else");
79        if (_param->_size_queue > 2)
80          vhdl->set_body ("\treg_PTR_WRITE+'1';");
81        else
82          vhdl->set_body ("\tnot reg_PTR_WRITE;");
83      }
84    vhdl->set_body ("");
85    vhdl->set_body ("-----------------------------------------------------------------------------");
86    vhdl->set_body ("-- Registers");
87    vhdl->set_body ("-----------------------------------------------------------------------------");
88    vhdl->set_body ("");
89    vhdl->set_body ("queue_write: process (in_CLOCK)");
90    vhdl->set_body ("begin  -- process queue_write");
91    vhdl->set_body ("\tif in_CLOCK'event and in_CLOCK = '1' then");
92    vhdl->set_body ("");
93    vhdl->set_body ("\t\tif (in_NRESET = '0') then");   
94    if (_param->_size_queue > 1)
95      {
96        vhdl->set_body ("\t\t\treg_PTR_READ  <= const_PTR_INIT;");
97        vhdl->set_body ("\t\t\treg_PTR_WRITE <= const_PTR_INIT;");
98      }
99    vhdl->set_body ("\t\t\treg_FULL      <= '0';");
100    vhdl->set_body ("\t\t\treg_EMPTY     <= '1';");
101    vhdl->set_body ("\t\telse");
102    if (_param->_size_queue > 1)
103      {
104        vhdl->set_body ("\t\t\treg_PTR_READ  <= signal_NEXT_PTR_READ ;");
105        vhdl->set_body ("\t\t\treg_PTR_WRITE <= signal_NEXT_PTR_WRITE;");
106      }
107    vhdl->set_body ("\t\t\treg_FULL      <= signal_NEXT_FULL ;");
108    vhdl->set_body ("\t\t\treg_EMPTY     <= signal_NEXT_EMPTY;");
109    vhdl->set_body ("");
110    vhdl->set_body ("\t\t\tif (signal_WRITE = '1') then");   
111    if (_param->_size_queue > 1)
112      vhdl->set_body ("\t\t\t\treg_DATA(conv_integer(reg_PTR_WRITE)) <= in_INSERT_DATA;");
113    else
114      vhdl->set_body ("\t\t\t\treg_DATA(0) <= in_INSERT_DATA;");
115    vhdl->set_body ("\t\t\tend if;");
116    vhdl->set_body ("\t\tend if;");
117    vhdl->set_body ("");
118    vhdl->set_body ("\tend if;");
119    vhdl->set_body ("end process queue_write;");
120
121    log_printf(FUNC,Queue,FUNCTION,"End");
122  };
123
124}; // end namespace queue
125}; // end namespace generic
126
127}; // end namespace behavioural
128}; // end namespace morpheo             
129#endif
Note: See TracBrowser for help on using the repository browser.