Professional Documents
Culture Documents
More Verilog 8-Bit Register With Synchronous Reset
More Verilog 8-Bit Register With Synchronous Reset
endmodule // reg8
Verilog - 1 Verilog - 2
endmodule // shiftReg
Verilog - 3 Verilog - 4
Q = A % %
! " %
# $ Q <= A
always @(posedge CLK) always @(posedge CLK)
begin begin
A = B; B = A;
% end end
&
! (
posedge CLK
' % & ! %
always @(posedge CLK) always @(posedge CLK)
always @(posedge CLK) begin begin
always @(posedge CLK) A <= B; B <= A;
begin begin
temp = B; end end
A <= B;
B = A; B <= A;
A = temp; end
end
Verilog - 5 Verilog - 6
Non-Blocking Assignment Counter Example
# $ ! )
! % % ! %
$ $ * %$ % 0 1 22
& + ), + - ./ " %
4 5 46
Mealy outputs ' % %
Verilog - 9 Verilog - 10
Moore Verilog FSM (cont’d) Mealy Verilog FSM for Reduce-1s example
Verilog - 11 Verilog - 12
6
Single-always Moore Machine
Restricted FSM Implementation Style (Not Recommended!)
" ! !
% )7 module reduce (clk, reset, in, out);
% % input clk, reset, in;
output out;
! ! reg out;
reg [1:0] state; // state register
22 % parameter zero = 0, one1 = 1, two1s = 2;
%
%
! 1
Verilog - 13 Verilog - 14
end
out = 0; assign #10 out = in1 & in2;
default: begin
state = zero;
out = 0; endmodule
end
endcase
endmodule
Verilog - 15 Verilog - 16
! ) !
assign #5 c = a | b; 0
assign #4 {Cout, S} = Cin + A + B;
always @(sum)
if (sum == 0)
#6 zero = 1;
else
#3 zero = 0;
Verilog - 17 Verilog - 18
Tri-State Buffers Test Fixtures
<
9: 6 $
< =
% % $ ;
% %
Verilog - 19 Verilog - 20
> +
module clockGenerator (CLK);
parameter period = 10; module clock_gen (masterclk); ! "
parameter howlong = 100; "
output CLK;
reg CLK; `define PERIOD = 10;
initial begin %
$readmemb("data.b", testVector);
count = 0; 0 ?
{ reset, data } = testVector[0];
end
Verilog - 25 Verilog - 26
3 % '
% "
! ! % % !
&
" 1 ! $
1% ! " 1 %
%
>
% % = !
! $
&
% ! ! % $
% " 1
% 0 % % %
*
% @ %
Verilog - 27 Verilog - 28
' " + % %% 0 %
A A% " !
" % % 8 $ %
% " % % " ! %
% " B ! $! 1 2 21 B % ! //5
%% "
! " , " 1
% %
=!
% %
! ! ! 0 ? %
% !
% C
% %
Verilog - 29 Verilog - 30
Inertial and Transport Delays A few requirements for CSE467...
3 ! $ !
8DE /+ F + ! %
, D 1 + E G E
! !
+
% ; $
E ./ 8 D + F % 8 %
+ E1 D ) 1
$ % ; % %
6 ) %
0
Verilog - 31 Verilog - 32