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

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

Update document on Vhdl generation.

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