Changeset 100 for trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Queue/src/Queue_vhdl_body.cpp
- Timestamp:
- Jan 8, 2009, 2:06:27 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property
svn:ignore
set to
Makefile.flags
Makefile.tools
Makefile.tools_path
-
Property
svn:ignore
set to
-
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Queue/src/Queue_vhdl_body.cpp
r81 r100 20 20 { 21 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 22 vhdl->set_comment(0,"---------------------------------------------------------------------------"); 23 vhdl->set_comment(0," Output"); 24 vhdl->set_comment(0,"---------------------------------------------------------------------------"); 25 vhdl->set_body (0,"out_INSERT_ACK <= not signal_FULL;"); 26 vhdl->set_body (0,"out_RETIRE_VAL <= not signal_EMPTY;"); 27 28 if (_param->_size_queue > 1) 29 vhdl->set_body (0,"out_RETIRE_DATA <= reg_DATA(conv_integer(signal_PTR_READ));"); 30 else 31 vhdl->set_body (0,"out_RETIRE_DATA <= reg_DATA(0);"); 32 33 vhdl->set_body (0,""); 34 vhdl->set_comment(0,"---------------------------------------------------------------------------"); 35 vhdl->set_comment(0," Slot"); 36 vhdl->set_comment(0,"---------------------------------------------------------------------------"); 37 vhdl->set_body (0,""); 38 if (_param->_nb_port_slot > 1) 39 for (uint32_t i=0; i<_param->_nb_port_slot; ++i) 40 if (i==0) 41 vhdl->set_body (0,"signal_SLOT_0 <= signal_PTR_READ;"); 42 else 43 { 44 if (is_power2(_param->_size_queue)) 45 vhdl->set_body (0,"signal_SLOT_"+toString(i)+" <= signal_PTR_READ+"+std_logic_cst(log2(_param->_size_queue),i)+";"); 46 else 47 vhdl->set_body (0,"signal_SLOT_"+toString(i)+" <= const_PTR_INIT when signal_SLOT_"+toString(i-1)+" = const_PTR_MAX else signal_SLOT_"+toString(i-1)+"+'1';"); 48 } 49 50 for (uint32_t i=0; i<_param->_nb_port_slot; ++i) 51 { 52 if (_param->_nb_port_slot > 1) 53 vhdl->set_body (0,"out_SLOT_"+toString(i)+"_VAL <= '1' when reg_NB_ELT > "+std_logic_cst(log2(_param->_size_queue+1),i)+" else '0';"); 54 else 55 vhdl->set_body (0,"out_SLOT_"+toString(i)+"_VAL <= not signal_EMPTY;"); 56 57 if (_param->_nb_port_slot > 1) 58 vhdl->set_body (0,"out_SLOT_"+toString(i)+"_DATA <= reg_DATA(conv_integer(signal_SLOT_"+toString(i)+"));"); 59 else 60 if (_param->_size_queue > 1) 61 vhdl->set_body (0,"out_SLOT_"+toString(i)+"_DATA <= reg_DATA(conv_integer(signal_PTR_READ));"); 62 else 63 vhdl->set_body (0,"out_SLOT_"+toString(i)+"_DATA <= reg_DATA(conv_integer(0));"); 64 } 65 66 vhdl->set_body (0,""); 67 vhdl->set_comment(0,"---------------------------------------------------------------------------"); 68 vhdl->set_comment(0," Signal"); 69 vhdl->set_comment(0,"---------------------------------------------------------------------------"); 70 vhdl->set_body (0,""); 71 vhdl->set_body (0,"signal_READ <= (not signal_EMPTY) and in_RETIRE_ACK;"); 72 vhdl->set_body (0,"signal_WRITE <= (not signal_FULL ) and in_INSERT_VAL;"); 73 vhdl->set_body (0,""); 74 if (_param->_nb_port_slot>1) 75 { 76 vhdl->set_body (0,"signal_EMPTY <= '1' when reg_NB_ELT = "+std_logic_cst(log2(_param->_size_queue+1),0)+" else '0';"); 77 if (is_power2(_param->_size_queue)) 78 vhdl->set_body (0,"signal_FULL <= reg_NB_ELT "+std_logic_range(log2(_param->_size_queue),log2(_param->_size_queue))+";"); 79 else 80 vhdl->set_body (0,"signal_FULL <= '1' when reg_NB_ELT = "+std_logic_cst(log2(_param->_size_queue+1),_param->_size_queue)+" else '0';"); 81 } 82 else 83 { 84 vhdl->set_body (0,"signal_EMPTY <= reg_EMPTY;"); 85 vhdl->set_body (0,"signal_FULL <= reg_FULL ;"); 86 } 87 vhdl->set_body (0,""); 88 if (_param->_size_queue > 1) 89 { 90 vhdl->set_body (0,"signal_PTR_READ <= reg_PTR_READ;"); 91 if (_param->_nb_port_slot>1) 92 { 93 if (is_power2(_param->_size_queue)) 94 vhdl->set_body (0,"signal_PTR_WRITE <= reg_PTR_READ + reg_NB_ELT"+std_logic_range(log2(_param->_size_queue))+";"); 95 else 96 vhdl->set_body (0,"signal_PTR_WRITE <= reg_PTR_READ + reg_NB_ELT"+std_logic_range(log2(_param->_size_queue))+" when reg_PTR_READ + reg_NB_ELT"+std_logic_range(log2(_param->_size_queue)) +" <= const_PTR_MAX else reg_PTR_READ + reg_NB_ELT"+std_logic_range(log2(_param->_size_queue))+" - const_PTR_MAX-'1';"); 97 } 98 else 99 vhdl->set_body (0,"signal_PTR_WRITE <= reg_PTR_WRITE;"); 100 } 101 vhdl->set_body (0,""); 102 103 if (_param->_nb_port_slot>1) 104 { 105 vhdl->set_body (0,""); 106 vhdl->set_comment(0," nb_elt"); 58 107 if (_param->_size_queue > 1) 59 108 { 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;"); 109 vhdl->set_body (0,"signal_NEXT_NB_ELT <= "); 110 vhdl->set_body (1,"reg_NB_ELT when (signal_READ xor signal_WRITE) = '0' else"); 111 if (_param->_size_queue > 2) 112 { 113 vhdl->set_body (1,"reg_NB_ELT +'1' when signal_WRITE='1' else"); 114 vhdl->set_body (1,"reg_NB_ELT -'1';"); 115 } 116 else 117 vhdl->set_body (1,"not reg_NB_ELT;"); 118 } 119 } 120 else 121 { 122 vhdl->set_body (0,"signal_PTR_EQUAL <="); 123 if (_param->_size_queue > 1) 124 { 125 vhdl->set_body (1,"'1' when signal_NEXT_PTR_READ = signal_NEXT_PTR_WRITE else"); 126 vhdl->set_body (1,"'0';"); 127 } 128 else 129 vhdl->set_body (1,"'1';"); 130 vhdl->set_body (0,"signal_NEXT_FULL <="); 131 vhdl->set_body (1,"'1' when signal_WRITE='1' and signal_PTR_EQUAL='1' else"); 132 vhdl->set_body (1,"'0' when signal_READ ='1' else"); 133 vhdl->set_body (1,"reg_FULL ;"); 134 vhdl->set_body (0,"signal_NEXT_EMPTY <="); 135 vhdl->set_body (1,"'1' when signal_READ ='1' and signal_PTR_EQUAL='1' else"); 136 vhdl->set_body (1,"'0' when signal_WRITE='1' else"); 137 vhdl->set_body (1,"reg_EMPTY;"); 138 vhdl->set_body (0,""); 139 140 vhdl->set_comment(0," write"); 141 if (_param->_size_queue > 1) 142 { 143 vhdl->set_body (0,"signal_NEXT_PTR_WRITE <= "); 144 vhdl->set_body (1,"reg_PTR_WRITE when signal_WRITE='0' else"); 145 if (is_log2(_param->_size_queue) == false) 146 vhdl->set_body (1,"const_PTR_INIT when reg_PTR_WRITE = const_PTR_MAX else"); 147 if (_param->_size_queue > 2) 148 vhdl->set_body (1,"reg_PTR_WRITE+'1';"); 149 else 150 vhdl->set_body (1,"not reg_PTR_WRITE;"); 151 } 152 } 153 154 vhdl->set_body (0,""); 155 vhdl->set_comment(0," read"); 156 if (_param->_size_queue > 1) 157 { 158 vhdl->set_body (0,"signal_NEXT_PTR_READ <= "); 159 vhdl->set_body (1,"reg_PTR_READ when signal_READ='0' else"); 160 if (is_log2(_param->_size_queue) == false) 161 vhdl->set_body (1,"const_PTR_INIT when reg_PTR_READ = const_PTR_MAX else"); 162 163 if (_param->_size_queue > 2) 164 vhdl->set_body (1,"reg_PTR_READ +'1';"); 165 else 166 vhdl->set_body (1,"not reg_PTR_READ;"); 167 } 168 vhdl->set_body (0,""); 169 170 vhdl->set_comment(0,"---------------------------------------------------------------------------"); 171 vhdl->set_comment(0," Registers"); 172 vhdl->set_comment(0,"---------------------------------------------------------------------------"); 173 vhdl->set_body (0,""); 174 vhdl->set_body (0,"queue_write: process (in_CLOCK)"); 175 vhdl->set_body (0,"begin -- process queue_write"); 176 vhdl->set_body (1,"if in_CLOCK'event and in_CLOCK = '1' then"); 177 vhdl->set_body (0,""); 178 vhdl->set_body (2,"if (in_NRESET = '0') then"); 179 if (_param->_size_queue > 1) 180 { 181 vhdl->set_body (3,"reg_PTR_READ <= const_PTR_INIT;"); 182 if (_param->_nb_port_slot>1) 183 vhdl->set_body (3,"reg_NB_ELT <= "+std_logic_cst(log2(_param->_size_queue+1),0)+";"); 184 else 185 vhdl->set_body (3,"reg_PTR_WRITE <= const_PTR_INIT;"); 186 } 187 if (_param->_nb_port_slot<=1) 188 { 189 vhdl->set_body (3,"reg_FULL <= '0';"); 190 vhdl->set_body (3,"reg_EMPTY <= '1';"); 191 } 192 vhdl->set_body (2,"else"); 193 if (_param->_size_queue > 1) 194 { 195 vhdl->set_body (3,"reg_PTR_READ <= signal_NEXT_PTR_READ ;"); 196 if (_param->_nb_port_slot>1) 197 vhdl->set_body (3,"reg_NB_ELT <= signal_NEXT_NB_ELT ;"); 198 else 199 vhdl->set_body (3,"reg_PTR_WRITE <= signal_NEXT_PTR_WRITE;"); 200 } 201 if (_param->_nb_port_slot<=1) 202 { 203 vhdl->set_body (3,"reg_FULL <= signal_NEXT_FULL ;"); 204 vhdl->set_body (3,"reg_EMPTY <= signal_NEXT_EMPTY;"); 205 } 206 vhdl->set_body (0,""); 207 vhdl->set_body (3,"if (signal_WRITE = '1') then"); 208 if (_param->_size_queue > 1) 209 vhdl->set_body (3,"\treg_DATA(conv_integer(signal_PTR_WRITE)) <= in_INSERT_DATA;"); 210 else 211 vhdl->set_body (3,"\treg_DATA(0) <= in_INSERT_DATA;"); 212 vhdl->set_body (3,"end if;"); 213 vhdl->set_body (2,"end if;"); 214 vhdl->set_body (0,""); 215 vhdl->set_body (1,"end if;"); 216 vhdl->set_body (0,"end process queue_write;"); 120 217 121 218 log_printf(FUNC,Queue,FUNCTION,"End");
Note: See TracChangeset
for help on using the changeset viewer.