`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: Home user
// Engineer: Ashik Ghona
//
// Design Name: Processor functionality code
// Module Name: fa_ALU //top_module
// Project Name: 4-bit Microprocessor processor
// Target Devices:
// Tool versions: Xilinx ISE 13.4 and lesser compatible versions
// Description: This code is created to write functionalities of 4-bit microprocessors.
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
//Module for XOR_Gate/////////////////////////////////////////////////////////////////
module xor_gate(a,b,y);
input a,b;
output y;
reg y;
always@(a,b)
begin
if (a==b)
y=0;
else
y=1;
end
endmodule
////////////////////////////////////////////////////////////////////////////////
//Module for 4bit mux16_4 having 4bit_bus I/O///////////////////////////////////
module mux16_4(input [3:0] i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11,i12,i13,i14,i15,i16,input s3,s2,s1,s0,output reg [3:0] out);
always@(i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11,i12,i13,i14,i15,i16,s0,s1,s2,s3) //s1,s0 for select line, i1,i2,i3,i4 inputs
begin
case({s3,s2,s1,s0})
4'b0000 : out=i1;
4'b0001 : out=i2;
4'b0010 : out=i3;
4'b0011 : out=i4;
4'b0100 : out=i5;
4'b0101 : out=i6;
4'b0110 : out=i7;
4'b0111 : out=i8;
4'b1000 : out=i9;
4'b1001 : out=i10;
4'b1010 : out=i11;
4'b1011 : out=i12;
4'b1100 : out=i13;
4'b1101 : out=i14;
4'b1110 : out=i15;
4'b1111 : out=i16;
endcase
end
endmodule
/////////////////////////////////////////////////////////////////////////////////
//Module for 4bit bus mux21_4 having 4bit_bus I/O////////////////////////////////
module mux21_4(input [3:0] i1,i2,input m,output reg [3:0] out);
always@(m,i1,i2) //m for select line, i1,i2 inputs
begin
case(m)
1'b0 : out=i1;
1'b1 : out=i2;
endcase
end
endmodule
/////////////////////////////////////////////////////////////////////////////////
//Module for 1bit Full adder/////////////////////////////////////////////////////
module fa_1_bit(a,b,cin,s,cout);
input a,b;
input cin;
output s,cout;
wire w1;
xor_gate xor1(a,b,w1); //Instantiation from xor_gate module
xor_gate xor2(w1,cin,s); //Instantiation from xor_gate module
and and1(o1,w1,cin);
and and2(o2,a,b);
or or1(cout,o1,o2);
endmodule
/////////////////////////////////////////////////////////////////////////////////
//Module for 1bit Full adder/////////////////////////////////////////////////////
module alu_4bit(a,b,cin,sel,M,cout,temp_result);
input [3:0] a,b;
input [3:0] sel;
input M;
input cin;
output [3:0] cout,temp_result;
wire [3:0] ba,bb;
wire [3:0] tsl1,tsl2,tsl3,tsl4,tsl5,tsl6,tsl7,tsl8,tsl9,tsl10,tsl11,tsl12,tsl13,tsl14,tsl15,tsl16,tl,sum;
//Block for arithmetic operations
//Instantiation from mux16_4 having 4bit_bus I/O for A
mux16_4 mux16_arithmetic_A(a,tsl15,tsl14,4'b0000,a,tsl15,a,tsl8,a,a,tsl14,tsl12,a,tsl15,tsl14,a,sel[3],sel[2],sel[1],sel[0],ba); //ba is the output of mux_41_arithmetic
//Instantiation from mux16_4 having 4bit_bus I/O for B
mux16_4 mux16_arithmetic_B(4'b1111,4'b1111,4'b1111,4'b1111,tsl8,tsl8,~(b-1)+4'b0001,4'b0000,tsl12,b,tsl12,4'b0000,4'b0000,a,a,4'b0000,sel[3],sel[2],sel[1],sel[0],bb);//bb is the output of mux_41_arithmetic
//Instantiation from fa_1_bit module
fa_1_bit fadder1(ba[0],bb[0],cin,sum[0],cout[0]);
fa_1_bit fadder2(ba[1],bb[1],cout[0],sum[1],cout[1]);
fa_1_bit fadder3(ba[2],bb[2],cout[1],sum[2],cout[2]);
fa_1_bit fadder4(ba[3],bb[3],cout[2],sum[3],cout[3]); //s[3:1] is the output of this 4bit adder block
//Block for logical operation
assign tsl1=~a;
assign tsl2=~(a&b);
assign tsl3=~(a)&b;
assign tsl4=1;
assign tsl5=~(a|b);
assign tsl6=~b;
assign tsl7=~(a^b);
assign tsl8=a|(~b);
assign tsl9=~a&b;
assign tsl10=a^b;
assign tsl11=b;
assign tsl12=a|b;
assign tsl13=0;
assign tsl14=a&~b;
assign tsl15=a&b;
assign tsl16=a;
//Instantiation from mux16_4 having 4bit_bus I/O
mux16_4 mux16_logical(tsl1,tsl2,tsl3,tsl4,tsl5,tsl6,tsl7,tsl8,tsl9,tsl10,tsl11,tsl12,tsl13,tsl14,tsl15,tsl16,sel[3],sel[2],sel[1],sel[0],tl);
//Instantiation from mux41_4 having 4bit_bus I/O
//mux41_4 mux41_logical(tsl1,tsl2,tsl3,tsl4,sel[1],sel[0],tl); //tl is the output of mux41_logical
//Instantiation from mux21_4 having 4bit_bus I/O
mux21_4 alu_output(sum,tl,M,temp_result); //temp_result is the result of alu_output
endmodule
//////////////////////////////////////////////////////////////////////////////
//Module 4-bit Registered ALU/////////////////////////////////////////////////
module reg_alu_top_module(a,b,cin,sel,M,sum,clk,rst);
input [3:0] a,b;
input [3:0] sel;
input cin,clk,M;
input rst;
output reg [3:0] sum;
wire [3:0] result;
wire [3:0] cout;
alu_4bit alu(a,b,cin,sel,M,cout,result);
always@(posedge clk or negedge rst)
if(!rst)
sum<=4'b0000;
else
begin
sum<=result; //sum is the result of reg_alu_top_module
end
endmodule
///////////////////////////////////////////////////////////////////////////////
//Instruction Decoder Module//////////////////////////////////////////////////
// This module is the brain of the processor.
// It is implemented using Moore model FSM.
module instr_decoder_fsm(
input clk, rst,cin,
input [3:0] oper1,oper2,datain,aluout,
input [3:0] opcode,
output reg [3:0] address,aluin1,aluin2,dataout,
output reg [3:0] selalu,
output reg rwn,chipsel,
output reg [1:0] state,
output reg cin_out
);
reg [1:0] current_state;
reg [1:0] next_state;
parameter idle = 2'b00,
fetch = 2'b01,
execute = 2'b10,
load = 2'b11;
// always block for State transition logic
always @(posedge clk or negedge rst)
if (!rst)
current_state <= idle;
else
current_state <= next_state;
// always block Next state logic
always @(current_state)
begin
next_state = 2'bx;
case(current_state)
idle: next_state = fetch;
fetch: next_state = execute ;
execute: next_state = load;
load: next_state = fetch;
endcase
end
//always for Output logic
always @(current_state,aluout)
begin
case (current_state)
idle:
begin
state=idle;
chipsel=1'b1;
rwn=1'bx;
address=oper1;
aluin1=4'b0000;
aluin2=4'b0000;
cin_out=1'b0;
dataout=4'b0000;
selalu=4'b0000;
end
fetch:
begin
state=fetch;
chipsel=1'b0;
rwn=1'b1; //rwn=1 for reading memory
address=oper1; // put the address(oper1) to read data from that memory location of RAM
dataout=4'bzzzz;
aluin1=datain;
aluin2=oper2;
cin_out=cin;
selalu=opcode;
end
execute:
begin
state=execute;
selalu=opcode; //giving opcode for operations to ALU
address=oper1;
aluin1=datain; //Giving datain(which was read fro RAM in previous cycle) to ALU
aluin2=oper2; // Giving oper2 to ALU
cin_out=cin; //Giving cin to ALU.
chipsel=1'b0;
rwn=1'bz;
dataout=4'b0000;
end
load:
begin
state=load;
address=oper1; // Put the address(oper1) for RAM locaton
dataout=aluout; // put the ALU output on dataout
rwn=1'b0; //Writing ALU output to RAM
chipsel=1'b0; //selecting RAM
selalu=3'bzzz;
aluin1=4'bzzzz;
aluin2=4'bzzzz;
cin_out=1'bz;
end
endcase
end
endmodule
///////////////////////////////////////////////////////////////////////////////
//Data_RAM module//////////////////////////////////////////////////////////////
module dataram(dataout, addr, datain, csn, rwn);
input [3:0] addr;
input [3:0] datain;
input csn;
input rwn;
output reg [3:0] dataout;
reg [3:0] data [15:0];
always@(rwn,datain,csn,addr)
begin
if(csn == 1)
begin
data[0] = 0;
data[1] = 1;
data[2] = 2;
data[3] = 3;
data[4] = 4;
data[5] = 5;
data[6] = 6;
data[7] = 7;
data[8] = 8;
data[9] = 9;
data[10] = 10;
data[11] = 11;
data[12] = 12;
data[13] = 13;
data[14] = 14;
data[15] = 15;
end
if(csn==0 && rwn==1)
begin
dataout = data[addr];
end
else if(csn==0 && rwn==0)
begin
data[addr] = datain;
dataout = 4'bzzzz;
end
else
begin
dataout = 4'bzzzz;
end
end
endmodule
//////////////////////////////////////////////////////////////////////////////////
//Top module for 4-bit Microprocessor/////////////////////////////////////////////
module fa_ALU(
input [4:0] OPCODE,
input [3:0] A,
input [3:0] B,
input M,
input CLK,
input RESET,
output [1:0] STATE_OUT,
output [3:0] sum_aluout
);
//wire [1:0] STATE_OUT; //here I'm taking STATE_OUT and sum_aluout as output just to monitor results and state of FSM
//wire [3:0] sum_aluout; //If you don't want to monitor them then just remove them from port list and declare them wire
wire [3:0] ram_out_deco_in,address,aluin1_A, aluin2_B, deco_out_ram_in;
wire [4:0] selalu_sel;
wire rwn,chipsel,cout_cin;
//Instantiation from Instr_decoder_fsm module
instr_decoder_fsm decoder(CLK,RESET,OPCODE[0],A,B,ram_out_deco_in,sum_aluout,OPCODE[4:1],address,aluin1_A,aluin2_B,deco_out_ram_in,selalu_sel,rwn,chipsel,STATE_OUT,cout_cin);
//Instantiation from fa4bit_alu_final
reg_alu_top_module reg_alu(aluin1_A,aluin2_B,cout_cin,selalu_sel,M,sum_aluout,CLK,RESET);
//Instantiation from distram module
dataram ram(ram_out_deco_in, address, deco_out_ram_in,chipsel,rwn);
endmodule
/////////////////////////////////////////////////////////////////////////////////////////////
// Code OVER
Thursday, March 29, 2012
48 Operations 4-bit Microprocessor Prototype-Testbench
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company: Home user
// Engineer: Ashik Ghona
//
// Design Name: fa_ALU
// Module Name: D:/Data/Sandipani/Material/ASH/fa_ALU/fa_ALU_tb.v
// Project Name: 4-bit MicroProcessor prototype
// Target Device:
// Tool versions: Xilinx 13.4 ISE and lesser compatible versions
// Description: This testbench is created to test functionalities of 4-bit Microproccessor
//
// Verilog Test Fixture created by ISE for module: fa_ALU
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
// Owner name : Ashik Ghona
//
////////////////////////////////////////////////////////////////////////////////
module fa_ALU_tb;
// Inputs
reg [4:0] OPCODE;
reg [3:0] A;
reg [3:0] B;
reg M;
// reg Cin;
reg CLK;
reg RESET;
wire [1:0] STATE_OUT;
wire [3:0] sum_aluout;
// Instantiate the Unit Under Test (UUT)
fa_ALU uut (
.OPCODE(OPCODE),
.A(A),
.B(B),
.M(M),
// .Cin(Cin),
.CLK(CLK),
.RESET(RESET),
.STATE_OUT(STATE_OUT),
.sum_aluout(sum_aluout)
);
initial
//To initialize clock,set required frequency by setting half cycle period (#half_cycle_time: here it's #5)
CLK=0;
always #5 CLK=~CLK;
//Instructions for arithmetic Functions
parameter DEC_A=5'b00000,
DEC_AB=5'b00010,
DEC_A_BAR_B=5'b00100,
MINUS_ONE=5'b00110,
A_PLUS_OR_A_B_BAR=5'b01000,
AB_PLUS_OR_A_B_BAR=5'b01010,
A_MINUS_B_MINUS_1=5'b01100,
A_PLUS_BAR_B=5'b01110,
A_PLUS_OR_AB=5'b10000,
A_PLUS_B=5'b10010,
A_BAR_B_PLUS_OR_AB=5'b10100,
GET_OR_AB=5'b10110,
GET_Acum=5'b11000,
AB_PLUS_A=5'b11010,
A_BAR_B_PLUS_A=5'b11100,
PASS_A=5'b11110,
GET_A=5'b00001,
GET_AB=5'b00011,
GET_A_BAR_B=5'b00101,
GET_ZERO=5'b00111,
A_PLUS_OR_A_B_BAR_PLUS_1=5'b01001,
AB_PLUS_OR_A_B_BAR_PLUS_1=5'b01011,
A_MINUS_B=5'b01101,
OR_A_BAR_B_PLUS_1=5'b01111,
A_PLUS_OR_AB_PLUS_1=5'b10001,
A_PLUS_B_PLUS_1=5'b10011,
A_BAR_B_PLUS_OR_AB_PLUS_1=5'b10101,
OR_AB_PLUS_1=5'b10111,
A_PLUS_A_PLUS_1=5'b11001,
AB_PLUS_A_PLUS_1=5'b11011,
A_BAR_B_PLUS_A_PLUS_1=5'b11101,
A_PLUS_1=5'b11111,
//Instructions for logical Functions
BAR_A=5'b0000x,
NAND_AB=5'b0001x,
BAR_A_OR_B=5'b0010x,
ONE=5'b0011x,
NOR_AB=5'b0100x,
BAR_B=5'b0101x,
XNOR_AB=5'b0110x,
A_OR_BAR_B=5'b0111x,
BAR_A_AND_B=5'b1000x,
XOR_AB=5'b1001x,
PASS_B=5'b1010x,
OR_AB=5'b1011x,
PASS_0=5'b1100x,
A_AND_BAR_B=5'b1101x,
AND_AB=5'b1110x,
OUT_A=5'b1111x;
initial
begin
// Initialize Inputs
RESET = 0;OPCODE = 0;A = 0;B = 0;
//To monitor changes in variable
$monitor("RESET=%b OPCODE=%b A=%b B=%b State=%b Result=%d",RESET,OPCODE,A,B,STATE_OUT,sum_aluout);
//arithmetic operations
#10 RESET = 1; M=0; OPCODE =GET_A; A =4'b0000; // BAR A
#30 RESET = 1; M=0; OPCODE =DEC_A; A =4'b0110; // Decreament A
#30 RESET = 1; M=0; OPCODE =DEC_AB; A =4'b1110;B =4'b1100; // Decreament AB
#30 RESET = 1; M=0; OPCODE =AB_PLUS_OR_A_B_BAR; A =4'b0100;B =4'b0001;
#30 RESET = 1; M=0; OPCODE =A_PLUS_A_PLUS_1; A =4'b0101;B =4'b0010;
#30 RESET = 1; M=0; OPCODE =MINUS_ONE; A =4'b0001; // Minus on A location
//logical operations
#30 RESET = 1;M=1; OPCODE =OR_AB; A =4'b0111;B =4'b1000; // logical OR A B
#30 RESET = 1;M=1; OPCODE =XOR_AB; A =4'b1000;B =4'b1011; // logical XOR A B
#30 RESET = 1;M=1; OPCODE =AND_AB; A =4'b1001;B =4'b0001; // logical AND A B
#30 RESET = 1;M=1; OPCODE =NAND_AB; A =4'b1010;B =4'b1010; // logical NAND A B
#30 RESET = 1;M=1; OPCODE =PASS_0; A =4'b1111; // Pass 0 on A location
#30 $stop;
end
endmodule
////////////////////////////////////////////////////////////////////////////////
// Company: Home user
// Engineer: Ashik Ghona
//
// Design Name: fa_ALU
// Module Name: D:/Data/Sandipani/Material/ASH/fa_ALU/fa_ALU_tb.v
// Project Name: 4-bit MicroProcessor prototype
// Target Device:
// Tool versions: Xilinx 13.4 ISE and lesser compatible versions
// Description: This testbench is created to test functionalities of 4-bit Microproccessor
//
// Verilog Test Fixture created by ISE for module: fa_ALU
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
// Owner name : Ashik Ghona
//
////////////////////////////////////////////////////////////////////////////////
module fa_ALU_tb;
// Inputs
reg [4:0] OPCODE;
reg [3:0] A;
reg [3:0] B;
reg M;
// reg Cin;
reg CLK;
reg RESET;
wire [1:0] STATE_OUT;
wire [3:0] sum_aluout;
// Instantiate the Unit Under Test (UUT)
fa_ALU uut (
.OPCODE(OPCODE),
.A(A),
.B(B),
.M(M),
// .Cin(Cin),
.CLK(CLK),
.RESET(RESET),
.STATE_OUT(STATE_OUT),
.sum_aluout(sum_aluout)
);
initial
//To initialize clock,set required frequency by setting half cycle period (#half_cycle_time: here it's #5)
CLK=0;
always #5 CLK=~CLK;
//Instructions for arithmetic Functions
parameter DEC_A=5'b00000,
DEC_AB=5'b00010,
DEC_A_BAR_B=5'b00100,
MINUS_ONE=5'b00110,
A_PLUS_OR_A_B_BAR=5'b01000,
AB_PLUS_OR_A_B_BAR=5'b01010,
A_MINUS_B_MINUS_1=5'b01100,
A_PLUS_BAR_B=5'b01110,
A_PLUS_OR_AB=5'b10000,
A_PLUS_B=5'b10010,
A_BAR_B_PLUS_OR_AB=5'b10100,
GET_OR_AB=5'b10110,
GET_Acum=5'b11000,
AB_PLUS_A=5'b11010,
A_BAR_B_PLUS_A=5'b11100,
PASS_A=5'b11110,
GET_A=5'b00001,
GET_AB=5'b00011,
GET_A_BAR_B=5'b00101,
GET_ZERO=5'b00111,
A_PLUS_OR_A_B_BAR_PLUS_1=5'b01001,
AB_PLUS_OR_A_B_BAR_PLUS_1=5'b01011,
A_MINUS_B=5'b01101,
OR_A_BAR_B_PLUS_1=5'b01111,
A_PLUS_OR_AB_PLUS_1=5'b10001,
A_PLUS_B_PLUS_1=5'b10011,
A_BAR_B_PLUS_OR_AB_PLUS_1=5'b10101,
OR_AB_PLUS_1=5'b10111,
A_PLUS_A_PLUS_1=5'b11001,
AB_PLUS_A_PLUS_1=5'b11011,
A_BAR_B_PLUS_A_PLUS_1=5'b11101,
A_PLUS_1=5'b11111,
//Instructions for logical Functions
BAR_A=5'b0000x,
NAND_AB=5'b0001x,
BAR_A_OR_B=5'b0010x,
ONE=5'b0011x,
NOR_AB=5'b0100x,
BAR_B=5'b0101x,
XNOR_AB=5'b0110x,
A_OR_BAR_B=5'b0111x,
BAR_A_AND_B=5'b1000x,
XOR_AB=5'b1001x,
PASS_B=5'b1010x,
OR_AB=5'b1011x,
PASS_0=5'b1100x,
A_AND_BAR_B=5'b1101x,
AND_AB=5'b1110x,
OUT_A=5'b1111x;
initial
begin
// Initialize Inputs
RESET = 0;OPCODE = 0;A = 0;B = 0;
//To monitor changes in variable
$monitor("RESET=%b OPCODE=%b A=%b B=%b State=%b Result=%d",RESET,OPCODE,A,B,STATE_OUT,sum_aluout);
//arithmetic operations
#10 RESET = 1; M=0; OPCODE =GET_A; A =4'b0000; // BAR A
#30 RESET = 1; M=0; OPCODE =DEC_A; A =4'b0110; // Decreament A
#30 RESET = 1; M=0; OPCODE =DEC_AB; A =4'b1110;B =4'b1100; // Decreament AB
#30 RESET = 1; M=0; OPCODE =AB_PLUS_OR_A_B_BAR; A =4'b0100;B =4'b0001;
#30 RESET = 1; M=0; OPCODE =A_PLUS_A_PLUS_1; A =4'b0101;B =4'b0010;
#30 RESET = 1; M=0; OPCODE =MINUS_ONE; A =4'b0001; // Minus on A location
//logical operations
#30 RESET = 1;M=1; OPCODE =OR_AB; A =4'b0111;B =4'b1000; // logical OR A B
#30 RESET = 1;M=1; OPCODE =XOR_AB; A =4'b1000;B =4'b1011; // logical XOR A B
#30 RESET = 1;M=1; OPCODE =AND_AB; A =4'b1001;B =4'b0001; // logical AND A B
#30 RESET = 1;M=1; OPCODE =NAND_AB; A =4'b1010;B =4'b1010; // logical NAND A B
#30 RESET = 1;M=1; OPCODE =PASS_0; A =4'b1111; // Pass 0 on A location
#30 $stop;
end
endmodule
Saturday, March 10, 2012
4 bit Microprocessor Prototype Specifications
Kindly find the specifications pdf from my website in technical books section.
link is here :
http://akghona.webs.com/apps/documents/
//arithmetic operations
OPCODE =Add_AB; A =4'b0001;B =4'b0001; // ADD A B
OPCODE=Inc_A; A =4'b0010; // increament A
OPCODE =Trans_A; A =4'b0011; // Transfer A
OPCODE =Add_AB_Cin; A =4'b0100;B =4'b0001; // addition with carry
OPCODE =Sub_AB; A =4'b0101;B =4'b0010; // Subtraction A B
OPCODE =Dec_A; A =4'b0110; // Decreament A B
//logical operations
OPCODE =OR_AB; A =4'b0111;B =4'b1000; // logical OR A B
OPCODE =XOR_AB; A =4'b1000;B =4'b1011; // logical XOR A B
OPCODE =AND_AB; A =4'b1001;B =4'b0001; // logical AND A B
OPCODE =NOT_A; A =4'b1010; // logical NOT A
OPCODE =Sub_AB_borrow; A =4'b1111;B =4'b0010; // subtraction with borrow
link is here :
http://akghona.webs.com/apps/documents/
//arithmetic operations
OPCODE =Add_AB; A =4'b0001;B =4'b0001; // ADD A B
OPCODE=Inc_A; A =4'b0010; // increament A
OPCODE =Trans_A; A =4'b0011; // Transfer A
OPCODE =Add_AB_Cin; A =4'b0100;B =4'b0001; // addition with carry
OPCODE =Sub_AB; A =4'b0101;B =4'b0010; // Subtraction A B
OPCODE =Dec_A; A =4'b0110; // Decreament A B
//logical operations
OPCODE =OR_AB; A =4'b0111;B =4'b1000; // logical OR A B
OPCODE =XOR_AB; A =4'b1000;B =4'b1011; // logical XOR A B
OPCODE =AND_AB; A =4'b1001;B =4'b0001; // logical AND A B
OPCODE =NOT_A; A =4'b1010; // logical NOT A
OPCODE =Sub_AB_borrow; A =4'b1111;B =4'b0010; // subtraction with borrow
Testbench file for 4-bit Microprocessor
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company: Home user
// Engineer: Ashik Ghona
//
// Create Date: 22:32:58 03/07/2012
// Design Name: fa_ALU
// Module Name: D:/Data/Sandipani/Material/ASH/fa_ALU/fa_ALU_tb.v
// Project Name: 4-bit MicroProcessor prototype
// Target Device:
// Tool versions: Xilinx 13.4 ISE and lesser compatible versions
// Description: This testbench is created to test functionalities of 4-bit Microproccessor
//
// Verilog Test Fixture created by ISE for module: fa_ALU
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
// Owner name : Ashik Ghona
//
////////////////////////////////////////////////////////////////////////////////
module fa_ALU_tb;
// Inputs
reg [3:0] OPCODE;
reg [3:0] A;
reg [3:0] B;
reg CLK;
reg RESET;
wire [1:0] STATE_OUT;
wire [3:0] sum_aluout;
// Instantiate the Unit Under Test (UUT)
fa_ALU uut (
.OPCODE(OPCODE),
.A(A),
.B(B),
.CLK(CLK),
.RESET(RESET),
.STATE_OUT(STATE_OUT),
.sum_aluout(sum_aluout)
);
initial
//To initialize clock,set required frequency by setting half cycle period
//(#half_cycle_time: here it's #5)
CLK=0;
always #5 CLK=~CLK;
//Instructions for arithmetic Functions
parameter Trans_A=4'b0000,
Inc_A=4'b0001,
Add_AB=4'b0010,
Add_AB_Cin=4'b0011,
Sub_AB_borrow=4'b0100,
Sub_AB=4'b0101,
Dec_A=4'b0110,
Trans_A_B1=4'b0111,
//Instructions for logical Functions
OR_AB=4'b100x,
XOR_AB=4'b101x,
AND_AB=4'b110x,
NOT_A=4'b111x;
initial
begin
// Initialize Inputs
RESET = 0;OPCODE = 0;A = 0;B = 0;
//To monitor changes in variable
$monitor("RESET=%b OPCODE=%b A=%b B=%b State=%b Result=%d",RESET,OPCODE,A,B,STATE_OUT,sum_aluout);
//arithmetic operations
#10 RESET = 1; OPCODE =Add_AB; A =4'b0001;B =4'b0001; // ADD A B
#30 RESET = 1; OPCODE =Inc_A; A =4'b0010; // increament A
#30 RESET = 1; OPCODE =Trans_A; A =4'b0011; // Transfer A
#30 RESET = 1; OPCODE =Add_AB_Cin; A =4'b0100;B =4'b0001; // addition with carry
#30 RESET = 1; OPCODE =Sub_AB; A =4'b0101;B =4'b0010; // Subtraction A B
#30 RESET = 1; OPCODE =Dec_A; A =4'b0110; // Decreament A B
//logical operations
#30 RESET = 1; OPCODE =OR_AB; A =4'b0111;B =4'b1000; // logical OR A B
#30 RESET = 1; OPCODE =XOR_AB; A =4'b1000;B =4'b1011; // logical XOR A B
#30 RESET = 1; OPCODE =AND_AB; A =4'b1001;B =4'b0001; // logical AND A B
#30 RESET = 1; OPCODE =NOT_A; A =4'b1010; // logical NOT A
#30 RESET = 1; OPCODE =Sub_AB_borrow; A =4'b1111;B =4'b0010; // subtraction with borrow
#30 $stop;
end
endmodule
////////////////////////////////////////////////////////////////////////////////
// Company: Home user
// Engineer: Ashik Ghona
//
// Create Date: 22:32:58 03/07/2012
// Design Name: fa_ALU
// Module Name: D:/Data/Sandipani/Material/ASH/fa_ALU/fa_ALU_tb.v
// Project Name: 4-bit MicroProcessor prototype
// Target Device:
// Tool versions: Xilinx 13.4 ISE and lesser compatible versions
// Description: This testbench is created to test functionalities of 4-bit Microproccessor
//
// Verilog Test Fixture created by ISE for module: fa_ALU
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
// Owner name : Ashik Ghona
//
////////////////////////////////////////////////////////////////////////////////
module fa_ALU_tb;
// Inputs
reg [3:0] OPCODE;
reg [3:0] A;
reg [3:0] B;
reg CLK;
reg RESET;
wire [1:0] STATE_OUT;
wire [3:0] sum_aluout;
// Instantiate the Unit Under Test (UUT)
fa_ALU uut (
.OPCODE(OPCODE),
.A(A),
.B(B),
.CLK(CLK),
.RESET(RESET),
.STATE_OUT(STATE_OUT),
.sum_aluout(sum_aluout)
);
initial
//To initialize clock,set required frequency by setting half cycle period
//(#half_cycle_time: here it's #5)
CLK=0;
always #5 CLK=~CLK;
//Instructions for arithmetic Functions
parameter Trans_A=4'b0000,
Inc_A=4'b0001,
Add_AB=4'b0010,
Add_AB_Cin=4'b0011,
Sub_AB_borrow=4'b0100,
Sub_AB=4'b0101,
Dec_A=4'b0110,
Trans_A_B1=4'b0111,
//Instructions for logical Functions
OR_AB=4'b100x,
XOR_AB=4'b101x,
AND_AB=4'b110x,
NOT_A=4'b111x;
initial
begin
// Initialize Inputs
RESET = 0;OPCODE = 0;A = 0;B = 0;
//To monitor changes in variable
$monitor("RESET=%b OPCODE=%b A=%b B=%b State=%b Result=%d",RESET,OPCODE,A,B,STATE_OUT,sum_aluout);
//arithmetic operations
#10 RESET = 1; OPCODE =Add_AB; A =4'b0001;B =4'b0001; // ADD A B
#30 RESET = 1; OPCODE =Inc_A; A =4'b0010; // increament A
#30 RESET = 1; OPCODE =Trans_A; A =4'b0011; // Transfer A
#30 RESET = 1; OPCODE =Add_AB_Cin; A =4'b0100;B =4'b0001; // addition with carry
#30 RESET = 1; OPCODE =Sub_AB; A =4'b0101;B =4'b0010; // Subtraction A B
#30 RESET = 1; OPCODE =Dec_A; A =4'b0110; // Decreament A B
//logical operations
#30 RESET = 1; OPCODE =OR_AB; A =4'b0111;B =4'b1000; // logical OR A B
#30 RESET = 1; OPCODE =XOR_AB; A =4'b1000;B =4'b1011; // logical XOR A B
#30 RESET = 1; OPCODE =AND_AB; A =4'b1001;B =4'b0001; // logical AND A B
#30 RESET = 1; OPCODE =NOT_A; A =4'b1010; // logical NOT A
#30 RESET = 1; OPCODE =Sub_AB_borrow; A =4'b1111;B =4'b0010; // subtraction with borrow
#30 $stop;
end
endmodule
Verilog Code for 4-bit Microprocessor
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: Home user
// Engineer: Ashik Ghona
//
// Create Date: 16:47:54 07/03/2012
// Design Name: Processor functionality code
// Module Name: fa_ALU //top_module
// Project Name: 4-bit Microprocessor processor
// Target Devices:
// Tool versions: Xilinx ISE 13.4 and lesser compatible versions
// Description: This code is created to write functionalities of 4-bit microprocessors.
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
//Module for XOR_Gate/////////////////////////////////////////////////////////////////
module xor_gate(a,b,y);
input a,b;
output y;
reg y;
always@(a,b)
begin
if (a==b)
y=0;
else
y=1;
end
endmodule
////////////////////////////////////////////////////////////////////////////////
//Module for 4bit mux41_4 having 4bit_bus I/O///////////////////////////////////
module mux41_4(input [3:0] i1,i2,i3,i4 ,input s1,s0,output reg [3:0] out);
always@(i1,i2,i3,i4,i1,s0,s1) //s1,s0 for select line, i1,i2,i3,i4 inputs
begin
case({s1,s0})
2'b00 : out=i1;
2'b01 : out=i2;
2'b10 : out=i3;
2'b11 : out=i4;
endcase
end
endmodule
/////////////////////////////////////////////////////////////////////////////////
//Module for 4bit bus mux21_4 having 4bit_bus I/O////////////////////////////////
module mux21_4(input [3:0] i1,i2,input s2,output reg [3:0] out);
always@(s2,i1,i2) //s2 for select line, i1,i2 inputs
begin
case(s2)
1'b0 : out=i1;
1'b1 : out=i2;
endcase
end
endmodule
/////////////////////////////////////////////////////////////////////////////////
//Module for 1bit Full adder/////////////////////////////////////////////////////
module fa_1_bit(a,b,cin,s,cout);
input a,b;
input cin;
output s,cout;
wire w1;
xor_gate xor1(a,b,w1); //Instantiation from xor_gate module
xor_gate xor2(w1,cin,s); //Instantiation from xor_gate module
and and1(o1,w1,cin);
and and2(o2,a,b);
or or1(cout,o1,o2);
endmodule
/////////////////////////////////////////////////////////////////////////////////
//Module for 1bit Full adder/////////////////////////////////////////////////////
module alu_4bit(a,b,cin,sel,cout,temp_result);
input [3:0] a,b;
input [2:0] sel;
input cin;
output [3:0] cout,temp_result;
wire [3:0] bb;
wire [3:0] tsl1,tsl2,tsl3,tsl4,tl,sum;
//Block for arithmetic operations
//Instantiation from mux41_4 having 4bit_bus I/O
mux41_4 mux41_arithmetic(4'b0000,b,~b,4'b1111,sel[1],sel[0],bb);
//bb is the output of mux_41_arithmetic
//Instantiation from fa_1_bit module
fa_1_bit fadder1(a[0],bb[0],cin,sum[0],cout[0]);
fa_1_bit fadder2(a[1],bb[1],cout[0],sum[1],cout[1]);
fa_1_bit fadder3(a[2],bb[2],cout[1],sum[2],cout[2]);
fa_1_bit fadder4(a[3],bb[3],cout[2],sum[3],cout[3]);
//s[3:1] is the output of this 4bit adder block
//Block for logical operation
assign tsl1=a|b;
assign tsl2=a^b;
assign tsl3=a&b;
assign tsl4=~a;
//Instantiation from mux41_4 having 4bit_bus I/O
mux41_4 mux41_logical(tsl1,tsl2,tsl3,tsl4,sel[1],sel[0],tl);
//tl is the output of mux41_logical
//Instantiation from mux21_4 having 4bit_bus I/O
mux21_4 alu_output(sum,tl,sel[2],temp_result); //temp_result is the result of alu_output
endmodule
//////////////////////////////////////////////////////////////////////////////
//Module 4-bit Registered ALU/////////////////////////////////////////////////
module reg_alu_top_module(a,b,cin,sel,sum,clk,rst);
input [3:0] a,b;
input [2:0] sel;
input cin,clk;
input rst;
output reg [3:0] sum;
wire [3:0] result;
wire [3:0] cout;
alu_4bit alu(a,b,cin,sel,cout,result);
always@(posedge clk or negedge rst)
if(!rst)
sum<=4'b0000;
else
begin
sum<=result; //sum is the result of reg_alu_top_module
end
endmodule
///////////////////////////////////////////////////////////////////////////////
//Instruction Decoder Module//////////////////////////////////////////////////
// This module is the brain of the processor.
// It is implemented using Moore model FSM.
module instr_decoder_fsm(
input clk, rst,cin,
input [3:0] oper1,oper2,datain,aluout,
input [2:0] opcode,
output reg [3:0] address,aluin1,aluin2,dataout,
output reg [2:0] selalu,
output reg rwn,chipsel,
output reg [1:0] state,
output reg cin_out
);
reg [1:0] current_state;
reg [1:0] next_state;
parameter idle = 2'b00,
fetch = 2'b01,
execute = 2'b10,
load = 2'b11;
// always block for State transition logic
always @(posedge clk or negedge rst)
if (!rst)
current_state <= idle;
else
current_state <= next_state;
// always block Next state logic
always @(current_state)
begin
next_state = 2'bx;
case(current_state)
idle: next_state = fetch;
fetch: next_state = execute ;
execute: next_state = load;
load: next_state = fetch;
endcase
end
//always for Output logic
always @(current_state,aluout)
begin
case (current_state)
idle:
begin
state=idle;
chipsel=1'b1;
rwn=1'bx;
address=oper1;
aluin1=4'b0000;
aluin2=4'b0000;
cin_out=1'b0;
dataout=4'b0000;
selalu=3'b000;
end
fetch:
begin
state=fetch;
chipsel=1'b0;
rwn=1'b1; //rwn=1 for reading memory
address=oper1; // put the address(oper1) to read data from that memory location of RAM
dataout=4'bzzzz;
aluin1=datain;
aluin2=oper2;
cin_out=cin;
selalu=opcode;
end
execute:
begin
state=execute;
selalu=opcode; //Giving opcode for operations to ALU
address=oper1;
aluin1=datain; //Giving datain(which was read fro RAM in previous cycle) to ALU
aluin2=oper2; // Giving oper2 to ALU
cin_out=cin; //Giving cin to ALU.
chipsel=1'b0;
rwn=1'bz;
dataout=4'b0000;
end
load:
begin
state=load;
address=oper1; //Put the address(oper1) for RAM locaton
dataout=aluout; //put the ALU output on dataout
rwn=1'b0; //Writing ALU output to RAM
chipsel=1'b0; //Selecting RAM
selalu=3'bzzz;
aluin1=4'bzzzz;
aluin2=4'bzzzz;
cin_out=1'bz;
end
endcase
end
endmodule
///////////////////////////////////////////////////////////////////////////////
//Data_RAM module//////////////////////////////////////////////////////////////
module dataram(dataout, addr, datain, csn, rwn);
input [3:0] addr;
input [3:0] datain;
input csn;
input rwn;
output reg [3:0] dataout;
reg [3:0] data [15:0];
always@(rwn,datain,csn,addr)
begin
if(csn == 1)
begin
data[0] = 0;
data[1] = 1;
data[2] = 2;
data[3] = 3;
data[4] = 4;
data[5] = 5;
data[6] = 6;
data[7] = 7;
data[8] = 8;
data[9] = 9;
data[10] = 10;
data[11] = 11;
data[12] = 12;
data[13] = 13;
data[14] = 14;
data[15] = 15;
end
if(csn==0 && rwn==1)
begin
dataout = data[addr];
end
else if(csn==0 && rwn==0)
begin
data[addr] = datain;
dataout = 4'bzzzz;
end
else
begin
dataout = 4'bzzzz;
end
end
endmodule
//////////////////////////////////////////////////////////////////////////////////
//Top module for 4-bit Microprocessor/////////////////////////////////////////////
module fa_ALU(
input [3:0] OPCODE,
input [3:0] A,
input [3:0] B,
input CLK,
input RESET,
output [1:0] STATE_OUT,
output [3:0] sum_aluout
);
//wire [1:0] STATE_OUT;
//wire [3:0] sum_aluout;
/*here I'm taking STATE_OUT and sum_aluout as output just to monitor results and state of FSM*/
/*If you don't want to monitor them then just remove them from port list and declare them wire*/
wire [3:0] ram_out_deco_in,address,aluin1_A, aluin2_B, deco_out_ram_in;
wire [2:0] selalu_sel;
wire rwn,chipsel,cout_cin;
//Instantiation from Instr_decoder_fsm module
instr_decoder_fsm decoder(
CLK,RESET,OPCODE[0],A,B,ram_out_deco_in,sum_aluout,OPCODE[3:1],
address,aluin1_A,aluin2_B,deco_out_ram_in,selalu_sel,rwn,
chipsel,STATE_OUT,cout_cin);
//Instantiation from fa4bit_alu_final
reg_alu_top_module reg_alu(
aluin1_A,aluin2_B,cout_cin,selalu_sel,
sum_aluout,CLK,RESET);
//Instantiation from distram module
dataram ram(
ram_out_deco_in, address, deco_out_ram_in,chipsel,rwn);
endmodule
/////////////////////////////////////////////////////////////////////////////////////////////
// Code OVER
//////////////////////////////////////////////////////////////////////////////////
// Company: Home user
// Engineer: Ashik Ghona
//
// Create Date: 16:47:54 07/03/2012
// Design Name: Processor functionality code
// Module Name: fa_ALU //top_module
// Project Name: 4-bit Microprocessor processor
// Target Devices:
// Tool versions: Xilinx ISE 13.4 and lesser compatible versions
// Description: This code is created to write functionalities of 4-bit microprocessors.
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
//Module for XOR_Gate/////////////////////////////////////////////////////////////////
module xor_gate(a,b,y);
input a,b;
output y;
reg y;
always@(a,b)
begin
if (a==b)
y=0;
else
y=1;
end
endmodule
////////////////////////////////////////////////////////////////////////////////
//Module for 4bit mux41_4 having 4bit_bus I/O///////////////////////////////////
module mux41_4(input [3:0] i1,i2,i3,i4 ,input s1,s0,output reg [3:0] out);
always@(i1,i2,i3,i4,i1,s0,s1) //s1,s0 for select line, i1,i2,i3,i4 inputs
begin
case({s1,s0})
2'b00 : out=i1;
2'b01 : out=i2;
2'b10 : out=i3;
2'b11 : out=i4;
endcase
end
endmodule
/////////////////////////////////////////////////////////////////////////////////
//Module for 4bit bus mux21_4 having 4bit_bus I/O////////////////////////////////
module mux21_4(input [3:0] i1,i2,input s2,output reg [3:0] out);
always@(s2,i1,i2) //s2 for select line, i1,i2 inputs
begin
case(s2)
1'b0 : out=i1;
1'b1 : out=i2;
endcase
end
endmodule
/////////////////////////////////////////////////////////////////////////////////
//Module for 1bit Full adder/////////////////////////////////////////////////////
module fa_1_bit(a,b,cin,s,cout);
input a,b;
input cin;
output s,cout;
wire w1;
xor_gate xor1(a,b,w1); //Instantiation from xor_gate module
xor_gate xor2(w1,cin,s); //Instantiation from xor_gate module
and and1(o1,w1,cin);
and and2(o2,a,b);
or or1(cout,o1,o2);
endmodule
/////////////////////////////////////////////////////////////////////////////////
//Module for 1bit Full adder/////////////////////////////////////////////////////
module alu_4bit(a,b,cin,sel,cout,temp_result);
input [3:0] a,b;
input [2:0] sel;
input cin;
output [3:0] cout,temp_result;
wire [3:0] bb;
wire [3:0] tsl1,tsl2,tsl3,tsl4,tl,sum;
//Block for arithmetic operations
//Instantiation from mux41_4 having 4bit_bus I/O
mux41_4 mux41_arithmetic(4'b0000,b,~b,4'b1111,sel[1],sel[0],bb);
//bb is the output of mux_41_arithmetic
//Instantiation from fa_1_bit module
fa_1_bit fadder1(a[0],bb[0],cin,sum[0],cout[0]);
fa_1_bit fadder2(a[1],bb[1],cout[0],sum[1],cout[1]);
fa_1_bit fadder3(a[2],bb[2],cout[1],sum[2],cout[2]);
fa_1_bit fadder4(a[3],bb[3],cout[2],sum[3],cout[3]);
//s[3:1] is the output of this 4bit adder block
//Block for logical operation
assign tsl1=a|b;
assign tsl2=a^b;
assign tsl3=a&b;
assign tsl4=~a;
//Instantiation from mux41_4 having 4bit_bus I/O
mux41_4 mux41_logical(tsl1,tsl2,tsl3,tsl4,sel[1],sel[0],tl);
//tl is the output of mux41_logical
//Instantiation from mux21_4 having 4bit_bus I/O
mux21_4 alu_output(sum,tl,sel[2],temp_result); //temp_result is the result of alu_output
endmodule
//////////////////////////////////////////////////////////////////////////////
//Module 4-bit Registered ALU/////////////////////////////////////////////////
module reg_alu_top_module(a,b,cin,sel,sum,clk,rst);
input [3:0] a,b;
input [2:0] sel;
input cin,clk;
input rst;
output reg [3:0] sum;
wire [3:0] result;
wire [3:0] cout;
alu_4bit alu(a,b,cin,sel,cout,result);
always@(posedge clk or negedge rst)
if(!rst)
sum<=4'b0000;
else
begin
sum<=result; //sum is the result of reg_alu_top_module
end
endmodule
///////////////////////////////////////////////////////////////////////////////
//Instruction Decoder Module//////////////////////////////////////////////////
// This module is the brain of the processor.
// It is implemented using Moore model FSM.
module instr_decoder_fsm(
input clk, rst,cin,
input [3:0] oper1,oper2,datain,aluout,
input [2:0] opcode,
output reg [3:0] address,aluin1,aluin2,dataout,
output reg [2:0] selalu,
output reg rwn,chipsel,
output reg [1:0] state,
output reg cin_out
);
reg [1:0] current_state;
reg [1:0] next_state;
parameter idle = 2'b00,
fetch = 2'b01,
execute = 2'b10,
load = 2'b11;
// always block for State transition logic
always @(posedge clk or negedge rst)
if (!rst)
current_state <= idle;
else
current_state <= next_state;
// always block Next state logic
always @(current_state)
begin
next_state = 2'bx;
case(current_state)
idle: next_state = fetch;
fetch: next_state = execute ;
execute: next_state = load;
load: next_state = fetch;
endcase
end
//always for Output logic
always @(current_state,aluout)
begin
case (current_state)
idle:
begin
state=idle;
chipsel=1'b1;
rwn=1'bx;
address=oper1;
aluin1=4'b0000;
aluin2=4'b0000;
cin_out=1'b0;
dataout=4'b0000;
selalu=3'b000;
end
fetch:
begin
state=fetch;
chipsel=1'b0;
rwn=1'b1; //rwn=1 for reading memory
address=oper1; // put the address(oper1) to read data from that memory location of RAM
dataout=4'bzzzz;
aluin1=datain;
aluin2=oper2;
cin_out=cin;
selalu=opcode;
end
execute:
begin
state=execute;
selalu=opcode; //Giving opcode for operations to ALU
address=oper1;
aluin1=datain; //Giving datain(which was read fro RAM in previous cycle) to ALU
aluin2=oper2; // Giving oper2 to ALU
cin_out=cin; //Giving cin to ALU.
chipsel=1'b0;
rwn=1'bz;
dataout=4'b0000;
end
load:
begin
state=load;
address=oper1; //Put the address(oper1) for RAM locaton
dataout=aluout; //put the ALU output on dataout
rwn=1'b0; //Writing ALU output to RAM
chipsel=1'b0; //Selecting RAM
selalu=3'bzzz;
aluin1=4'bzzzz;
aluin2=4'bzzzz;
cin_out=1'bz;
end
endcase
end
endmodule
///////////////////////////////////////////////////////////////////////////////
//Data_RAM module//////////////////////////////////////////////////////////////
module dataram(dataout, addr, datain, csn, rwn);
input [3:0] addr;
input [3:0] datain;
input csn;
input rwn;
output reg [3:0] dataout;
reg [3:0] data [15:0];
always@(rwn,datain,csn,addr)
begin
if(csn == 1)
begin
data[0] = 0;
data[1] = 1;
data[2] = 2;
data[3] = 3;
data[4] = 4;
data[5] = 5;
data[6] = 6;
data[7] = 7;
data[8] = 8;
data[9] = 9;
data[10] = 10;
data[11] = 11;
data[12] = 12;
data[13] = 13;
data[14] = 14;
data[15] = 15;
end
if(csn==0 && rwn==1)
begin
dataout = data[addr];
end
else if(csn==0 && rwn==0)
begin
data[addr] = datain;
dataout = 4'bzzzz;
end
else
begin
dataout = 4'bzzzz;
end
end
endmodule
//////////////////////////////////////////////////////////////////////////////////
//Top module for 4-bit Microprocessor/////////////////////////////////////////////
module fa_ALU(
input [3:0] OPCODE,
input [3:0] A,
input [3:0] B,
input CLK,
input RESET,
output [1:0] STATE_OUT,
output [3:0] sum_aluout
);
//wire [1:0] STATE_OUT;
//wire [3:0] sum_aluout;
/*here I'm taking STATE_OUT and sum_aluout as output just to monitor results and state of FSM*/
/*If you don't want to monitor them then just remove them from port list and declare them wire*/
wire [3:0] ram_out_deco_in,address,aluin1_A, aluin2_B, deco_out_ram_in;
wire [2:0] selalu_sel;
wire rwn,chipsel,cout_cin;
//Instantiation from Instr_decoder_fsm module
instr_decoder_fsm decoder(
CLK,RESET,OPCODE[0],A,B,ram_out_deco_in,sum_aluout,OPCODE[3:1],
address,aluin1_A,aluin2_B,deco_out_ram_in,selalu_sel,rwn,
chipsel,STATE_OUT,cout_cin);
//Instantiation from fa4bit_alu_final
reg_alu_top_module reg_alu(
aluin1_A,aluin2_B,cout_cin,selalu_sel,
sum_aluout,CLK,RESET);
//Instantiation from distram module
dataram ram(
ram_out_deco_in, address, deco_out_ram_in,chipsel,rwn);
endmodule
/////////////////////////////////////////////////////////////////////////////////////////////
// Code OVER
Subscribe to:
Posts (Atom)
