Line 1... |
Line 1... |
//
|
//
|
// PERIPHERAL stepper_motor: @NAME@
|
// PERIPHERAL stepper_motor: @NAME@
|
// Copyright 2015, Sinclair R.F., Inc.
|
// Copyright 2015, Sinclair R.F., Inc.
|
//
|
//
|
// Assemble the byes of the control word from the input bytes.
|
|
@MASTER_BEGIN@
|
@MASTER_BEGIN@
|
localparam L__RATEMETHOD_MINUS_1 = @RATEMETHOD@ - 1;
|
localparam L__RATEMETHOD_MINUS_1 = @RATEMETHOD@ - 1;
|
localparam L__NBITS_RATEMETHOD = clog2(L__RATEMETHOD_MINUS_1);
|
localparam L__NBITS_RATEMETHOD = clog2(L__RATEMETHOD_MINUS_1);
|
@MASTER_END@
|
// Assemble the byes of the control word from the input bytes.
|
reg [@CONTROL_WIDTH@-1:0] s__input_control_word = {(@CONTROL_WIDTH@){1'b0}};
|
reg [@CONTROL_WIDTH@-1:0] s__input_control_word = {(@CONTROL_WIDTH@){1'b0}};
|
always @ (posedge i_clk)
|
always @ (posedge i_clk)
|
if (i_rst)
|
if (i_rst)
|
s__input_control_word <= {(@CONTROL_WIDTH@){1'b0}};
|
s__input_control_word <= {(@CONTROL_WIDTH@){1'b0}};
|
else if (s_outport && (s_T == 8'd@IX_OUTCONTROL@))
|
else if (s_outport && (s_T == 8'd@IX_OUTCONTROL@))
|
Line 21... |
Line 20... |
s__input_control_word[@DW@*((@MODE_WIDTH@+@DWM1@)/@DW@)+:@COUNT_WIDTH@]
|
s__input_control_word[@DW@*((@MODE_WIDTH@+@DWM1@)/@DW@)+:@COUNT_WIDTH@]
|
@OUTMODE_BEGIN@
|
@OUTMODE_BEGIN@
|
, s__input_control_word[0+:@MODE_WIDTH@]
|
, s__input_control_word[0+:@MODE_WIDTH@]
|
@OUTMODE_END@
|
@OUTMODE_END@
|
};
|
};
|
|
@MASTER_END@
|
// Instantiate the control word FIFO and operate its input side.
|
// Instantiate the control word FIFO and operate its input side.
|
reg s__FIFO_wr = 1'b0;
|
reg s__FIFO_wr = 1'b0;
|
always @ (posedge i_clk)
|
always @ (posedge i_clk)
|
if (i_rst)
|
if (i_rst)
|
s__FIFO_wr <= 1'b0;
|
s__FIFO_wr <= 1'b0;
|
Line 37... |
Line 37... |
else
|
else
|
s__FIFO_in_addr <= s__FIFO_in_addr + { @NBITS_FIFO_DEPTH@'d0, s__FIFO_wr };
|
s__FIFO_in_addr <= s__FIFO_in_addr + { @NBITS_FIFO_DEPTH@'d0, s__FIFO_wr };
|
reg [@CONTROL_WIDTH_PACKED@-1:0] s__FIFO[@FIFO_DEPTH@-1:0];
|
reg [@CONTROL_WIDTH_PACKED@-1:0] s__FIFO[@FIFO_DEPTH@-1:0];
|
always @ (posedge i_clk)
|
always @ (posedge i_clk)
|
if (s__FIFO_wr)
|
if (s__FIFO_wr)
|
s__FIFO[s__FIFO_in_addr[0+:@NBITS_FIFO_DEPTH@]] <= s__input_control_word_packed;
|
s__FIFO[s__FIFO_in_addr[0+:@NBITS_FIFO_DEPTH@]] <= @S__INPUT_CONTROL_WORD_PACKED@;
|
// Operate the output side of the FIFO and translate the packed controls into
|
// Operate the output side of the FIFO and translate the packed controls into
|
// individual signals.
|
// individual signals.
|
reg s__FIFO_rd = 1'b0;
|
reg s__FIFO_rd = 1'b0;
|
reg [@NBITS_FIFO_DEPTH@:0] s__FIFO_out_addr = {(@NBITS_FIFO_DEPTH@+1){1'b0}};
|
reg [@NBITS_FIFO_DEPTH@:0] s__FIFO_out_addr = {(@NBITS_FIFO_DEPTH@+1){1'b0}};
|
always @ (posedge i_clk)
|
always @ (posedge i_clk)
|