aruna siddappa
Newbie level 5

[Please use code or syntax tags for posted code]
Code Verilog - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 // fifo to read 32 bit data if wr_en=1 module fifo( input clk, input rst, input wr_en, input [31:0] fifo_in, output [31:0] fifo_out); reg [31:0] reg_fifo; //fifo instantiation with converter module converter_8_32 fifo_dut(.clk(clk),.rst(rst),.valid_q(wr_en),.data_out(fifo_in)); always @(*) begin if(!rst) begin reg_fifo<=0; end else if (wr_en==1'b1) begin reg_fifo<=fifo_in; end else reg_fifo<=0; end assign fifo_out=reg_fifo; endmodule //converter block to convert 8 bit input to 32 bit output for every 4 clocks. ////output is valid if valid_q=1 where we receive 32 bit data out module converter_8_32( input clk, input valid, input rst, output reg valid_q, input [7:0] data_in, //8 bit input output reg [31:0] data_out); //32 bit data out reg [7:0] temp_reg [0:3]; integer N=4; always @ (posedge clk or negedge rst) begin if (!rst) begin data_out<=0; valid_q<=0; end else if (!valid) begin data_out<=0; valid_q<=0; N<=4; end else begin temp_reg[N-1]<=data_in; N=N-1; if (N==0) begin valid_q<=1; N<=4; end else begin valid_q<=0; data_out<=data_in; end end end always @ (posedge clk) begin if (N==0) // concatentaion operator to concatenate previous 3 data along // with preset data_in to generate 32 bit data data_out<={temp_reg[3],temp_reg[2],temp_reg[1],data_in}; end endmodule Need help on this. I am unable to read (valid_q) output of converter into (wr_en) of fifo. Getting dont cares"x" for wr_en & fifo_in[syntax] [automerge]1716529491[/automerge] Waveforms are attached for the same
Attachments
Last edited by a moderator: