?? controller.v
字號:
module MainControl(start, reset, clock1, clock2, finish_BM,
errdetect, rootcntr, lambda_degree, active_SYN,
active_BM, active_CHIEN, evalsynd, holdsynd,
errfound, decode_fail, ready, dataoutstart,
dataoutend, shift_fifo, hold_fifo, en_infifo,
en_outfifo, lastdataout, evalerror);
input start, reset;
input clock1, clock2;
input errdetect, finish_BM;
input [2:0] rootcntr, lambda_degree;
output active_SYN, active_BM, active_CHIEN, ready;
output evalsynd, holdsynd, errfound, decode_fail;
output dataoutstart, dataoutend;
output shift_fifo, hold_fifo, en_infifo, en_outfifo;
output lastdataout, evalerror;
reg active_SYN, active_BM, active_CHIEN;
reg ready, decode_fail, evalsynd, holdsynd, errfound;
reg shift_fifo, hold_fifo, en_infifo, en_outfifo;
reg encntdataout, encntdatain;
reg [4:0] cntdatain, cntdataout;
reg dataoutstart, dataoutend;
reg datainfinish;
wire lastdataout;
parameter [3:0] st1_0=0, st1_1=1, st1_2=2, st1_3=3, st1_4=4, st1_5=5,
st1_6=6, st1_7=7, st1_8=8, st1_9=9, st1_10=10,
st1_11=11, st1_12=12, st1_13=13, st1_14=14;
reg [3:0] state1, nxt_state1;
parameter [3:0] st2_0=0, st2_1=1, st2_2=2, st2_3=3, st2_4=4, st2_5=5,
st2_6=6, st2_7=7, st2_8=8, st2_9=9, st2_10=10,
st2_11=11;
reg [3:0] state2, nxt_state2;
always@(posedge clock1 or negedge reset)
begin
if(~reset)
state1 = st1_0;
else
state1 = nxt_state1;
end
always@(state1 or start or rootcntr or lambda_degree or errdetect
or datainfinish or finish_BM or dataoutend)
begin
case(state1)
st1_0 : begin
if(start)
nxt_state1 = st1_1;
else
nxt_state1 = st1_0;
end
st1_1 : nxt_state1 = st1_2;
st1_2 : begin
if(datainfinish)
nxt_state1 = st1_3;
else
nxt_state1 = st1_2;
end
st1_3 : begin
if(errdetect)
nxt_state1 = st1_4;
else
nxt_state1 = st1_12;
end
st1_4 : nxt_state1 = st1_5;
st1_5 : begin
if(finish_BM)
nxt_state1 = st1_6;
else
nxt_state1 = st1_5;
end
st1_6 : nxt_state1 = st1_7;
st1_7 : begin
if((~start)&&(~dataoutend))
nxt_state1 = st1_7;
else if(dataoutend)
begin
if(lambda_degree == rootcntr)
nxt_state1 = st1_0;
else
nxt_state1 = st1_10;
end
else
nxt_state1 = st1_8;
end
st1_8 : begin
if(dataoutend)
begin
if(lambda_degree == rootcntr)
nxt_state1 = st1_2;
else
nxt_state1 = st1_11;
end
else
nxt_state1 = st1_9;
end
st1_9 : begin
if(dataoutend)
begin
if(lambda_degree == rootcntr)
nxt_state1 = st1_2;
else
nxt_state1 = st1_11;
end
else
nxt_state1 = st1_9;
end
st1_10: begin
if(start)
nxt_state1 = st1_1;
else
nxt_state1 = st1_0;
end
st1_11: begin
if(datainfinish)
nxt_state1 = st1_3;
else
nxt_state1 = st1_2;
end
st1_12: begin
if((~start)&&(~dataoutend))
nxt_state1 = st1_12;
else if(dataoutend)
nxt_state1 = st1_0;
else
nxt_state1 = st1_13;
end
st1_13: begin
if(dataoutend)
nxt_state1 = st1_2;
else
nxt_state1 = st1_14;
end
st1_14: begin
if(dataoutend)
nxt_state1 = st1_2;
else
nxt_state1 = st1_14;
end
default: nxt_state1 = st1_0;
endcase
end
always@(state1)
begin
case(state1)
st1_0 :begin
ready = 1;
active_SYN = 0;
active_BM = 0;
active_CHIEN = 0;
evalsynd = 0;
errfound = 0;
decode_fail = 0;
en_outfifo = 0;
end
st1_1 :begin
ready = 1;
active_SYN = 1;
active_BM = 0;
active_CHIEN = 0;
evalsynd = 0;
errfound = 0;
decode_fail = 0;
en_outfifo = 0;
end
st1_2 :begin
ready = 1;
active_SYN = 0;
active_BM = 0;
active_CHIEN = 0;
evalsynd = 0;
errfound = 0;
decode_fail = 0;
en_outfifo = 0;
end
st1_3 :begin
ready = 0;
active_SYN = 0;
active_BM = 0;
active_CHIEN = 0;
evalsynd = 1;
errfound = 0;
decode_fail = 0;
en_outfifo = 0;
end
st1_4 :begin
ready = 0;
active_SYN = 0;
active_BM = 1;
active_CHIEN = 0;
evalsynd = 0;
errfound = 1;
decode_fail = 0;
en_outfifo = 0;
end
st1_5 :begin
ready = 0;
active_SYN = 0;
active_BM = 1;
active_CHIEN = 0;
evalsynd = 0;
errfound = 0;
decode_fail = 0;
en_outfifo = 0;
end
st1_6 :begin
ready = 0;
active_SYN = 0;
active_BM = 1;
active_CHIEN = 1;
evalsynd = 0;
errfound = 0;
decode_fail = 0;
en_outfifo = 0;
end
st1_7 :begin
ready = 1;
active_SYN = 0;
active_BM = 1;
active_CHIEN = 0;
evalsynd = 0;
errfound = 0;
decode_fail = 0;
en_outfifo = 1;
end
st1_8 :begin
ready = 1;
active_SYN = 1;
active_BM = 1;
active_CHIEN = 0;
evalsynd = 0;
errfound = 0;
decode_fail = 0;
en_outfifo = 1;
end
st1_9 :begin
ready = 1;
active_SYN = 0;
active_BM = 1;
active_CHIEN = 0;
evalsynd = 0;
errfound = 0;
decode_fail = 0;
en_outfifo = 1;
end
st1_10:begin
ready = 1;
active_SYN = 0;
active_BM = 0;
active_CHIEN = 0;
evalsynd = 0;
errfound = 0;
decode_fail = 1;
en_outfifo = 0;
end
st1_11:begin
ready = 1;
active_SYN = 0;
active_BM = 0;
active_CHIEN = 0;
evalsynd = 0;
errfound = 0;
decode_fail = 1;
en_outfifo = 0;
end
st1_12:begin
ready = 1;
active_SYN = 0;
active_BM = 0;
active_CHIEN = 0;
evalsynd = 0;
errfound = 0;
decode_fail = 0;
en_outfifo = 1;
end
st1_13:begin
ready = 1;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -