我想要利用FSM寫一個電路,但不知道怎麼寫!
想請各位幫幫忙~
Module name my_controller
Signal Direction Description
clk input System clock
rst_n input reset signal, active low
mc_din[27:0] input input raw data
mc_op[3:0] input input operation (instruction)
mc_din_rdy input input data ready
ns_ack input The next stage acknowledgement signal
mc_dout[27:0] output output data
mc_dout_rdy output output data ready to next stage
mc_surplus [1:0] output data transfer surplus
mc_full output current stage full signal to preceding stage
operation function table
mc_op[3:2](decide the result ) mc_op[1:0] (control repeat)
00: input data shift 1 bit right 00: output the “input raw data” 1 time
01: do 1’s complement 01: output the “input raw data” 1 time and “result data” 1 time
10: do 2’s complement 10: output the “input raw data” 1 time and “result data” 2 times
11: ignore the input data , (no output)
mc_op[1:0] function is also ignoredclk. 11: output the ” input raw data” 1 time and “result data” 3 times