module register(
input {3:0] D,
input ld,
input clk,
output [3:0] Q);
always @(posedge clk)
begin
if (ld==1) Q <= D;
end
endmodule
module core_v(clk, ld1, ld2, ld3, D, Q);
input [3:0] D;
input clk;
input ld1, ld2, ld3;
output [3:0] Q;
wire [3:0] X,Y;
register Reg1(D, ld1, clk, X);
register Reg2(X, ld2, clk, Y);
register Reg31(Y, ld3, clk, Q);
endmodule
are you getting zip file ?. And I mean everything, that means the result will be a zip file with a tested and working project.
can I use this method ?I see a few problems with your code. Yes it does compile without errors, but thera are 64 warnings that need to be corrected,
I knew and I did mention in my postand quite a few errors that are not errors in syntax, but errors in the logic of the design.
I am really sorryWhich is why I wanted you to do just the ALU and three registers, so that you learn how the structure of your code should look like and how to test your design. So far you are ingoring all of my requests which is getting rather annoying.
which type of test are you talking? did you mean RTL view or Time graph ?also asked you to make a test which shows that the result works as it should
ok thank you very much .Ok the code inside new folder 6 seems like it is going the right way.
I don't understand whats wrong with this code. If you will tell me my mistakes I think its very good for me. but ok I am trying to make batterNow look again at fig 2.13 and make code that does what it is on the picture, nothing less, nothing more.
module core_v(clk, ld1, ld2, ld3, D, z,ld4,ld5,ld6);
input [3:0] D;
input clk;
input ld1, ld2, ld3,ld4,ld5,ld6;
output [3:0] z;
wire s1,s2,s3,s4,s5,s6,z;
register acc (s3,ld4,clk,s4);
register tempacc(s4,ld5,clk,a);
register tempreg (s3,ld6,clk,b);
alu alu1 (a,b,z);
endmodule
module register(D,ld,clk,Q);
input D;
input ld;
input clk;
output Q;
reg[3:0] Q;
always @(posedge clk)
begin
if (ld==1) Q <= D;
end
endmodule
module alu (a,b,sel,z);
input [8:0]a,b; // input for alu
input [3:0]sel; // select input
output [7:0]z;
reg [7:0]z;
always@(sel,a,b)
begin
case(sel)
4'b0000: z=a+b; // do AND logic
4'b0001: z=a-b;
4'b0010: z=b-1;
4'b0011: z=a*b;
4'b0100: z=a&&b;
4'b0101: z=a||b;
4'b0110: z=!a;
4'b0111: z=~a;
4'b1000: z=a&b;
4'b1001: z=a|b;
4'b1010: z=a^b;
4'b1011: z=a<<1;
4'b1100: z=a>>1;
4'b1101: z=a+1;
4'b1110: z=a-1;
endcase
end
endmodule