fix adc_sim

This commit is contained in:
Peter McGoron 2022-11-21 22:04:46 -05:00
parent 5909f548d5
commit cfb0f92528
3 changed files with 3 additions and 2 deletions

View File

@ -39,8 +39,8 @@ always @ (posedge clk) begin
data <= indat; data <= indat;
fulfilled_raised <= 1; fulfilled_raised <= 1;
request <= 0; request <= 0;
end else if (ss_raised && request && !fulfilled && fulfilled_raised) begin
rdy <= 1; rdy <= 1;
end else if (ss_raised && !fulfilled && fulfilled_raised) begin
fulfilled_raised <= 0; fulfilled_raised <= 0;
ss_buf_L <= 0; ss_buf_L <= 0;
end else if (spi_fin) begin end else if (spi_fin) begin

View File

@ -226,7 +226,7 @@ reg [DELAY_WID-1:0] timer = 0;
/**** Timing. ****/ /**** Timing. ****/
always @ (posedge clk) begin always @ (posedge clk) begin
if (state == CYCLE_START) begin if (state == CYCLE_START && timer == 0) begin
counting_timer <= 1; counting_timer <= 1;
last_timer <= counting_timer; last_timer <= counting_timer;
end else begin end else begin

View File

@ -56,6 +56,7 @@ int main(int argc, char **argv) {
set_value(0b11010111000010100011110101110000101000111, CONTROL_LOOP_P); set_value(0b11010111000010100011110101110000101000111, CONTROL_LOOP_P);
set_value((V)12 << CONSTS_FRAC, CONTROL_LOOP_I); set_value((V)12 << CONSTS_FRAC, CONTROL_LOOP_I);
set_value(20, CONTROL_LOOP_DELAY); set_value(20, CONTROL_LOOP_DELAY);
set_value(10000, CONTROL_LOOP_SETPT);
set_value(1, CONTROL_LOOP_STATUS); set_value(1, CONTROL_LOOP_STATUS);
for (int tick = 0; tick < 10000; tick++) { for (int tick = 0; tick < 10000; tick++) {