编译成功了,我把第一个always 里的dataout赋值语句去掉了,也修正了warning的BUG,但是综合出来的电路图有状态机,我本来没想用状态机的,还有编译时有11个警告,从综合出来的电路上也看不到段线,小弟英语不怎样,望大家能看看,指点一下,如果里面有恶性BUG还请帮助解决一下<br>
修改后的代码如下:<br>
module ALU_machine(dataout,ledjf,ledyf,ledyw,warning,clk,reset,data,jf,yf,yw);<br>
parameter wordsize=8;<br>
parameter st0=3'b100;<br>
parameter st1=3'b010;<br>
parameter st2=3'b001;<br>
parameter nostate=3'bzzz;<br>
output[wordsize-1:0]dataout;<br>
output ledjf,ledyf,ledyw,warning;<br>
input clk,reset,jf,yf,yw;<br>
input [wordsize-1:0]data;<br>
reg[2:0]state;<br>
reg[wordsize-1:0]dataout;<br>
reg ledjf,ledyf,ledyw,warning;<br>
integer i;<br>
always @( posedge clk or negedge reset) <br>
begin<br>
if(!reset)<br>
state<=nostate;<br>
else <br>
begin <br>
case({jf,yf,yw})<br>
st0:begin <br>
state<=st0;<br>
ledjf<=1;<br>
end<br>
st1:begin<br>
state<=st1;<br>
ledyf<=1;<br>
end<br>
st2:begin<br>
state<=st2;<br>
ledyw<=1;<br>
end<br>
default: state<=nostate;<br>
endcase<br>
end<br>
end<br>
always @(posedge clk )<br>
begin <br>
case(state)<br>
st0:begin<br>
if(dataout==8'hff) <br>
warning<=1;<br>
else <br>
begin <br>
dataout<=data+dataout;<br>
warning<=0;<br>
end<br>
end<br>
st1:begin<br>
if(dataout==8'h00)<br>
warning<=1;<br>
else<br>
begin<br>
dataout<=dataout-data;<br>
warning<=0;<br>
end<br>
end<br>
st2:begin<br>
if(dataout==8'h00)<br>
warning<=1;<br>
else<br>
begin <br>
dataout<=data>>1;<br>
warning<=0;<br>
end<br>
end <br>
endcase<br>
end<br>
endmodule<br>
<br>
<br>
警告有这些: Warning: Reduced register "ledjf~reg0" with stuck data_in port to stuck value VCC<br>
Warning: Reduced register "ledyf~reg0" with stuck data_in port to stuck value VCC<br>
Warning: Reduced register "ledyw~reg0" with stuck data_in port to stuck value VCC <br>
Warning: Output pins are stuck at VCC or GND<br>
Warning: Pin "ledjf" stuck at VCC<br>
Warning: Pin "ledyf" stuck at VCC<br>
Warning: Pin "ledyw" stuck at VCC<br>
Warning: Design contains 1 input pin(s) that do not drive logic<br>
Warning: No output dependent on input pin "reset"<br>
Warning: Following 3 pins have nothing, GND, or VCC driving datain port -- changes to this connectivity may change fitting results<br>
Info: Pin ledjf has GND driving its datain port<br>
Info: Pin ledyf has GND driving its datain port<br>
Info: Pin ledyw has GND driving its datain port<br>
Warning: Found pins functioning as undefined clocks and/or memory enables<br>
Info: Assuming node "clk" is an undefined clock |