Changeset 557


Ignore:
Timestamp:
Oct 23, 2013, 12:12:44 AM (10 years ago)
Author:
bouyer
Message:

Switch to using a mealy function. This seems to be the only way to get output
signals in sync with the spi_clk in all cases.
Now this model works in cosimulation with the VHDL spi controller.

Location:
trunk/modules/sdmmc/caba/source
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/modules/sdmmc/caba/source/include/sdmmc.h

    r556 r557  
    8181
    8282    // methods
    83     void transition();
    84     void genMoore();
     83    void genMealy();
    8584
    8685    void handle_sdmmc_cmd(uint8_t, uint32_t);
  • trunk/modules/sdmmc/caba/source/src/sdmmc.cpp

    r556 r557  
    4040
    4141////////////////////////
    42 void SdMMC::transition()
     42void SdMMC::genMealy()
    4343{
    4444    if(p_resetn.read() == false)
     
    200200            break;
    201201    }
    202     spi_clk = p_spi_clk.read();
    203 }  // end transition
    204 
    205 //////////////////////
    206 void SdMMC::genMoore()
    207 {
     202
     203//// now genrate output signal
     204
    208205    switch(spi_fsm) {
    209206    case S_IDLE:
     
    217214        break;
    218215    }
    219 } // end GenMoore()
     216    spi_clk = p_spi_clk.read();
     217} // end GenMealy()
    220218
    221219
     
    487485    std::cout << "  - Building SdMMC " << name << std::endl;
    488486
    489         SC_METHOD(transition);
    490     dont_initialize();
    491     sensitive << p_clk.pos();
    492 
    493         SC_METHOD(genMoore);
     487    SC_METHOD(genMealy);
    494488    dont_initialize();
    495489    sensitive << p_clk.neg();
     490    sensitive << p_resetn;
     491    sensitive << p_spi_ss;
     492    sensitive << p_spi_clk;
    496493
    497494    m_fd = ::open(filename.c_str(), O_RDWR);
Note: See TracChangeset for help on using the changeset viewer.