목록전체 글 (248)
Kraklog
01.Program & Tool 더보기 02.Schematic 더보기 03.Schematic 더보기
// Moore State Machine Module module MooreStateMachine( input clk, // Clock input reset, // Reset signal output reg moore_output // Output signal for Moore machine ); // Define states parameter S0 = 2'b00; parameter S1 = 2'b01; // State register reg [1:0] state; // Output assignment (Moore machine) always @(posedge clk or posedge reset) begin if (reset) begin state
클럭 도메인이 안맞을때도 사용가능하지만 이 기능을 사용하지 않고는 뒤에 로직이 하나 더 붙는다. (동작을 하지 않는 것은 아님) 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
module my_ram( input [7:0] data , input [4:0] address , input wren , input clk , output reg [7:0] q ); reg [7:0] mem [0:31]; always @ (posedge clk) begin if (wren) mem[address]