I have two modules. I want to run these modules in order.
This is first module:
module SinusLut(clk, aci ,reset,sonuc);
input reset;
input [7:0]aci;
output reg [15:0]sonuc;
input clk;
always@(posedge clk) begin
if (reset)
sonuc<= 'd0;
else begin
case(aci)
'd1 : sonuc <= 16'b0000000000010001;
'd2 : sonuc <= 16'b0000000000100011;
'd3 : sonuc <= 16'b0000000000110101;
'd4 : sonuc <= 16'b0000000001000111;
'd5 : sonuc <= 16'b0000000001011001;
endcase
end
end
endmodule
This is second module:
module CosLut(clk, aci ,reset,sonuc);
input reset;
input [7:0]aci;
output reg [15:0]sonuc;
input clk;
always@(posedge clk)begin
if(reset)
sonuc <= 'd0;
else begin
case(aci)
'd1 : sonuc <= 16'b0000001111111111;
'd2 : sonuc <= 16'b0000001111111111;
'd3 : sonuc <= 16'b0000001111111110;
'd4 : sonuc <= 16'b0000001111111101;
'd5 : sonuc <= 16'b0000001111111100;
endcase
end
end
endmodule
And I create two different top module and tried both. Both of them didn't work.
First one:
module TopModule(clk, aci ,reset,sonuc,en,en2);
input en,en2;
input reset;
input [7:0]aci;
output reg [15:0]sonuc;
input clk;
CosLut CosinusLookUp(
.reset(reset),
.aci(aci),
.sonuc(sonuc),
.clk(clk)
);
SinusLut SinusLookUp(
.reset(reset),
.aci(aci),
.sonuc(sonuc),
.clk(clk)
);
always@(posedge clk ) begin
if (en2==1) begin
SinusLut;
end
else begin
CosLut;
end
end
endmodule
Second one:
module TopModule(clk, aci ,reset,sonuc,en,en2);
input en,en2;
input reset;
input [7:0]aci;
output reg [15:0]sonuc;
input clk;
always@(posedge clk) begin
if(en2) begin
CosLut CosinusLookUp(
.reset(reset),
.aci(aci),
.sonuc(sonuc),
.clk(clk)
);
end
else begin
SinusLut SinusLookUp(
.reset(reset),
.aci(aci),
.sonuc(sonuc),
.clk(clk)
);
end
end
endmodule
Basically I want to enable first module after sometime i want to disenable it and enable other one.
Thank you in advance.