설계독학's Verilog 마스터 Season 2 (실전 코테 끝판왕: 고난도 문제로 완성하는 이직 프리패스)
`timescale 1ns / 1ps module data_avg ( input logic clk, input logic rstn, input logic [7:0] i_data, input logic i_valid, output logic [7:0] o_data, output logic o_valid ); //TODO logic [7:0] recent_data [0:3]; logic [9:0] sum; logic [1:0] valid_count; // store recent 4 data when i_valid == 1 always_ff @(posedge clk or negedge rstn) begin if(!rstn) begin for(integer i = 0; i < 4; i++) begin recent_data[i] <= 8'b0; end end else if(i_valid) begin // store data only when i_valid == 1 recent_data[0] <= i_data; for(integer i = 1; i < 4; i++) begin recent_data[i] <= recent_data[i-1]; end end else begin // remain data when i_valid == 0 recent_data[0:3] <= recent_data[0:3]; end end // o_valid is high when valid_count == 4 always_ff @(posedge clk or negedge rstn) begin if(!rstn) begin o_valid <= 1'b0; valid_count <= 2'b0; end else if(i_valid) begin if(valid_count == 3) begin o_valid <= 1'b1; end else if(valid_count < 3) begin o_valid <= 1'b0; valid_count <= valid_count + 1; end end else begin o_valid <= 1'b0; end end always_comb sum = recent_data[0] + recent_data[1] + recent_data[2] + recent_data[3]; always_comb o_data = o_valid ? ( sum[1] == 1 ? (sum[9:2] + 1) : sum[9:2] ) : 8'b0; endmodule 안녕하세요, 강의 잘 수강하고 있습니다. Q1. 작성하신 부분과 꽤 다르게 counter로 설계하였는데 간단하게 리뷰 부탁드리며 counter로 설계할 때와 fsm으로 설계할 때의 장단점이 궁금합니다. Q2. waveform에서 네번째 data가 들어온 바로 다음 rising edge 이후 valid와 average 값이 나와야 할 것 같은데 파형의 expected_data는 왜 한cycle이 더 delay돼서 나오는지 궁금합니다. 감사합니다.
설계독학's Verilog 마스터 Season 2 (실전 코테 끝판왕: 고난도 문제로 완성하는 이직 프리패스)
`timescale 1ns / 1ps module pattern_detector_no_fsm ( input logic clk, input logic rstn, input logic i_in, output logic o_flag ); //TODO logic [2:0] recent_data; logic before_flag; // store recent 4-bit always_ff @(posedge clk or negedge rstn) begin if(!rstn) begin recent_data <= 3'b0; end else begin recent_data[0] <= i_in; for(int i = 1; i < 3; i++) begin recent_data[i] <= recent_data[i-1]; end end end always_ff @(posedge clk or negedge rstn) begin if(!rstn) begin before_flag <= 1'b0; end else if(recent_data == 3'b101) begin before_flag <= 1'b1; end else begin before_flag <= 1'b0; end end always_comb o_flag = before_flag & i_in ? 1'b1 : 1'b0; endmodule module pattern_detector_fsm ( input logic clk, input logic rstn, input logic i_in, output logic o_flag ); //TODO `define INIT 1'b0 `define TARGET 1'b1 logic [2:0] recent_data; logic state; logic next_state; // store recent 4-bit always_ff @(posedge clk or negedge rstn) begin if(!rstn) begin recent_data <= 3'b0; end else begin recent_data[0] <= i_in; for(int i = 1; i < 3; i++) begin recent_data[i] <= recent_data[i-1]; end end end // FSM // 1. comb part always_comb begin case(state) `INIT : if(recent_data == 3'b101) begin next_state = `TARGET; end else begin next_state = `INIT; end `TARGET : if(recent_data == 3'b101) begin next_state = `TARGET; end else begin next_state = `INIT; end default : next_state = `INIT; endcase end // 2. seq part always_ff @(posedge clk or negedge rstn) begin if(!rstn) begin state <= `INIT; end else begin state <= next_state; end end // 3. output part always_comb o_flag = (state == `TARGET) & (i_in == 1'b1) ? 1'b1 : 1'b0; endmodule 안녕하세요, 코드 리뷰 원할 경우 남기면 리뷰 해주신다고 하셔서 질문 드립니다. 1) no fsm 1011이 됐을 때 다음 rising edge가 아닌 바로 1이 나와야 하기 때문에 101만 저장하여 비교한 후, 최종 출력에 i_in을 and 처리하여 101 + 1 일 경우만 o_flag가 나오도록 했습니다. 2) fsm 1과 비슷한 방법으로 하였는데 강의처럼 fsm의 input을 1이 아닌 3bit(101 target)로 하여, 상태를 2개로 축소시켜 작성하였습니다. 간단하게 리뷰 부탁드립니다!
설계독학's Verilog 마스터 Season 2 (실전 코테 끝판왕: 고난도 문제로 완성하는 이직 프리패스)
안녕하세요, 이번 강의 처음으로 수강하는 수강생인데 이전 버전의 환경 설정하는 영상이나 글 따라해도 계속 막힙니다. build시 자꾸 에러가 나오거나 vivado가 제대로 실행되지 않는데 이 부분이 해결이 되지 않습니다. 이전 가이드는 꽤 오래되었고, 무료 강의도 아니고 유료 강의인데 그냥 이전 영상을 참고하라고 할 게 아닌 해당 강의의 업로드 시점에서 최신화 된 환경 설정 영상/guide는 당연히 있어야된다고 생각합니다. 최신화 된 내용으로 자세한 guide를 부탁드립니다. 감사합니다.
AI 기반 아날로그/디지털 회로설계 자동화 실무 - 현업 LDO/AXI-Lite IP 설계와 검증
제공해주신 testbench 파일을 synthesis 돌리니 다음과 같은 에러가 나왔습니다. 따로 검색을 하니 iff는 Quartus에서 지원하지 않는 문법이라는 답만 얻을 수 있었는데 어떻게 해결하면 좋을지 알려주시면 감사하겠습니다. ==================================================== Error (10170): Verilog HDL syntax error at axi_ tb.sv (276) near text: "iff"; expecting ")". Check for and fix any syntax errors that appear immediately before or at the specified keyword. The Intel FPGA Knowledge Database contains many articles with specific details on how to resolve this error. Visit the Knowledge Database at https://www.altera.com/support/support-resources/knowledge-base/search.html and search for this specific error message number.