VitalyM4 0 January 26, 2007 Posted January 26, 2007 · Report post Здравствуйте жители форума. Не подскажите есть ли SPI-master коры на верилоге или vhdl?? На опенсоурсе только слейвы или мастера на шины wishbone или еще че. А мне бы простенький. :) СПС! Quote Share this post Link to post Share on other sites More sharing options...
VitalyM4 0 January 26, 2007 Posted January 26, 2007 · Report post От блин промахнулся разделом :cranky: . Модераторы подвиньте ее пжлста в работаем с плис или в языки ;) Quote Share this post Link to post Share on other sites More sharing options...
denisys 0 January 26, 2007 Posted January 26, 2007 · Report post Может пригодиться: h**p_: //direct.xilinx.com/bvdocs/appnotes/xapp386.pdf фтп_://ftp.xilinx.com/pub/applications/refdes/xapp386.zip Quote Share this post Link to post Share on other sites More sharing options...
Doka 5 January 26, 2007 Posted January 26, 2007 · Report post а какая разница: мастер/слейв? по сути мастер: это слейв с подведенными источниками клока и чипселекта (и выведенными наружу). а база одна - регистр сдвига. PS: да и что мешает тот же wishbone отвинтить, а параметры (делитель клока, разрядность) задать через define Quote Share this post Link to post Share on other sites More sharing options...
VitalyM4 0 January 26, 2007 Posted January 26, 2007 · Report post спасибо всем за участие. Еще вопрос что за конструкция такая хитрая??? ATTRIBUTE fpga_dont_touch : STRING; ATTRIBUTE fpga_dont_touch OF XLXI_9 : LABEL IS "true"; XLXI_9 : NAND2B1 PORT MAP (I0=>xmit_shift, I1=>xmit_shift, O=>vcc); Причем тут vcc??? это из xapp386.zip Quote Share this post Link to post Share on other sites More sharing options...
denisys 0 January 29, 2007 Posted January 29, 2007 · Report post спасибо всем за участие. Еще вопрос что за конструкция такая хитрая??? ATTRIBUTE fpga_dont_touch : STRING; ATTRIBUTE fpga_dont_touch OF XLXI_9 : LABEL IS "true"; XLXI_9 : NAND2B1 PORT MAP (I0=>xmit_shift, I1=>xmit_shift, O=>vcc); Причем тут vcc??? это из xapp386.zip Конструкция устанавливает и постоянно удерживает сигнал vcc в состоянии логической 1, это, наверное, и объяняет авторское название сигнала. Quote Share this post Link to post Share on other sites More sharing options...
VitalyM4 0 January 29, 2007 Posted January 29, 2007 · Report post спасибо всем за участие. Еще вопрос что за конструкция такая хитрая??? ATTRIBUTE fpga_dont_touch : STRING; ATTRIBUTE fpga_dont_touch OF XLXI_9 : LABEL IS "true"; XLXI_9 : NAND2B1 PORT MAP (I0=>xmit_shift, I1=>xmit_shift, O=>vcc); Причем тут vcc??? это из xapp386.zip Конструкция устанавливает и постоянно удерживает сигнал vcc в состоянии логической 1, это, наверное, и объяняет авторское название сигнала. А почему нельзя просто VCC задать на вход требуемой схемы?? А тем более ставить атрибут не оптимизировать?? Quote Share this post Link to post Share on other sites More sharing options...
denisys 0 January 29, 2007 Posted January 29, 2007 · Report post А почему нельзя просто VCC задать на вход требуемой схемы?? А тем более ставить атрибут не оптимизировать?? Точный ответ дать затрудняюсь, могу лишь предположить, что авторы считают такую конструкцию наиболее оптимальной для CPLD. Quote Share this post Link to post Share on other sites More sharing options...
sazh 9 January 29, 2007 Posted January 29, 2007 · Report post А почему нельзя просто VCC задать на вход требуемой схемы?? А тем более ставить атрибут не оптимизировать?? /////////////////////////////// Скорее всего разработчик работал так называемым методом тыка. Quote Share this post Link to post Share on other sites More sharing options...
VitalyM4 0 January 30, 2007 Posted January 30, 2007 · Report post А почему нельзя просто VCC задать на вход требуемой схемы?? А тем более ставить атрибут не оптимизировать?? /////////////////////////////// Скорее всего разработчик работал так называемым методом тыка. Я просто сделал VCC и оно заработало, но неприятный осадок остался ;) Quote Share this post Link to post Share on other sites More sharing options...
VitalyM4 0 February 6, 2007 Posted February 6, 2007 · Report post module spi_master ( clk,nWR,MOSI,SCLK,SS,DATA,IN_SS); input clk,nWR,IN_SS; input [9:0] DATA; output MOSI,SCLK,SS; reg MOSI,MOSI_int,SS,SCLK; reg ss,sclk,mosi; wire clk; reg [9:0] S_DATA; reg [3:0] cnt_div; reg RESET,s_clk,spi_clk,spi_tmp1,spi_tmp2,spi_tmp3,cnt_en; reg [3:0] cnt; initial begin RESET<=1; cnt<=0; cnt_div<=0; cnt_en<=0; end // executes first assignment and then repeats the statement as long as always@(posedge clk) //counter for clock division clk/8 cnt_div<=cnt_div+1; always@(posedge clk) s_clk<=cnt_div[3]; //divided frequency clk/8 always@(posedge clk) //shifting frequency begin spi_tmp1<=cnt_div[3]; spi_tmp2<=spi_tmp1; spi_tmp3<=spi_tmp2; spi_clk<=spi_tmp3; end localparam piso_shift=10; integer I; //inverting bus (MSB in spi MUST be FIRST always@(DATA) for (I=0; I<10; I=I+1) S_DATA[I]<=DATA[9-I]; //assign S_DATA=DATA; reg [piso_shift-1:0] DATA_INT; // terminates excution of a named group of statements always @(posedge s_clk or negedge RESET) if (!RESET) begin DATA_INT <= 0; MOSI_int <= 1'b0; end else if (!nWR) DATA_INT<=S_DATA; // <ouput> <= <input>[0]; else if (!SS) begin DATA_INT <= {1'b0,DATA_INT[piso_shift-1:1]}; MOSI_int <= DATA_INT[0]; end always@(posedge nWR or negedge RESET) if (!RESET) cnt_en<=1'b0; else cnt_en<=1'b1; always@(cnt_en) //if (cnt>=1 && cnt_en==1) ss<=~cnt_en; //else //SS<=0; always@(posedge s_clk or negedge nWR or negedge RESET) if(!RESET || !nWR) cnt<=4'b0000; else if(cnt_en) cnt<=cnt+1; always@(posedge s_clk) if (cnt==10) RESET<=0; else RESET<=1; always@(posedge clk) //sdelat po frontu clk begin//clk if (!ss) if (cnt>0) sclk<=spi_clk; else sclk<=1'b0; end always@( posedge clk) if (!ss) mosi<=MOSI_int; else mosi<=1'b1; always@(IN_SS,mosi,sclk,ss) if (IN_SS) begin MOSI<=mosi; SCLK<=sclk; SS<=ss; end else begin MOSI<=1'bz; SCLK<=1'bz; SS<=1'bz; end endmodule Скажите мне люди добрые, какие траблы могут быть у этой схемы, если конечно они есть. Quote Share this post Link to post Share on other sites More sharing options...
VitalyM4 0 February 12, 2007 Posted February 12, 2007 · Report post Еще вопросик?? В у меня должно быть два SPI мастера, один контроллер, второй FPGA. В каком состоянии должны быть ножки плисины, когда она не передает??? Quote Share this post Link to post Share on other sites More sharing options...