Abishek Posted December 22, 2021 Report Share Posted December 22, 2021 Hello, Im trying to create a daisy chain by connecting multiple instances of same device into a single air of SPI lines. But Im getting E515 while reading data from multiple slaves to single master signal. My binding is something like this below? Can someone help me find a solution: SC_MODULE(TESTBENCH) { DaisyChainProcess DaisyChainProcess_1; DaisyChainProcess DaisyChainProcess_2; sc_signal<sc_logic,SC_MANY_WRITERS > spi_mrst[6]; sc_signal<sc_logic, SC_MANY_WRITERS> spi_mtsr[6]; sc_signal<sc_logic, SC_MANY_WRITERS > cs; SC_CTOR(TESTBENCH) : DaisyChainProcess_1("DaisyChainProcess_1", 1) , DaisyChainProcess_2("DaisyChainProcess_2", 2) //Two instances of my process { SC_THREAD(testbench); DaisyChainProcess_1.CS(cs); DaisyChainProcess_2.CS(cs); for (int j = 0; j < 6; j++) { DaisyChainProcess_1.SPI_MRST[j](spi_mrst[j]); //Out lines from device bind to common input signal Error here DaisyChainProcess_1.SPI_MTSR[j](spi_mtsr[j]); DaisyChainProcess_2.SPI_MRST[j](spi_mrst[j]); //Out lines from device bind to common input signal Error here DaisyChainProcess_2.SPI_MTSR[j](spi_mtsr[j]); } } And below are the daisy chain process module declaration public: sc_core::sc_in<sc_logic> SPI_MTSR[6]; //SPI Master Transmit Slave Recieve sc_core::sc_out<sc_logic> SPI_MRST[6]; //SPI Master Recieve Slave Transmit sc_core::sc_in<sc_logic> CS; //SPI chip select Quote Link to comment Share on other sites More sharing options...
David Black Posted December 22, 2021 Report Share Posted December 22, 2021 Use sc_signal_resolved instead of sc_signal<sc_logic>. Quote Link to comment Share on other sites More sharing options...
karthickg Posted December 23, 2021 Report Share Posted December 23, 2021 In general - ignoring the fact that you are using sc_logic for now, we need to be aware of the following: An sc_signal allows only one "writer" or "driver" by default. This means, even from within a single SystemC module, if an sc_out port is being written by two process instances (two threads or methods), a runtime (simulation time) error will be issued We can however explicitly allow multiple writers by using the SC_MANY_WRITERS template argument, like you have already done. In this case, SystemC will allow different processes to write to the sc_out port - but only as long as the writes are not in the same evaluation phase (i.e., not in same delta cycle). Even with SC_MANY_WRITERS, it will be an error to write to an sc_out port from two different processes in the same evaluation cycle. The fact that you are using signals of type sc_logic doesn't change the rules above. If you truly want multiple writers, you should use sc_signal_resolved as suggested by David. In your example, you are showing the line that binds the port to the signal as the cause for the error, but my guess is that the error is during simulation. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.