vinodkumar
Full Member level 5
Hi friends ,my doubt is ,If i gave input has ex:1529 in binary form ,if i want only 29,i,e, last two digits with out converting to BCD seperated,wht could be the logic with minimum HW.
module top (clk, idata, odata);
input clk;
input [12:0] idata;
reg [4:0] rom [0:2047];
output reg [6:0] odata;
integer n;
initial
for (n=0; n<2048; n=n+1)
rom[n] = n % 25;
always @ (posedge clk) begin
odata[6:2] <= rom[idata[12:2]];
odata[1:0] <= idata[1:0];
end
endmodule