mrflibble
Advanced Member level 5
- Joined
- Apr 19, 2010
- Messages
- 2,720
- Helped
- 679
- Reputation
- 1,360
- Reaction score
- 652
- Trophy points
- 1,393
- Activity points
- 19,551
xvlog crap.v
INFO: [VRFC 10-165] Analyzing Verilog file "crp_code.v" into library work
INFO: [VRFC 10-311] analyzing module core_v
INFO: [VRFC 10-311] analyzing module registerr1
INFO: [VRFC 10-311] analyzing module register2
xelab -debug typical -timescale 1ps/1ps register2
Vivado Simulator 2014.2
Copyright 1986-1999, 2001-2014 Xilinx, Inc. All Rights Reserved.
Running: C:/Xilinx/Vivado/2014.2/bin/unwrapped/win64.o/xelab.exe -debug typical -timescale 1ps/1ps register2
Multi-threading is on. Using 6 slave threads.
Starting static elaboration
ERROR: [VRFC 10-29] core_v expects 4 arguments [crp_code.v:36]
ERROR: [VRFC 10-29] core_v expects 4 arguments [crp_code.v:38]
WARNING: [VRFC 10-278] actual bit length 4 differs from formal bit length 1 for port clk [crp_code.v:37]
WARNING: [VRFC 10-278] actual bit length 4 differs from formal bit length 1 for port clk [crp_code.v:38]
WARNING: [VRFC 10-278] actual bit length 4 differs from formal bit length 1 for port clk [crp_code.v:36]
ERROR: [XSIM 43-3322] Static elaboration of top level Verilog design unit(s) in library work failed.
I already suggested they should skip the development of technical skills and just go for management (business) directly ;-). Though let us know where you end up so I can avoid working for you.Keep improving on those skills, or you might as well go straight to middle management.
Actually there's nothing wrong with doing this (as it's positional) except for the fact that it's very confusing and you'll likely hook something up wrong.Plus, your instantiations use signals that do not even exist in register2 (i.e. s0, si, s2, q0,q1).
Actually there's nothing wrong with doing this (as it's positional) except for the fact that it's very confusing and you'll likely hook something up wrong.
module core_v(clk, ld, d0, q0,d1,q1,d2,q2);
input [3:0] d0,d1,d2;
input clk;
input ld;
output [3:0] q0,q1,q2;
reg [3:0]q0,q1,q2;
always @(posedge clk)
begin
if (ld==1) q0 <= d0;
end
always @(posedge clk)
begin
if (ld==1) q1 <= d1;
end
always @(posedge clk)
begin
if (ld==1) q2 <= d2;
end
endmodule
Should work, could still use some comments, better formatting, and Verilog 2001 port declarations (but I'll assume your professor is a HDL Neanderthal and wants you to use prehistoric Verilog 87 syntax ;-))now I think It should be correct with no error
Code:module core_v(clk, ld, d0, q0,d1,q1,d2,q2); input [3:0] d0,d1,d2; input clk; input ld; output [3:0] q0,q1,q2; reg [3:0]q0,q1,q2; always @(posedge clk) begin if (ld==1) q0 <= d0; end always @(posedge clk) begin if (ld==1) q1 <= d1; end always @(posedge clk) begin if (ld==1) q2 <= d2; end endmodule
module core_v(clk, ld, d0, q0,d1,q1,d2,q2,d3,q3, z,a,b,sel);
input [3:0] d0,d1,d2,d3; // input for r0, r1 ,r2 acc
input clk;
input ld;
output [3:0] q0,q1,q2,q3; // output for r0,r1 ,r2 acc
reg [3:0]q0,q1,q2,q3;
always @(posedge clk )
begin
if (ld==1)
begin
q0 <= d0; /// output r0
q2 <= d2; // output r1
q1 <= d1; // output r2
q3 <= d3; // output acc
end
end
input [8:0]a,b; // input for alu
input [3:0]sel;
output [8:0]z; // output for alu
reg [8:0]z;
always@(sel,a,b)
begin
case(sel)
4'b0000: z=a+b;
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
Since you already know your code looks messy, I will read it when you've cleaned it up then. No rush.I know this code look messy I will write code in good formmet but look this code
Code Verilog - [expand] 1// my pretty code
Code Verilog - [expand] 1 2 3 4 module core_v ( input clk, input sel, // etc
Ummm, this line won't compile:I know this code look messy I will write code in good formmet but look this code
i compiled with no error
ok look hereSince you already know your code looks messy, I will read it when you've cleaned it up then.
//component
//register r0
//register r1
//register r3
//accumulator
//alu
//connect all component in module
module core_v (clk, ld, d0, q0,d1,q1,d2,q2,d3,q3, z,a,b,sel);
//Input Port Declarations
input [3:0] d0,d1,d2,d3; // input data for r0, r1 ,r2 acc
input clk; // clock signal
input ld; // load signal
input [8:0]a,b; // input for alu
input [3:0]sel; // select input
output [8:0]z;
output [3:0] q0,q1,q2,q3; // output for r0,r1 ,r2 acc
reg [3:0] q0,q1,q2,q3;
reg [8:0]z; //
always @(posedge clk ) //
begin // start
if (ld==1)
begin
q0 <= d0; /// output r0
q2 <= d2; // output r1
q1 <= d1; // output r2
q3 <= d3; // output acc
end
end // end
always@(sel,a,b)
begin
case(sel)
4'b0000: z=a+b;
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
I compiled with no errorUmmm, this line won't compile:
4'b0100: z=a&&b;
I have downloade pdf file for 2001 port syntexyou don't want my help then tell me to leave you alone.
I looked. Same shit.ok look here
Good to know. Progress! Now read it, and actually use that verilog 2001 port syntax in your code.I have downloade pdf file for 2001 port syntex
Well you're giving me a headache.I don't want to hurt you I always respect all member they always help lot of stupid student like me
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?