It is currently Fri Sep 10, 2010 8:40 pm




Post new topic Reply to topic  [ 1 post ] 
Digital Design with Pipeline 6 Bit Registers (Add & Mult) 
Author Message
Site Admin

Joined: Sat Jan 24, 2009 3:56 pm
Posts: 32
Post Digital Design with Pipeline 6 Bit Registers (Add & Mult)
This SLSL / 'sudo verilog' program implements the digital design of a pipeline having multiple registers, an adder, and multiplication architecture.

Code:
system proj4;

/* ===============   Control   =============== */

/*   0 1 2 3 4 5 6 7 8 9       */
/*   -----------------------      */
/*   |a| |b|a|c|b|d|c| |d| |      */
/*   -----------------------      */
/*   | |a| |b|a|c|b|d|c| |d|      */
/*   -----------------------      */
/*   + - + - + - + - + - +      */



/* ============   Architecture   ============*/
register R1[11], R2[11], R3[11], T1[11], R_in[4], R_out[11];
register cntr_state, in_clk, out_clk;

wire A[4], B[7], Mult_Result[11];
wire _S1[6], _C1[6], _S2[6], _C2[6], _S3[6], _C3[6], _S4[6], _C_OUT;
wire port1[4], sum[11], c_out, sub, port2[11];


begin
   CSA(andgate(a[0], b[6..1]), andgate(a[1], b[5..0]), 0:6, _S1, _C1);
   CSA(andgate(a[2], b[5..0]), {a[1]*b[6], _S1[5..1]}, _C1, _S2, _C2);
   CSA(andgate(a[3], b[5..0]), {a[2]*b[6], _S2[5..1]}, _C2, _S3, _C3);
   CPA({a[3]*b[6], _S3[5..1]}, _C3, 0:1, _S4, _C_OUT);
   Mult_Result := {_C_out, _S4, _S3[0], _S2[0], _S1[0], a[0]*b[0]};

   CPA(T1, xorgate(sub,mux(~cntr_state, 7:11, 3:11)), sub, sum, c_out);
   
   R_in, in_clk*clock := port1; /* in_clk * clock is effectively a mod 2 counter */
   R_out, out_clk*clock := sum;

   R1, clock := sum;
   R2, clock := R1;
   R3, clock := R2;
   T1, ~clock := Mult_result;
   port2 := R_out;
   a := mux(cntr_state, port1, R_in);
   b := mux(cntr_state, 5:7, R3[6..0]);
   
end;

begin
   cntr_state, clock := ~cntr_state;
   out_clk, ~clock := cntr_state;
   in_clk, ~clock := cntr_state;
   sub := ~cntr_state;
end;

begin
  read("proj4.in", in_clk*clock, port1);
  trace := clock;
end.


the very boring .in file
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14


the more interesting formatting / debugging file .fmt
Code:
4

Rin R1   R2   R3   Rout port2
------------------------

R_in 1 1 3 d
R1 5 1 3 d
R2 10 1 3 d
R3 15 1 3 d
R_out 20 1 3 d
port2 25 1 3 d


Sun Feb 01, 2009 8:35 pm
Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © phpBB Group.
Designed by Vjacheslav Trushkin for Free Forum/DivisionCore.