ATA 发表于 2010-6-28 00:52:13

fpga程序

module shifter(ce,din,clk,clr,load,sload,pdin,dout,sdout) ;
input din,clk,ce,clr;
input load,sload;
input pdin;
output sdout;
reg sdout;
output dout;
reg dout,outreg;
reg inreg,shiftreg;

//以下为24位的并串转换, load为输入锁存信号,上升沿有效。sload为移位寄存器数据置位信号,低有效,此时将输入寄存器中的数据
置入移位寄存器。为复位信号,低有效
always @(negedge clr or posedge load or posedge clk or negedge sload)
begin
if(!clr)
   begin shiftreg<=24'h000;dout<=1'b0; end  复位信号为低时,移位寄存器置0串出?
      else if (!sload)
   begin shiftreg<=inreg;dout<=1'b1; end //   
   
   else if(load)
         begin inreg<=pdin;dout<=1'b0;   end   
      else
         begin
       shiftreg<=shiftreg>>1;
         sdout<=shiftreg;
   end
end



//以下为36位的串并转换, ce为输出锁存信号,低有效,此时将移位寄存器中的数据置入输出端。clr为复位信号,低有效。
always @(posedge clk or negedge clr or negedge ce)
begin
if(!clr)
   
   dout<=36'h0;
   else if (!ce)
      begin
         dout<=outreg;
   end
else
   begin
   outreg<=outreg<<1;
       outreg<=din;
   end
end

endmodule

Synplify Pro 7.6.1综合时有以下错误,无法继续
@E: CL123: myfile.v(12): The logic for shiftreg does not match a standard flip-flop @E:"d:\mycpld\myfile.v":12:0:12:6

xilink ise9.1ixst综合时有以下错误,无法继续
ERROR:Xst:2089 - "myfile.v" line 12: This sensitivity list construct will match none of the supported FF or Latch templates.

ICE 发表于 2010-6-28 02:04:34

做成同步电路 看看

encounter 发表于 2010-6-28 03:14:03

不行啊,控制信号是异步的。原来是3个NJM3714和3个HC597。现在我想用一片95144实现

Sunlife 发表于 2015-7-5 21:03:51

做成同步电路 看看
页: [1]
查看完整版本: fpga程序