[2] | 1 | #ifdef VHDL |
---|
| 2 | /* |
---|
| 3 | * $Id$ |
---|
| 4 | * |
---|
| 5 | * [ Description ] |
---|
| 6 | * |
---|
| 7 | */ |
---|
| 8 | |
---|
| 9 | #include "Behavioural/Generic/RegisterFile/include/RegisterFile.h" |
---|
| 10 | |
---|
| 11 | namespace morpheo { |
---|
| 12 | namespace behavioural { |
---|
| 13 | namespace generic { |
---|
| 14 | namespace registerfile { |
---|
| 15 | |
---|
| 16 | void RegisterFile::vhdl_body (Vhdl & vhdl) |
---|
| 17 | { |
---|
| 18 | vhdl.set_body (""); |
---|
| 19 | vhdl.set_body ("-----------------------------------------------------------------------------"); |
---|
| 20 | vhdl.set_body ("-- Read RegisterFile"); |
---|
| 21 | vhdl.set_body ("-----------------------------------------------------------------------------"); |
---|
| 22 | vhdl.set_body (""); |
---|
| 23 | |
---|
| 24 | for (uint32_t i = 0; i < _param._nb_port_read; i++) |
---|
| 25 | vhdl.set_body ("out_READ_DATA_"+toString(i)+" <= reg_DATA (conv_integer(in_READ_ADDRESS_"+toString(i)+")) when in_READ_ENABLE_"+toString(i)+" = '1' else "+std_logic_others(_param._size_word,0)+";"); |
---|
| 26 | |
---|
| 27 | vhdl.set_body (""); |
---|
| 28 | vhdl.set_body ("-----------------------------------------------------------------------------"); |
---|
| 29 | vhdl.set_body ("-- Write RegisterFile"); |
---|
| 30 | vhdl.set_body ("-----------------------------------------------------------------------------"); |
---|
| 31 | vhdl.set_body (""); |
---|
| 32 | |
---|
| 33 | vhdl.set_body ("RegisterFile_write: process (in_CLOCK)"); |
---|
| 34 | vhdl.set_body ("begin -- process RegisterFile_write"); |
---|
| 35 | vhdl.set_body ("\tif in_CLOCK'event and in_CLOCK = '1' then"); |
---|
| 36 | |
---|
| 37 | for (uint32_t i = 0; i < _param._nb_port_write; i++) |
---|
| 38 | { |
---|
| 39 | vhdl.set_body ("\t\tif (in_WRITE_ENABLE_"+toString(i)+" = '1') then"); |
---|
| 40 | vhdl.set_body ("\t\t\treg_DATA(conv_integer(in_WRITE_ADDRESS_"+toString(i)+")) <= in_WRITE_DATA_"+toString(i)+";"); |
---|
| 41 | vhdl.set_body ("\t\tend if;"); |
---|
| 42 | } |
---|
| 43 | |
---|
| 44 | vhdl.set_body ("\tend if;"); |
---|
| 45 | vhdl.set_body ("end process RegisterFile_write;"); |
---|
| 46 | }; |
---|
| 47 | |
---|
| 48 | }; // end namespace registerfile |
---|
| 49 | }; // end namespace generic |
---|
| 50 | }; // end namespace behavioural |
---|
| 51 | }; // end namespace morpheo |
---|
| 52 | #endif |
---|