سلام دوست عزیز
این که نگرانی نداره تمام شماتیک یک alu توی کتاب معماری کامپیوتر موریس مانو موجوده .فقط کافیه که اون رو توی نرم افزار ise و ویا quartus طراحی کنید وتبدیل به کد های verilog کنید.من قبلا یک alu چهار بیتی رو با quartus طراحی کرده بودم که از زبان verilog استفاده کردم.برای دانلود این پروژه از لینک زیر استفاده کن می تونی همین رو به استادت بدی
:wow:
دوست عزیز خیلی خیلی از شما ممنونم
منتها پسوند bdf با چی باز میشه
آخه من نرمافزار quartus را ندارم
اگه زحمتی نیست لطف کنید و متن برنامه را بزارید
خیلی خیلی ممنون
input [3:0] a,b; // port A,B
input cin ; // carry input from carry flag register
output [3:0] alu; // the result
output carry; // carry output
output zero ; // zero output
input [3:0] ctl ; // functionality control for ALU
wire [4:0] result; // ALU result
assign result = alu_out(a,b,cin,ctl);
assign alu = result[3:0];
assign carry = result[4] ;
assign zero = z_flag(result) ;
function [4:0] alu_out;
input [3:0] a,b ;
input cin ;
input [3:0] ctl ;
case ( ctl )
4'b0000: alu_out=b; // select data on port B
4'b0001: alu_out=b+4'b0001 ; // increment data on port B
4'b0010: alu_out=b-4'b0001 ; // decrement data on port B
4'b0011: alu_out=a+b; // ADD without CARRY
4'b0100: alu_out=a+b+cin; // ADD with CARRY
4'b0101: alu_out=a-b ; // SUB without BORROW
4'b0110: alu_out=a-b+(~cin); // SUB with BORROW
4'b0111: alu_out=a&b; // AND
4'b1000: alu_out=a|b; // OR
4'b1001: alu_out=a^b; // EXOR
4'b1010: alu_out={b[3:0],1'b0}; // Shift Left
4'b1011: alu_out={b[0],1'b0,b[3:1]}; // Shift Right
4'b1100: alu_out={b[3:0],cin}; // Rotate Left
4'b1101: alu_out={b[0],cin,b[3:1]}; // Rotate Right
default : begin
alu_out=9'bxxxxxxxxx;
$display("Illegal CTL detected!!"
end
endcase /* {...,...,...} is for the concatenation.
{ADD_WITH_CARRY,SUB_WITH_BORROW}==2'b11 is used
to force the CARRY==1 for the increment operation */
endfunction // end of function "result"
function z_flag ;
input [4:0] a4 ;
begin
z_flag = ^(a4[0]|a4[1]|a4[2]|a4[3]) ; // zero flag check for a4
end
endfunction
endmodule
و یک 8 بیتی
module alu(CLK,RESET,A,B,Y,OP,C,N,V,Z);
//************************************************** **
// 8 bit arithmetic logic unit
//
// parameter:
// CLK.......system clock
// RESET.....System Reset
// A.........A input
// B.........B input
// OP........operation to perform
// Y.........8 bit result output
// C.........carry status
// V.........overflow status
// N.........sign status
// Z.........zero status
//
//************************************************** **
input CLK,RESET;
input [7:0] A;
input [7:0] B;
input [15:0] OP;
output [7:0] Y;
output C;
output V;
output N;
output Z;
//------------------------------------------------------
// internal nodes
//------------------------------------------------------
reg [7:0] Y,LogicUnit,AluNoShift;
wire [7:0] ArithUnit;
reg shiftout;
wire C,V,N,Z;
wire carryout;
wire ovf;
reg Neg; //negative status from ALU
reg Zero; //Zero Status from ALU
//-----------------------------------------------------------
// Arithmetic unit
//
// gona use myAddSub for this part...it seems to work right...
// rather than trying to infer the thing.
//
// operation of the adder subtractor is as follows
//
// OP[0] OP[1] carry | operation
// 0 0 0 | Y = A - 1;
// 0 0 1 | Y = A;
// 0 1 0 | Y = A - B - 1;
// 0 1 1 | Y = A - B;
// 1 0 0 | Y = A;
// 1 0 1 | Y = A + 1;
// 1 1 0 | Y = A + B;
// 1 1 1 | Y = A + B + 1;
//
//------------------------------------------------------------
//---------------------------------------------
// Logic Unit
// OP[1] OP[0] | operation
// 0 0 | Y = A and B
// 0 1 | Y = A or B
// 1 0 | Y = A xor B
// 1 1 | Y = Not A
//---------------------------------------------
always @ (A or B or OP[1:0])
begin
case (OP[1:0])
2'b00:LogicUnit = A & B;
2'b01:LogicUnit = A | B;
2'b10:LogicUnit = A ^ B;
2'b11:LogicUnit = !A;
default:LogicUnit = 8'bx;
endcase
end
//----------------------------------------------
// Select between logic and arithmatic
// OP[2] | operation
// 0 | Arithmetic operation
// 1 | Logical Operation
//----------------------------------------------
always @ (OP[2] or LogicUnit or ArithUnit)
begin
if(OP[2])
AluNoShift = LogicUnit;
else
AluNoShift = ArithUnit[7:0];
end
//-----------------------------------------------
// Shift operations
//
// OP[3] OP[4] OP[5] | operation
// 0 0 0 | NOP
// 1 0 0 | Shift Left (ASL)
// 0 1 0 | Arithmentic Shift Right (ASR..new)
// 1 1 0 | Logical Shift Right (LSR)
// 0 0 1 | Rotate Left (ROL)
// 1 0 1 | Rotate Right (ROR)
// 0 1 1 | NOP
// 1 1 1 | NOP
//-----------------------------------------------
always @ (OP[5:3] or AluNoShift or C)
begin
case(OP[5:3])
3'b000: begin
Y = AluNoShift; //do not shift output
shiftout = 0;
end
3'b001: begin
Y = {AluNoShift[6:0],1'b0}; //ASL
shiftout = AluNoShift[7];
end
3'b010: begin
Y = {AluNoShift[7],AluNoShift[7:1]}; //ASR
shiftout = AluNoShift[0];
end
3'b011: begin
Y = {1'b0,AluNoShift[7:1]}; //LSR
shiftout = AluNoShift[0];
end
3'b100: begin
Y = {AluNoShift[6:0],C};
shiftout = AluNoShift[7];
end
3'b101: begin
Y = {C,AluNoShift[7:1]}; //LSR
shiftout = AluNoShift[0];
end
3'b110: begin
Y = AluNoShift; //do not shift output
shiftout = 0;
end
3'b111: begin
Y = AluNoShift; //do not shift output
shiftout = 0;
end
default: begin
Y = 8'bx;
shiftout = 0;
end
endcase
end
//-----------------------------------------------------------
// Generate the status bits for the status registers
//
//-----------------------------------------------------------
always @(Y)
begin
if(!Y[0] & !Y[1] & !Y[2] & !Y[3] & !Y[4] & !Y[5] & !Y[6] & !Y[7])
Zero = 1;
else
Zero = 0;
end
سلام آقا محمد
من این فایل زیپ را دانلود کردم و بعد از اجرای آن به چند فولدر برخوردم
اما نمی دانم کدام یک را به استاد تحویل دهم
و نیز نتوانستم نرم افزار کوارتوس را پیدا کنم
لطفا مرا راهنمایی کنید
با تشکر فراوان :cry2:
سلام...
من دانشجوی کامپیوتر هستم و برای درس ریزپردازنده باید یه alu چهار بیتی با زبان bascom طراحی کنم.
میشه کمکم کنید ، آخه من هیچ چیز از avr و زبان bascom بلد نیستم
سلام
خیلی ممنون از اطلاعات مفیدی که گذاشتید . من یه پروژه دارم طراحی alu چهاربیت با نرم افزار quartus . الان اولین بار که با این نرم افزار کار می کنم برای تحویل پروژه هم وقتی ندارم باید هفته آینده تحویل بدم ،وقتی فایل را کامپایل می کنم خطاهای زیر را می دهد ، تو رو خدا هرکس می تونه کمکم کنه ممنون می شوم
Info: ************************************************** *****************
Info: Running Quartus II Analysis & Synthesis
Info: Version 10.0 Build 218 06/27/2010 SJ Full Version
Info: Processing started: Sat Dec 11 08:55:27 2010
Info: Command: quartus_map --read_settings_files=on --write_settings_files=off exam -c exam
Info: Parallel compilation is enabled and will use 2 of the 2 processors detected
Info: Found 1 design units, including 1 entities, in source file exam.v
Info: Found entity 1: alu
Error: Top-level design entity "exam" is undefined
Error: Quartus II Analysis & Synthesis was unsuccessful. 1 error, 0 warnings
Error: Peak virtual memory: 192 megabytes
Error: Processing ended: Sat Dec 11 08:55:28 2010
Error: Elapsed time: 00:00:01
Error: Total CPU time (on all processors): 00:00:01
Error: Quartus II Full Compilation was unsuccessful. 3 errors, 0 warnings
سلام
خطای
Error: Top-level design entity "exam" is undefined
یعنی مرحله بالای کار شما واسه نزم افزار ناشناسه.مثلا فرض کنید شما اول با vhdl یک کد می نویسید و یک جمع کننده درست می کنید وقراره که از این جمع کننده توی یک پروزه دیگه استفاده کنید.راه سادش اینه که کدهای vhdl شما تبدیل به یک بلوک ویک قطعه شماتیکی بشه وبعد از اون..این قطعه جدید رو باید به quartus معرفی کنید اگه این کاری نکنید خطای بالا رو میده و میگه قطعه ای که به اسم "exam" رو که قبلا درست کردی وحالا داری توی یک پروزه جدید ازش استفاده می کنی رو من نمی شناسم و واسه من تعریف شده نیست و وقتی من دارم همه قطعه های پروزه شما رو کمپایل میکنم و بخش لینکر نرم افزار داره همه رو بهم می چسبونه تا یک قطعه کلی بسازه با یک ابهام به اسم"exam" روبرو می شه.
سلام وقت بخیرمیشه شماتیک یه alu هشت بیتی رو بگید چطوری باید رسم کنم ؟تو اینترنت سرچ میکنم شکلای متفاوتی میاره نمیدونم کدومشو باید رسم کنم میشه کمک کنیییییید تا شب باید پروژه تحویل بدم
دیدگاه