본문 바로가기

[Harman] 반도체 설계/Vivado

(8)
[Vivado] 0X. Source Code Calculator_8bit_PB_FSM_stopwatch.v `timescale 1ns / 1ps module Calculator_8bit_PB_FSM_stopwatch( input clk, input reset, input [7:0] i_a, input [7:0] i_b, input i_pbrunstop, input i_pbclear, output [3:0] o_digitSel, output [7:0] o_fndFont ); wire [8:0] w_sum; wire w_stoprun, w_clear; wire [13:0] w_stopwatchValue, w_FndsourceValue; wire w_pbrunstop, w_pbclear; PushButton_Oneshot U_pb_runstop(clk,..
[Vivado] 07. Calculator 8bit, PB FSM StopWatch Data 가 변하는 과정에서 Chattering, Bouncing 등이 발생할 수도 있으며 이럴 때, 입력 값이 0 인지 1 인지 정확하게 확인할 수 없는 Meta Stable 상태가 되고 오류를 발생시킨다. 이는 동기화(Synchronize, D_FF) 를 통해 해결할 수 있다. D_FF 가 많으면 많을수록 System 은 더 안정된다. 하지만 그 만큼 입력 Delay 가 길어지는 단점도 있다. Pull - Down 장치로 PB 를 Arbitrary Time 동안 눌렀을 때, 1 이 정확하게 1 period 만큼만 발생하도록 설계하려고 한다. [1] Switch[0], [1] 대신 PushButton (runstop, clear) 을 사용하기 위해서는 D_FF 를 활용한 Synchronizer 가 필요..
[Vivado] 06. Calculator 8bit, FSM StopWatch 0.1s UpCount [1] StopWatch 설계 후, FSM (sw[0], sw[1]) 으로 Stop, Run, Clear 상태 제어. stopwatch 내부에 clkDivider 와 0.1s Counter 가 필요하다. clkDivider 는 10hz, Counter 는 0 ~ 9999 까지 Count 하도록 설계한다(14bit). fig.1 과 같이 FSM 의 stoprun 신호를 받을 수 있는 enable 과 clear 신호를 받는 reset(clear) port 를 선언해주어야 한다. `timescale 1ns / 1ps module stopwatch( input clk, input reset, input i_run_stop, input i_clear, output [13:0] o_upCounter ); wire ..
[Vivado] 05. Finite State Machine LED current nextState reset input state output state 1 - - 0 OFF 0 0 OFF 0 OFF 0 1 OFF 1 ON 0 0 ON 0 OFF 0 1 ON 1 ON reset 값은 OFF 에서 시작. output 은 input 과 서로 독립적이며 state 값을 따른다. `timescale 1ns / 1ps // moore machine module LED_FSM( input clk, input reset, input i_ledswitch, output reg o_led ); parameter S_OFF = 1'b0, S_ON = 1'b1; reg state = S_OFF, nextState; // state register always@(posedge clk, po..
[Vivado] 04. FndController, Adder 8bit [1] 14bit 의 입력을 받은 FndController 는 0 ~ 9999 까지의 수를 표현했다. 이번에는 FndController 와 Adder 8 bit 를 활용해서 8 bit 가산기를 설계하려고 한다. [Vivado] 03. Adder_8bit Half Adder. module half_adder ( input i_a, input i_b, output o_sum, output o_carry ); assign o_sum = i_a ^ i_b; assign o_carry = i_a & i_b; endmodule Full Adder 1 bit. module full_adder_1bit ( input i_a, input i_b, input i_cin, output o_sum, output o_carry..
[Vivado] 03. Adder 8bit Half Adder. module half_adder ( input i_a, input i_b, output o_sum, output o_carry ); assign o_sum = i_a ^ i_b; assign o_carry = i_a & i_b; endmodule Full Adder 1 bit. module full_adder_1bit ( input i_a, input i_b, input i_cin, output o_sum, output o_carry ); wire w_sum1, w_carry1, w_carry2; half_adder U_HA_0 ( .i_a(i_a), .i_b(i_b), .o_sum(w_sum1), .o_carry(w_carry1) ); half_adder U_HA_1 ( .i_a(..
[Vivado] 02. FndController, Counter, DigitSplitter, clkDivider [1] Counter 2x4 Decoder 의 출력 ([3:0] o_digitSel) 을 반복적으로 Count 하는 Counter 를 설계하려고 한다. 4 개의 7-Segment 를 동작하기 위해 Counter 의 bit 는 2-bit 이다. clk 가 들어올 때마다 + 1 씩 Count 가 쌓이게 되고, reset 입력 시, 0 으로 초기화 된다. Counter 의 출력 (o_count) 은 2x4 Decoder 의 입력 (i_x) 으로 들어간다. [2] DigitSplitter, mux 4x1 0 ~ 9999 사이의 값을 입력 ([13:0] i_number, 0 ~ 16384) 으로 받을 경우, 각 자릿 수의 [3:0] Digit Number (o_dig_1, o_dig_10, o_dig_100, o..
[Vivado] 01. FndController, 2x4_Decoder [1] 2x4 Decoder 의 [3:0] 출력 : 4 개의 7-Segment LED (o_digitSel) [2] BCD to FND Decoder 의 [7:0] 출력 : 각 7-Segment LED 의 Digit Number (o_fndFont) `timescale 1ns/1ps module FndController ( input [1:0] i_sw_decoder, input [3:0] i_sw_bcd, output [3:0] o_digitSel, output [7:0] o_fndFont ); decoder_2x4 U_decoder_2x4 ( .i_x(i_sw_decoder), .o_y(o_digitSel) ); BCDtoFND_Decoder U_BCDtoFND_Decoder ( .i_bcd(i_sw..