목록[Harman] 하만 반도체 설계/VerilogHDL (18)
Kraklog
module adder ( input clk, input [31:0]a , input [31:0]b , output reg[31:0]sum ); always @(posedge clk) begin sum

module state_machine ( input clk, res, input chn1, sync, valid, output reg data_a, data_b, validate, error ); `ifdef USER_EC parameter idle=5'b00000, header_wait=5'b00010, got_header=5'b00001, a1=5'b00100, a2=5'b00101, a3=5'b00110, b1=5'b01000, b2=5'b01001, b3=5'b01010, recover=5'b10000; reg [3:0] current_state, next_state; `else parameter idle=5'b00000, header_wait=5'b00010, got_header=5'b00001..

클럭 도메인이 안맞을때도 사용가능하지만 이 기능을 사용하지 않고는 뒤에 로직이 하나 더 붙는다. (동작을 하지 않는 것은 아님) read enable 신호때 생성을 하게 만들거나 aclr에 asynchornous 를 해주는 세팅을 할 수 있게 하거나 이것에 대한 순서를 정할 수 있다. module sp_ram_sync_rdwo( input clk , input we , input [7:0] d , input [6:0] addr , output reg [7:0] q ); reg [7:0] mem [0:127]; always @ (posedge clk) begin if(we) mem[addr]

module my_shift_tx ( input clk , input aclr_n , input enable , input [7:0] shiftin , // parallel to serial output reg q ); reg [7:0] txData; wire [7:0] Shiftin_Serial = (enable) ? shiftin : {1'b0, txData[7:1]}; // Parallel to serial shift register always @(posedge clk or negedge aclr_n) begin if (!aclr_n) txData