Anda di halaman 1dari 3

module mux2a1(input[1:0+]I,S,output F)

output reg F,
always @(I,S)
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
DIGITAL
module Deco1a4(
input A,
input B,
input EN,
output Y1,
output Y2,
output Y3,
output Y4
);
assign
assign
assign
assign

Y1=(~A&~B)&~EN;
Y2=(~A&B)&~EN;
Y3=(~A&B)&~EN;
Y4=(A&B)&~EN;

endmodule
module code1a4procedimental(
input A,
input B,
output reg Y0,
output reg Y1,
output reg Y2,
output reg Y3,
input EN
);
always @(A,B,EN)
if(A==0 && EN==0 && B==0)
Y0=1;
else
Y0=0;
always @(A,B,EN)
if(A==0 && EN==0 && B==1)
Y1=1;
else
Y1=0;

always @(A,B,EN)
if(A==1 && EN==0 && B==0)
Y2=1;
else
Y2=0;
always @(A,B,EN)
if(A==1 && EN==0 && B==1)
Y3=1;
else
Y3=0;
endmodule
module mux16a1(
input e[15:0],
input s[3:0],
input EN,
output Z);
wire out[3:0];
mux41 A (e[3:0],s[1:0],EN,out[0]);
mux41 B (e[7:4],s[1:0],EN,out[1]);
mux41 C (e[11:8],s[1:0],EN,out[2]);
mux41 D (e[15:12],s[1:0],EN,out[3]);
mux41 SELEC (out[3:0],s[3:2],EN,Z);
module mux41(
input [3:0]I,
input [1:0]S,
input EN,
output F);
assign F=(I[0]&~S[1]&~S[0]&~EN)|(I[1]&~S[1]&S[0]&~EN)|(I[2]&S[1]
&~S[0]&~EN)|(I[3]&S[1]&S[0]&~EN);
endmodule

****"Ejemplo case"****
always @ (A or sel)
case( sel )
2'b00: Y= A[0];
2'b01: Y= A[1];
2'b10: Y= A[2];
2'b11: Y= A[3];
default: Y=1'hx;
endcase
endmodule
Robtica
#POSICIN
var('alpha')
var('beta')
var('gamma')
var('D')

M1=MatrixSpace(SR,3);
R1=M1.matrix([[cos(alpha),0,sin(alpha)],[0,1,0],[-sin(alpha),0,cos(alpha)]]);
R2=M1.matrix([[1,0,0],[0,cos(beta),-sin(beta)],[0,sin(beta),cos(beta)]]);
R3=M1.matrix([[cos(gamma),0,sin(gamma)],[0,1,0],[-sin(gamma),0,cos(gamma)]]);
R3P=column_matrix([-D,0,0])
R0P=R1*R2*R3*R3P
print('El vector posicin del punto P respecto al sistema de referencia 0 es:');sh
ow(R0P)
R03=R1*R2*R3
print('la matriz de rotacin de 0 a 3 es:');show(R03);
R30=R03.transpose()
#VELOCIDADES ANGULARES
var('alpha_dot')
var('beta_dot')
var('gamma_dot')
alpha_dot1=column_matrix([0,alpha_dot,0])
beta_dot2=column_matrix([beta_dot,0,0])
gamma_dot3=column_matrix([0,gamma_dot,0])
alpha_dot0=R1*alpha_dot1
beta_dot0=R1*R2*beta_dot2
gamma_dot0=R1*R2*R3*gamma_dot3
print('Velocidad angular de alpha respecto a 0'); show(alpha_dot0)
print('Velocidad angular de beta respecto a 0'); show(beta_dot0)
print('Velocidad angular de gamma respecto a 0'); show(gamma_dot0)
omega0=alpha_dot0+beta_dot0+gamma_dot0
print('La velocidad angular total respecto a 0 es:');show(omega0)
omega3=R30*omega0
simplify(omega3)
print('La velocidad angular total respecto a 3 es:');show(simplify(omega3))

Anda mungkin juga menyukai