source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile_Monolithic_vhdl_body.cpp @ 62

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

Modification en profondeur de Component-port_map.
Compilation ok pour Register_unit ... a tester (systemC et vhdl)

File size: 3.9 KB
Line 
1#ifdef VHDL
2/*
3 * $Id$
4 *
5 * [ Description ]
6 *
7 */
8
9#include "Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/include/RegisterFile_Monolithic.h"
10
11namespace morpheo                    {
12namespace behavioural                {
13namespace generic                    {
14namespace registerfile               {
15namespace registerfile_monolithic    {
16
17  void RegisterFile_Monolithic::vhdl_body (Vhdl * & vhdl)
18  {
19    vhdl->set_body ("");
20    vhdl->set_body ("-----------------------------------------------------------------------------");
21    vhdl->set_body ("-- Ackitement");
22    vhdl->set_body ("-----------------------------------------------------------------------------");
23    vhdl->set_body ("");
24
25    for (uint32_t i = 0; i < _param->_nb_port_read; i++)
26      vhdl->set_body ("out_READ_"+toString(i)+"_ACK  <= '1';");
27    for (uint32_t i = 0; i < _param->_nb_port_write; i++)
28      vhdl->set_body ("out_WRITE_"+toString(i)+"_ACK <= '1';");
29    for (uint32_t i = 0; i < _param->_nb_port_read_write; i++)
30      vhdl->set_body ("out_READ_WRITE_"+toString(i)+"_ACK  <= '1';");
31
32    vhdl->set_body ("");
33    vhdl->set_body ("-----------------------------------------------------------------------------");
34    vhdl->set_body ("-- Read RegisterFile");
35    vhdl->set_body ("-----------------------------------------------------------------------------");
36    vhdl->set_body ("");
37   
38    for (uint32_t i = 0; i < _param->_nb_port_read; i++)
39      {
40        string str_address;
41        if (_param->_have_port_address)
42          str_address = "conv_integer(in_READ_"+toString(i)+"_ADDRESS)";
43        else
44          str_address = "0";
45
46        vhdl->set_body ("out_READ_"+toString(i)+"_DATA <= reg_DATA ("+str_address+") when in_READ_"+toString(i)+"_VAL = '1' else "+std_logic_others(_param->_size_word,0)+";");
47      }
48    for (uint32_t i = 0; i < _param->_nb_port_read_write; i++)
49      {
50        string str_address;
51        if (_param->_have_port_address)
52          str_address = "conv_integer(in_READ_WRITE_"+toString(i)+"_ADDRESS)";
53        else
54          str_address = "0";
55        vhdl->set_body ("out_READ_WRITE_"+toString(i)+"_RDATA <= reg_DATA ("+str_address+") when in_READ_WRITE_"+toString(i)+"_VAL = '1' and in_READ_WRITE_"+toString(i)+"_RW = '"+toString(RW_READ)+"' else "+std_logic_others(_param->_size_word,0)+";");
56      }
57
58    vhdl->set_body ("");
59    vhdl->set_body ("-----------------------------------------------------------------------------");
60    vhdl->set_body ("-- Write RegisterFile");
61    vhdl->set_body ("-----------------------------------------------------------------------------");
62    vhdl->set_body ("");
63
64    vhdl->set_body ("RegisterFile_write: process (in_CLOCK)");
65    vhdl->set_body ("begin  -- process RegisterFile_write");
66    vhdl->set_body ("\tif in_CLOCK'event and in_CLOCK = '1' then");
67   
68    for (uint32_t i = 0; i < _param->_nb_port_write; i++)
69      {
70        string str_address;
71        if (_param->_have_port_address)
72          str_address = "conv_integer(in_WRITE_"+toString(i)+"_ADDRESS)";
73        else
74          str_address = "0";
75
76        vhdl->set_body ("\t\tif (in_WRITE_"+toString(i)+"_VAL = '1') then");
77        vhdl->set_body ("\t\t\treg_DATA("+str_address+") <= in_WRITE_"+toString(i)+"_DATA;");
78        vhdl->set_body ("\t\tend if;");
79      }
80    for (uint32_t i = 0; i < _param->_nb_port_read_write; i++)
81      {
82        string str_address;
83        if (_param->_have_port_address)
84          str_address = "conv_integer(in_READ_WRITE_"+toString(i)+"_ADDRESS)";
85        else
86          str_address = "0";
87       
88        vhdl->set_body ("\t\tif (in_READ_WRITE_"+toString(i)+"_VAL = '1' and in_READ_WRITE_"+toString(i)+"_RW = '"+toString(RW_WRITE)+"') then");
89        vhdl->set_body ("\t\t\treg_DATA("+str_address+") <= in_READ_WRITE_"+toString(i)+"_WDATA;");
90        vhdl->set_body ("\t\tend if;");
91      }
92
93    vhdl->set_body ("\tend if;");
94    vhdl->set_body ("end process RegisterFile_write;");
95  };
96
97}; // end namespace registerfile_monolithic
98}; // end namespace registerfile
99}; // end namespace generic
100}; // end namespace behavioural         
101}; // end namespace morpheo             
102#endif
Note: See TracBrowser for help on using the repository browser.