0% found this document useful (0 votes)
11 views7 pages

Componentes de La Alu

Uploaded by

Andrés Ramírez
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views7 pages

Componentes de La Alu

Uploaded by

Andrés Ramírez
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

COMPONENTES DE LA ALU

CODIGO EN VERILOG

SUMADOR 1 BIT

module sumador_comp

input a,

input b,

input cin,

output s,

output cout

);

assign s = a ^ b ^ cin;

assign cout = a & b | ((a^b) & cin);

endmodule

SUMADOR 4 BITS

module sumador_4bits {

input [3:0] a,

input [3:0] b,

input cin,

output [3:0] s,

output cout4

);

wire cout1,cout2,cout3;

sumador_comp fa0 (a[0], b[0], cin, s[0], cout1);

sumador_comp fa1 (a[1], b[1], cout1, s[1], cout2);

sumador_comp fa2 (a[2], b[2], cout2, s[2], cout3);

sumador_comp fa3 (a[3], b[3], cout3, s[3], cout4);


RESTADOR 1 BIT

module restador_comp {

input a,

input b,

input cin,

output d,

output cout

);

assign d = a ^ b ^ cin;

assign cout = ~a & b | ((~a ^ b) & cin);

endmodule

RESTADOR 4 BITS

module restador_4bits (

input [3:0] A,

input [3:0] B,

input cin, // Préstamo de entrada (normalmente 0)

output [3:0] d, // Resultado de la resta A - B

output cout // Préstamo final

);

wire cout1, coutB2, coutB3;

restador_comp R0 (A[0], B[0], cin, D[0], B1);

restador_comp R1 (A[1], B[1], B1, D[1], B2);

restador_comp R2 (A[2], B[2], B2, D[2], B3);

restador_comp R3 (A[3], B[3], B3, D[3], cout);

endmodule
CORRIMIENTO IZQUIERDA

module corrimiento_izquierda (

input [3:0] A,

output [3:0] S

);

assign S = A << 1; // Corrimiento a la izquierda de 1 posición

endmodule

CORRIMIENTO DERECHA

module corrimiento_derecha (

input [3:0] A,

output [3:0] S

);

assign S = A >> 1; // Corrimiento a la izquierda de 1 posición

endmodule
CONSTRAINT

## This file is a general .xdc for the Nexys4_DDR

## To use it in a project:

## - uncomment the lines corresponding to used pins

## - rename the used ports (in each line, after get_ports) according to the top level signal
names in the project

#set_property BITSTREAM.GENERAL.COMPRESS TRUE [current_design]

#set_property BITSTREAM.CONFIG.SPI_BUSWIDTH 4 [current_design]

# Clock signal

#set_property -dict { PACKAGE_PIN E3 IOSTANDARD LVCMOS33 } [get_ports { clk_i }];


#IO_L12P_T1_MRCC_35 Sch=clk100mhz

# syc_clk will be constrained by the MIG IP; commenting it avoids double clock definition and
overridden clock definition warnings

# create_clock -name sys_clk_pin -period 10.00 -waveform {0 5} [get_ports {clk_i}];

##Switches

#set_property -dict { PACKAGE_PIN J15 IOSTANDARD LVCMOS33 } [get_ports { sw_i[0] }];


#IO_L24N_T3_RS0_15 Sch=sw[0]

#set_property -dict { PACKAGE_PIN L16 IOSTANDARD LVCMOS33 } [get_ports { sw_i[1] }];


#IO_L3N_T0_DQS_EMCCLK_14 Sch=sw[1]

#set_property -dict { PACKAGE_PIN M13 IOSTANDARD LVCMOS33 } [get_ports { sw_i[2] }];


#IO_L6N_T0_D08_VREF_14 Sch=sw[2]

#set_property -dict { PACKAGE_PIN R15 IOSTANDARD LVCMOS33 } [get_ports { sw_i[3] }];


#IO_L13N_T2_MRCC_14 Sch=sw[3]

#set_property -dict { PACKAGE_PIN R17 IOSTANDARD LVCMOS33 } [get_ports { sw_i[4] }];


#IO_L12N_T1_MRCC_14 Sch=sw[4]
#set_property -dict { PACKAGE_PIN T18 IOSTANDARD LVCMOS33 } [get_ports { sw_i[5] }];
#IO_L7N_T1_D10_14 Sch=sw[5]

#set_property -dict { PACKAGE_PIN U18 IOSTANDARD LVCMOS33 } [get_ports { sw_i[6] }];


#IO_L17N_T2_A13_D29_14 Sch=sw[6]

set_property -dict { PACKAGE_PIN R13 IOSTANDARD LVCMOS33 } [get_ports { cin }];


#IO_L5N_T0_D07_14 Sch=sw[7]

set_property -dict { PACKAGE_PIN T8 IOSTANDARD LVCMOS18 } [get_ports { b[3] }];


#IO_L24N_T3_34 Sch=sw[8]

set_property -dict { PACKAGE_PIN U8 IOSTANDARD LVCMOS18 } [get_ports { b[2] }];


#IO_25_34 Sch=sw[9]

set_property -dict { PACKAGE_PIN R16 IOSTANDARD LVCMOS33 } [get_ports { b[1] }];


#IO_L15P_T2_DQS_RDWR_B_14 Sch=sw[10]

set_property -dict { PACKAGE_PIN T13 IOSTANDARD LVCMOS33 } [get_ports { b[0] }];


#IO_L23P_T3_A03_D19_14 Sch=sw[11]

set_property -dict { PACKAGE_PIN H6 IOSTANDARD LVCMOS33 } [get_ports { a[3] }];


#IO_L24P_T3_35 Sch=sw[12]

set_property -dict { PACKAGE_PIN U12 IOSTANDARD LVCMOS33 } [get_ports { a[2] }];


#IO_L20P_T3_A08_D24_14 Sch=sw[13]

set_property -dict { PACKAGE_PIN U11 IOSTANDARD LVCMOS33 } [get_ports { a[1] }];


#IO_L19N_T3_A09_D25_VREF_14 Sch=sw[14]

set_property -dict { PACKAGE_PIN V10 IOSTANDARD LVCMOS33 } [get_ports { a[0] }];


#IO_L21P_T3_DQS_14 Sch=sw[15]

Entradas

V10 = A0

U11 = A1

U12 = A2

H6 = A3

T13 = B0

R16 = B1

U8 = B2

T8 = B3

R13 = Acarreo de entrada


## LEDs

#set_property -dict { PACKAGE_PIN H17 IOSTANDARD LVCMOS33 } [get_ports { led_o[0] }];


#IO_L18P_T2_A24_15 Sch=led[0]

#set_property -dict { PACKAGE_PIN K15 IOSTANDARD LVCMOS33 } [get_ports { led_o[1] }];


#IO_L24P_T3_RS1_15 Sch=led[1]

#set_property -dict { PACKAGE_PIN J13 IOSTANDARD LVCMOS33 } [get_ports { led_o[2] }];


#IO_L17N_T2_A25_15 Sch=led[2]

#set_property -dict { PACKAGE_PIN N14 IOSTANDARD LVCMOS33 } [get_ports { led_o[3] }];


#IO_L8P_T1_D11_14 Sch=led[3]

#set_property -dict { PACKAGE_PIN R18 IOSTANDARD LVCMOS33 } [get_ports { led_o[4] }];


#IO_L7P_T1_D09_14 Sch=led[4]

#set_property -dict { PACKAGE_PIN V17 IOSTANDARD LVCMOS33 } [get_ports { led_o[5] }];


#IO_L18N_T2_A11_D27_14 Sch=led[5]

#set_property -dict { PACKAGE_PIN U17 IOSTANDARD LVCMOS33 } [get_ports { led_o[6] }];


#IO_L17P_T2_A14_D30_14 Sch=led[6]

#set_property -dict { PACKAGE_PIN U16 IOSTANDARD LVCMOS33 } [get_ports { led_o[7] }];


#IO_L18P_T2_A12_D28_14 Sch=led[7]

#set_property -dict { PACKAGE_PIN V16 IOSTANDARD LVCMOS33 } [get_ports { Led }];


#IO_L16N_T2_A15_D31_14 Sch=led[8]

#set_property -dict { PACKAGE_PIN T15 IOSTANDARD LVCMOS33 } [get_ports { led_o[9] }];


#IO_L14N_T2_SRCC_14 Sch=led[9]

#set_property -dict { PACKAGE_PIN U14 IOSTANDARD LVCMOS33 } [get_ports { led_o[10] }];


#IO_L22P_T3_A05_D21_14 Sch=led[10]

set_property -dict { PACKAGE_PIN T16 IOSTANDARD LVCMOS33 } [get_ports { s [3] }];


#IO_L15N_T2_DQS_DOUT_CSO_B_14 Sch=led[11]

set_property -dict { PACKAGE_PIN V15 IOSTANDARD LVCMOS33 } [get_ports { s [2] }];


#IO_L16P_T2_CSI_B_14 Sch=led[12]

set_property -dict { PACKAGE_PIN V14 IOSTANDARD LVCMOS33 } [get_ports { s[1] }];


#IO_L22N_T3_A04_D20_14 Sch=led[13]

set_property -dict { PACKAGE_PIN V12 IOSTANDARD LVCMOS33 } [get_ports { s [0] }];


#IO_L20N_T3_A07_D23_14 Sch=led[14]

set_property -dict { PACKAGE_PIN V11 IOSTANDARD LVCMOS33 } [get_ports {cout }];


#IO_L21N_T3_DQS_A06_D22_14 Sch=led[15]
#set_property -dict { PACKAGE_PIN R12 IOSTANDARD LVCMOS33 } [get_ports { rgb1_blue_o
}]; #IO_L5P_T0_D06_14 Sch=led16_b

#set_property -dict { PACKAGE_PIN M16 IOSTANDARD LVCMOS33 } [get_ports { rgb1_green_o


}]; #IO_L10P_T1_D14_14 Sch=led16_g

#set_property -dict { PACKAGE_PIN N15 IOSTANDARD LVCMOS33 } [get_ports { rgb1_red_o }];


#IO_L11P_T1_SRCC_14 Sch=led16_r

#set_property -dict { PACKAGE_PIN G14 IOSTANDARD LVCMOS33 } [get_ports { rgb2_blue_o


}]; #IO_L15N_T2_DQS_ADV_B_15 Sch=led17_b

#set_property -dict { PACKAGE_PIN R11 IOSTANDARD LVCMOS33 } [get_ports { rgb2_green_o


}]; #IO_0_14 Sch=led17_g

#set_property -dict { PACKAGE_PIN N16 IOSTANDARD LVCMOS33 } [get_ports { rgb2_red_o }];


#IO_L11N_T1_SRCC_14 Sch=led17_r

Salidas

LED V11= Acarreo de salida

LED V12 = S0

LED V14 = S1

LED V15 = S2

LED T16 = S3

You might also like